Programmer Guide : solidDB® ODBC API : Connecting to a data source : Using solidDB® ODBC Driver with unixODBC
  
Using solidDB® ODBC Driver with unixODBC
unixODBC is an ODBC driver manager for UNIX type environments. Instead of linking an application directly with the solidDB® ODBC driver, a unixODBC DriverManager can be used.
For detailed information on unixODBC and the unixODBC DriverManager, see http://www.unixodbc.org/.
Configuration files
The unixODBC DriverManager loads the correct data source driver according to the specifications in the following two configuration files:
odbc.ini or .odbc.ini: specifies the logical name of the data source and the actual ODBC driver
The odbc.ini file defines the system-level settings that are available to all users. The .odbc.ini file defines user-level settings.
odbcinst.ini: connects the logical driver name with its physical location in the file system.
The odbcinst.ini is a system-level file.
In addition to the files above, the solidDB® ODBC Driver needs a client-side solid.ini configuration file where the logical data source name is connected with the a valid solidDB® connect string.
Syntax of the odbc.ini configuration files
The odbc.ini or .odbc.ini file must include at least the following two items for each data source:
Logical name of the data source inside brackets, for example [my_solid]
Logical name of the actual ODBC driver to be used by using the syntax
Driver=<driver name>
For example
Driver = solid_odbc
An additional description can be added by using the syntax
Description=My first Solid
All additional information is ignored.
Syntax of the odbcinst.ini configuration file
The logical name and the physical location of the ODBC driver must be specified in the odbcinst.ini file as follows:
[<the logical name of the driver>], for example, [solid_odbc]
Driver = <absolute path to the driver>, for example, Driver = /home/jsmith/sacl2x64.so
Syntax of the client-side solid.ini configuration file
In the client-side solid.ini file, the logical data source name must be connected to a valid solidDB® connect string (network name) as follows:
[Data Sources]
<the logical data source name> = <connect_string> , for example, my_solid=tcp my_machine 1964
Location of the configuration files
The system-level configuration files, odbc.ini and odbcinst.ini are located in a system level configuration directory, such as /etc/. For example:
/usr/local/etc/odbc.ini
/usr/local/etc/odbcinst.ini
User-level data sources are specified in ~/.odbc.ini.
The client-side solid.ini file can be located either in the directory set by the SOLIDDIR environment variable or in the current working directory.
Linking the driver
To link to the unixODBC driver instead of the solidDB® ODBC Driver:
1 Copy the unixODBC driver to the location of your choice.
2 Replace the solidDB® ODBC Driver library file with the unixODBC library file. For example:
Direct linking: LDFLAGS = $(SOLID_LIB)/linux/sacl2x70.so
unixODBC driver manager: LDFLAGS = $(SOLID_LIB)/linux/libodbc.so
Examples of configuration files
$HOME/.odbc.ini
[my_solid]
Description = Testing solidDB®
Driver           =solid_odbc
$HOME/.odbcinst.ini
[solid_odbc]
Description = The solidDB® ODBC driver
Driver           = /home/jsmith/solid/bin/sacl2x64.so
$SOLIDDIR/solid.ini
[Data Sources]
my_solid = tcp 1964
See also
Connecting to a data source