Using ODBC data sources on UNIX

On UNIX operating systems, ODBC data sources are held in a file named .odbc.ini. When creating a .odbc.ini file on any UNIX system, you must use the long form of each identifier, for example:

[My Data Source]
EngineName=myserver
CommLinks=tcpip(port=1870)
Userid=DBA
Password=sql

You can enter any connection parameter in the .odbc.ini file. Network communications parameters are added as part of the CommLinks (LINKS) parameter. For a complete list of network parameters, see “Network communications parameters”.

You can create and manage ODBC data sources on UNIX using the iqdsn command-line utility. For more information see “Creating an ODBC data source from the command line”.

File location

References to ODBC functions are resolved at run time.

To connect with ODBC data sources, the location of your .odbc.ini file must be referenced by the $ODBCINI or the $ODBCHOME variable. Sybase IQ searches the directories specified by the variables below in the following order:

  1. ODBCINI – must contain the exact full pathname of the .odbc.ini file.

  2. ODBCHOME – must be set to the directory that contains the .odbc.ini file.

On UNIX systems, Sybase IQ installs only the ODBC driver, and not the driver manager. The name of the driver file includes an operating system-specific extension, for example, so for Solaris systems. For example, on a Sun Solaris system, if you are using an ODBC application that uses libodbc.so (libodbc.so.1) or libodbcinst.so (libodbcinst.so.1), simply create symbolic links for these that point to $SYBASE/IQ-15_1/lib/libdbodbc11.so.1. If you are creating a custom ODBC application, you can link directly to dbodbc11.so.

If an ODBC driver manager is not present, the IQ ODBC driver (found via the symbolic link) uses the .odbc.ini for data source information.

See Chapter 7, “ODBC Programming” in the SQL Anywhere Server – Programming to ensure that you are using the correct driver for your platform.

Enabling ODBC trace output

To create an ODBC trace file, set the environment variables ASA_ODBCTRACE_VERBOSE and ASA_ODBCTRACE_FILE, for example:

$ setenv ASA_ODBCTRACE_VERBOSE ALL
$ setenv ASA_ODBCTRACE_FILE
/bluesun/fiona/odbctrace.out
$ dbisql -c "dsn=J123456" -nogui

On UNIX and Linux systems, use the libdbodbc11.so driver and leave it up to the driver to choose the multi-threaded or non-threaded driver. Tracing capability exists in the switch (libdbodbc11.so), not in the individual drivers (libdbodbc11_n.so or libdodbc11_r.so). If you change the driver to point to the _r version, you remove the switch from the call sequence, preventing the tracing.