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 SQL 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\SQL Anywhere 11\
	Bin32\dbodbc11.dll"
"Start"="C:\Program Files\SQL Anywhere 11\Bin32\
	dbeng11.exe"
"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"="SQL Anywhere 11.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 SQL 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\SQL Anywhere 11\Bin32\;"

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\
   ODBC Drivers]
"SQL Anywhere 11"="Installed"

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\
   SQL Anywhere 11]
"Driver"="C:\Program Files\SQL Anywhere 11\
   Bin32\dbodbc11.dll"
"Setup"="C:\Program Files\SQL Anywhere 11\
   win32\dbodbc11.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, which are defined in the Windows registry. They provide the information necessary to connect to data sources from the development environment. Your users do not need database profiles.