Configuring an ODBC driver

To use an ODBC data source in your application, the ODBC configuration must include:

ODBC.INI

To allow the user to connect to a particular data source, your installation program must provide a definition for that data source in the ODBC.INI key in the registry on the computer that accesses the data source, in HKEY_CURRENT_USER for a user DSN or in HKEY_LOCAL_MACHINE for a system DSN. The data source definition specifies the name and location of the database driver as well as the command required to start the database engine. The data source in the ODBC Data Sources key must also be listed in ODBC.INI.

The following shows typical registry entries for a data source called MyApp DB that uses Adaptive Server Anywhere. Registry keys are enclosed in square brackets and are followed by string values for that key in the format "Name"="Value":

[HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\MyApp DB]
"Driver"="C:\Program Files\Sybase\SQL Anywhere 9\
   win32\dbodbc9.dll"
"Start"="c:\program files\sybase\SQL Anywhere 9\win32\
   rteng9.exe -c8m"
"UID"="dba"
"PWD"="sql"
"Description"="Database for my application"
"DatabaseFile"="C:\Program Files\myapps\myapp.db"
"AutoStop"="Yes"
[HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\
   ODBC Data Sources]
"MyApp DB"="Adaptive Server Anywhere 9.0"

You might use one of the following ways to make the modifications to ODBC.INI:

For more information about the contents of the registry entries for ODBC drivers and data sources, see Connecting to Your Database.

ODBCINST.INI

Your installation program needs to make two types of entry in the ODBCINST.INI key in HKEY_LOCAL_MACHINE\SOFTWARE\ODBC for each driver that your deployed application uses:

If the ODBC database driver files are not located in a directory on the system path, you also need to add their location to the App Paths key for the executable file in the registry.

If you are using ODBC drivers obtained from a vendor, you can use the driver’s setup program to install the driver and create registry entries.

The following shows typical registry entries for Adaptive Server Anywhere. Registry keys are enclosed in square brackets and are followed by string values for that key in the format "Name"="Value":

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
   CurrentVersion\App Paths\myapp.exe]
"Default"="C:\Program Files\myapps\MYAPP.EXE"
"Path"="Program Files\sybase\shared\PowerBuilder;
   c:\program files\sybase\SQL Anywhere 8\win32\;
   c:\program files\sybase\shared\DataDirectODBC;"

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\
   ODBC Drivers]
"Adaptive Server Anywhere 9.0"="Installed"
"PB DataDirect OEM 3.60 32-BIT Sybase"="Installed"

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\
   Adaptive Server Anywhere 9.0]
"Driver"="c:\program files\sybase\SQL Anywhere 9\
   win32\dbodbc9.dll"
"Setup"="c:\program files\sybase\SQL Anywhere 9\
   win32\dbodbc9.dll"

For more information about the contents of the registry entries for ODBC drivers and data sources, see Connecting to Your Database.

NoteDatabase profiles Connecting to Your Database includes information about database profiles. Profiles, which are defined in the Windows registry, provide the information necessary to connect to data sources from the development environment. Your users do not need database profiles.