Configuring ODBC (The BDE/Idapi ODBC Socket) ---------------- Two files contain the configuration information for ODBC. The file odbcinst.ini in the windows directory lists the ODBC drivers. The file odbc.ini lists the ODBC data sources. Use the administrative program "ODBCADMIN" to modify these files. The files are ASCII, but direct user editing is not recommended. In addition, as part of the ODBC API, the SQLDrivers() and SQLDataSources() calls can be used to read and modify the ODBC configuration information. Example odbc.ini file: [ODBC Data Sources] Q+E Oracle7=INTERSOLV Oracle7 Q+E Oracle=INTERSOLV Oracle Q+E Oracle7P=INTERSOLV Oracle7 Q+E QESQLServer=INTERSOLV SQLServer [Q+E Oracle7] Driver=C:\windows\system\QEOR706.DLL Description=ODBC Oracle7 Driver ServerName=X:WIZARD Servers= LogonID=frankb LockTimeOut= ArraySize= QEWSD=34480 The first block [ODBC Data Sources] lists four ODBC data sources and their associated drivers. Then, for each data source, there is a block that describes the datasource. One data source [Q+E Oracle7] is shown in the example above. The block for the data source must contain the driver .dll path and can contain optional descriptions of the datasource. Example odbcinst.ini file (the file that describes the drivers): [ODBC Drivers] INTERSOLV Oracle7=Installed INTERSOLV Oracle=Installed INTERSOLV NetWareSQL=Installed INTERSOLV XDB=Installed INTERSOLV TextFile (*.*)=Installed INTERSOLV ExcelFile (*.xls)=Installed [INTERSOLV Oracle7] Driver=C:\QEODBC\QEOR706.DLL Setup=C:\QEODBC\QEOR706.DLL APILevel=1 ConnectFunctions=YYY DriverODBCVer=02.01 FileUsage=0 SQLLevel=1 The first block [ODBC Drivers] is a list of the six installed drivers. The second block is the configuration block for the first of the six installed drivers. Every installed driver (for example, INTERSOLV Oracle7) will also have an entry in the odbc.ini file. Each such driver block has two required entries: the .dll path to Driver and the .dll path to Setup. These .dll's are loaded to either access a datasource [odbc.ini] or to configure a driver [odbcinst.ini]. The remaining descriptions (APILevel, etc.) are optional, depending on the driver. There are 7 designed properties. There is not a place for driver-specific properties. For more information see page 162 in ODBC2.0 reference. BDE and ODBC ------------ The configuration of BDE (at least as it relates to SQL) is similar to the ODBC configuration. A user specifies a series of "ALIASES" (much like the ODBC datasources) and "DRIVERS" (like the ODBC drivers). Example Aliases section of a BDE configuration file: ORA_7DSG: DB INFO: TYPE:ORACLE PATH:NULL DB OPEN: SERVER NAME:ORACLE_DSG USER NAME:frankb NET PROTOCOL:SPX/IPX OPEN MODE:READ/WRITE SCHEMA CACHE SIZE:32 LANGDRIVER:NULL SQLQRYMODE:NULL SQLPASSTHRU MODE:NOT SHARED DATE MODE:0 SCHEMA CACHE TIME:-1 There are two sub-properties: INFO and OPEN. INFO information is used to associate the alias with the correct driver name (see TYPE: ORACLE). The OPEN information is used after the datasouce is opened. Example Drivers section from BDE configuration file (idapi.cfg): ORACLE: INIT: VERSION:1.0 TYPE:SERVER DLL:SQLD_ORA.DLL VENDOR INIT:ORA7WIN.DLL DRIVER FLAGS:NULL DB OPEN: SERVER NAME:NULL USER NAME:NULL NET PROTOCOL:NULL OPEN MODE:READ/WRITE SCHEMA CACHE SIZE:8 LANGDRIVER:NULL SQLQRYMODE:NULL SQLPASSTHRU MODE:NOT SHARED SCHEMA CACHE TIME:NULL Note that it is this entry "ORACLE" that gets associated with the aforementioned datasource's reference to a driver. IDAPI ODBC Socket Config Entries ---------------------- Example Database section from idapi.cfg file: IDAPT_ORA7: DB INFO: TYPE:ODBC_ORA7 PATH:NULL DB OPEN: USER NAME:frankb DSN:Q+E Oracle7 OPEN MODE:READ/WRITE SCHEMA CACHE SIZE:8 SQLQRYMODE:NULL SQLPASSTHRU MODE:SHARED AUTOCOMMIT SCHEMA CACHE TIME:-1 Example Drivers section from idapi.cfg file: ODBC_ORA7: INIT: VERSION:1.0 TYPE:SERVER DLL:IDODBC01.DLL ODBC DRIVER:INTERSOLV Oracle7 DRIVER FLAGS:NULL LANGDRIVER:NULL DB OPEN: USER NAME:frankb ODBC DSN:Q+E Oracle7 OPEN MODE:READ/WRITE SCHEMA CACHE SIZE:8 SQLQRYMODE:NULL LANGDRIVER:NULL SQLPASSTHRU MODE:NULL Note that the "DLL" field for the driver is the ODBC Socket .dll, NOT the ODBC .dll. The ODBC .dll is loaded implicitly, when the socket attempts to connect to a datasource. The datasource that it tries to open is "Q+E Oracle7" (the DSN entry). AutoODBC -------- AutoODBC builds the ODBC Socket datasource and driver names automatically for BDE using the ODBC names from the ODBC configuration files. Example of the idapi.cfg entries created by AutoODBC referring to the driver (INTERSOLV Oracle7) and datasource (Q+E Oracle7): Q+E Oracle7: DB INFO: TYPE:INTERSOLV Oracle7 PATH:NULL DB OPEN: USER NAME:frankb DSN:Q+E Oracle7 OPEN MODE:READ/WRITE SCHEMA CACHE SIZE:8 SQLQRYMODE:NULL SQLPASSTHRU MODE:SHARED AUTOCOMMIT SCHEMA CACHE TIME:-1 INTERSOLV Oracle7: INIT: VERSION:1.0 TYPE:SERVER DLL:IDODBC01.DLL ODBC DRIVER:INTERSOLV Oracle7 DRIVER FLAGS:NULL LANGDRIVER:NULL DB OPEN: USER NAME:frankb ODBC DSN:Q+E Oracle7 OPEN MODE:READ/WRITE SCHEMA CACHE SIZE:8 SQLQRYMODE:NULL LANGDRIVER:NULL SQLPASSTHRU MODE:NULL