Programming Interfaces Guide
CHAPTER 4. ODBC Programming
ODBC applications do not generally link directly to the ODBC driver. Instead, they link to the ODBC driver manager, which in turn handles the driver or drivers that may be required.
On Windows operating systems, the driver manager is supplied by Microsoft. On other operating systems, other vendors do supply ODBC driver managers; for example, Intersolv and Visigenic supply ODBC driver managers for UNIX. However, driver managers are less generally available than on Windows operating systems.
It is also possible to develop applications that link directly to the ODBC driver. This is particularly useful on operating systems such as UNIX, where your end users may not have access to an ODBC driver manager.
You develop an application that uses the ODBC driver directly by carrying out the following steps:
Use the supplied import library as usual.
For descriptions of the import libraries, see Compiling and linking an ODBC application.
Specify the DRIVER= parameter in the szConnStrIn argument to the SQLDriverConnect function. For example:
szConnStrIn = "driver=ospath/dbodbc6.dll;dbf=c:\asademo.db"
where ospath is the operating system subdirectory of your Adaptive Server Anywhere installation directory.
An ODBC driver manager is not included with Adaptive Server Anywhere, but there are third party driver managers available. An ODBC driver manager includes the following files:
Operating system |
Files |
---|---|
Solaris/Sparc, AIX |
|
HP-UX |
|
The Adaptive Server Anywhere ODBC driver is the following file:
Operating system |
ODBC driver |
---|---|
Solaris/Sparc, AIX |
|
HP-UX |
|
The libraries with the _r are for use with multi-threaded applications. If you are developing single-threaded applications, use the library without the _r.
If you want to use the Adaptive Server Anywhere ODBC driver without an ODBC driver manager you can do so, but you can then access only Adaptive Server Anywhere data sources. The libraries are installed as symbolic links to the shared library with a version number (in parentheses).
If you are creating a custom ODBC application, you can link directly to the Adaptive Server Anywhere ODBC driver.
If your application requires an ODBC driver manager, create symbolic links for both the libodbc and libodbcinst shared libraries to the Adaptive Server Anywhere ODBC driver.
If an ODBC driver manager is present, Adaptive Server Anywhere queries the driver manager for data source information. If Adaptive Server Anywhere does not detect the presence of an ODBC driver manager, it uses ~/.odbc.ini for data source information.