602SQL Documentation Index  

ODBC Driver for 602SQL on Linux

You can access the data not only from applications that support ODBC (e.g. StarOffice) using the ODBC driver in Linux, but also from web and script languages (e.g. PHP, Python, Perl or Tcl). The ODBC driver is a part of the basic 602SQL installation package.

If the ODBC driver manager (DM) is not present in older Linux distributions, you must install it first. We even recommend that you do this before you install 602SQL. Cooperation with the DM unixODBC (http://www.unixODBC.com) has been tested. You can get the source code for the DM and other useful utilities from the specified URL. Newer distributions, e.g. Red Hat 7.3 or higher or SUSE 8 or higher, already have the needed Driver Manager.

You must register the driver for the 602SQL server and the data sources over the 602SQL server in order to access data using the ODBC interface. Some Linux distributions have a graphic ODBC administrator, that simplifies these tasks.

There are programs, that require the ODBC data access to be enabled explicitly. You must recompile the PHP with --with-unixODBC, you must install the relevant modules for Perl, Python etc.

General Rules for Driver and Data Sources Registration

You must set the driver name (602sqlxx) and specify the path to the driver file (/usr/lib/602sqlxx/libodbc602xx.so) and to the config library (/usr/lib/602sqlxx/libodbcinst602xx.so) when registering the driver.

You must set a name for the data source and the driver (602sql9) and two additional parameters: SQLServerName (SQL server name) and ApplicationName (name of the application containing the data) when registering the data source.

Registering the Driver and Data Source in unixODBC

The description below refers only to the DM unixODBC. The file structure and utility names may differ for other DM.

The registration is stored in the odbcinst.ini and odbc.ini text files. These files are located in one of these folders (according to the DM version and installation method) - /etc/unixODBC, /etc or /usr/local/etc.

Registering ODBC driver for 602SQL

The ODBC driver will register automatically when installing the 602SQL server RPM, if the unixODBC is already installed.

The driver registration is in the odbcinst.ini file in the form:

Description = ODBC driver for 602sql11 server
Driver      = /usr/lib/602sql11/libodbc60211.so
Setup       = /usr/lib/602sql11/libodbcinst60211.so
FileUsage   = 1

The driver may also be registered manually using the ODBCConfig utility with the graphic interface (a part of UnixODBC).

Registering the data source

You must create a data source designated with a name (Data Source Name - DSN) in order to access data in the database. The data source specifies which driver will be used for data access, and contains the server name and application name that contains data.

The data source registration is in the odbc.ini file. The test_apl data source, that makes the data on the testdb server in the appl application accessible, is described as follows:

Driver = 602sql11
SQLServerName = testdb
ApplicationName = appl

Data sources common to all users (system data sources) are stored in a file in one of the folders specified above. Apart from these, there may exist data sources visible only for a single user (User DSN). User DSN are described in the .odbc.ini file stored in the home folder of this user.

A data source may be created by:

Applications, that form the basis for data sources, doesn't have to exist when the data source is created.

You can test the new data source using the text ODBC client isql, which is a part of the unixODBC distribution. You can connect to the test_apl data source as a Anonymous user with this command:

isql test_apl