5.1.1.Creating ODBC Data Sources

Windows ODBC Data Sources

The Microsoft ODBC 2.0, 3.0 & 3.5 Driver Manager (depicted below) allows the creation of User, System, and File DSNs.

A User DSN will only be available to the user who creates the data source; a System DSN will be available to the whole system so that any user, including the system account, will be able to use that data source; A File DSN is a special 'mobile' data source that stores the data source information associated with the ODBC Driver in a file that is sharable.

The steps for creating a DSN are as follows:-

From the desired tab (User; System; File) press the Add button to begin creating a new Data source.

Figure5.1.Microsoft ODBC Administrator

Microsoft ODBC Administrator

Pick the ODBC Driver to be used to create your ODBC DSN. In this example the Driver Labeled "OpenLink Lite for DB2 (32 Bit)" is highlighted.

Figure5.2.Microsoft ODBC Administrator

Microsoft ODBC Administrator

Once you have selected the appropriate OpenLink Lite Driver, you will be presented with the OpenLink ODBC Data Source Configuration Wizard for the driver selected. The Wizard has several frames, most of which require you to provide information.

Data Source Tab

The first tab is the Data Source Tab. The following parameters are common to all databases.

Figure5.3.Data Source tab (DB2 example)

Data Source tab (DB2 example)

  • Name. (Data source) The name of the ODBC DSN; this is how you will interact with the OpenLink Lite ODBC Driver from within ODBC-compliant applications once your ODBC DSN has been created.

  • Desription. Additional information that further describes the ODBC DSN that you are creating.

Database-Specific Tab

In the second frame of the wizard, you enter a database alias for the underlying communications layer of the database, and a username and password. If you select the "Connect now to verify that all settings are correct" check-box, pressing the Next> button will verify that DSN can connect.

Figure5.4.Database-specific tab (DB2 example)

Database-specific tab (DB2 example)

OpenLink Parameters

The third frame contains OpenLink-specific parameters for the DSN connection; here you can set the connection to be read-only, have it defer the fetching of long (BLOB) data, disable interactive login, set a row-buffer size (the number of records to be transported over the network in a single network hop), set a file containing SQL statements to run on login, set the dynamic cursor sensitivity level, and enable logging to a file.

Figure5.5.OpenLink Parameters tab (DB2 example)

OpenLink Parameters tab (DB2 example)

ODBC Parameters

The fourth frame contains more custom parameters: you can enable changes for the MS Jet Engine, disable autocommitting, and disable the rowset size limit. You can also set the SQL_DBMS_NAME (required for some applications, notably Access).

Figure5.6.ODBC Parameters tab (DB2 example)

ODBC Parameters tab (DB2 example)

`About' frame

The fifth and final frame in the wizard shows the details of the connection - the driver name and version and DSN configuration parameters; it also gives you the option to test the data-source.

Figure5.7.`About' tab (DB2 example)

`About' tab (DB2 example)

Glossary of Standard Configuration Options

  • Name. (Data source) The name of the ODBC DSN; this is how you will interact with the OpenLink Lite ODBC Driver from within ODBC-compliant applications once your ODBC DSN has been created.

  • Desription. Additional information that further describes the ODBC DSN that you are creating.

  • MaxRows Override. Allows you to define a limit on the maximum number of rows to returned from a query. The default value of 0 means no limit.

  • Initial SQL. Lets you specify a file containing SQL statements that will be run against the database upon connection, automatically.

  • Enable Microsoft Jet Engine Options. Extra support or altered functionality for better compatibility with Microsoft Jet using applications such as Microsoft Access.

  • Disable AutoCommit. Change the default commit behaviour of the OpenLink Lite Driver. The default mode is AutoCommit mode (box unchecked).

  • Disable Rowset Size Limit. Disable the limitation enforced by the cursor library. The limitation is enforced by default to prevent the Driver claiming all available memory in the event that a resultset is generated from an erroneous query is very large. The limit is normally never reached.

  • High Cursor Sensitivity

    Enables or disables the row version cache used with dynamic cursors.

    When dynamic cursor sensitivity is set high, the Cursor Library calculates checksums for each row in the current rowset and compares these with the checksums (if any) already stored in the row version cache for the same rows when fetched previously. If the checksums differ for a row, the row has been updated since it was last fetched and the row status flag is set to SQL_ROW_UPDATED. The row version cache is then updated with the latest checksums for the rowset.

    From the user's point of view, the only visible difference between the two sensitivity settings is that a row status flag can never be set to SQL_ROW_UPDATED when the cursor sensitivity is low. (The row status is instead displayed as SQL_ROW_SUCCESS.) In all other respects, performance aside, the two settings are the same - deleted rows don't appear in the rowset, updates to the row since the row was last fetched are reflected in the row data, and inserted rows appear in the rowset if their keys fall within the span of the rowset.

    If your application does not need to detect the row status SQL_ROW_UPDATED, you should leave the 'High Cursor Sensitivity' checkbox unchecked, as performance is improved. The calculation and comparison of checksums for each row fetched carries an overhead.

    If this option is enabled, the table oplrvc must have been created beforehand using the appropriate script for the target database.

  • Row Buffer Size. This attribute specifies the number of records to be transported over the network in a single network hop. Values can range from 1 to 99.

  • Default UserID. This attribute specifies the default username to be used when attempting to make a connection. You may still override this at run time.

  • Hide Login Dialog. Suppress the ODBC "Username" and "Password" login dialog box when interacting with your ODBC DSN from within an ODBC compliant application.

  • Read Only connection. Specify whether the connection is to be "Read-only". Make sure the checkbox is unchecked to request a "Read/Write" connection.