Easysoft ODBC-Sybase Driver User Guide - Configuration

Configuring the Easysoft ODBC-Sybase Driver

In terms of the Easysoft ODBC-Sybase Driver, the client is the machine running the ODBC application with which you want to access the data on your Sybase database.

To allow an ODBC application on the client machine to access data on the remote server, you need to create a data source on the client.

This data source uses the Easysoft ODBC-Sybase Driver driver and specifies the attributes required to connect to the data source on the remote server.

Before setting up a data source on your client machine, you must have successfully installed the Easysoft ODBC-Sybase Driver on this machine.

Instructions for installing the Easysoft ODBC-Sybase Driver on Unix platforms are provided in "Installation" on page 17.

Chapter Guide

Configuring the client

This section outlines how to configure the Easysoft ODBC-Sybase Driver to connect to an Sybase database by using a data source and assumes you are, or have available for consultation, an Sybase Database Administrator.

DSN-less Connections

In addition to using a data source, you can also connect to a database by using a DSN-less connection string of the form:

SQLDriverConnect(..."SERVER_HOST=server;

SERVER_PORT=nnnn;Driver=sybase;"...)

where server is the name of the host server machine, nnnn is the port number with which to connect to the server machine and sybase is the driver name.

Further Easysoft ODBC-Sybase Driver attribute settings, as described in DSN setup, can also be added to the connection string using the same "PARAMETER=value;" format, such as:

SQLDriverConnect(..."DB=pubs;UID=demo;PWD=easysoft;"...)

where pubs is the database name, demo is the user name with which to connect to the database and easysoft is the password for the demo user.

DSN setup

There are two options when setting up a data source to your Sybase data:

¯ OR ¯

With unixODBC, a default DSN named [SYBASE] is created and added to the system odbc.ini file on the client machine when the Easysoft ODBC-Sybase Driver is installed.

However, if you have built unixODBC yourself, then it will be whatever path you specified in the sysconfdir=directory configure option (if sysconfdir has not been specified then the path will default to /usr/local/etc).

If you accepted the default Easysoft ODBC-Sybase Driver installation then user data sources must be created and edited in $HOME/.odbc.ini.


NB

By default, you must be logged in as root to edit a system data source defined in /etc/odbc.ini, but user data sources created in an .odbc.ini file in a home directory are visible to an individual user only.


You may either change some of the initial configuration parameter values for the sample data source or add extra data sources.

Each section of the odbc.ini file starts with a data source name in square brackets [ ] followed by a number of attribute=value pairs.


NB

Attribute names in odbc.iniare not case sensitive.


For the addition of a data source, all the settings in the following example must be appended to the relevant odbc.ini file.


NB

More details of configuring data sources with unixODBC can be found at www.unixodbc.org.


To configure a Sybase DSN in your odbc.ini file, you need to edit:

e.g.

[SYBASE]

Driver = SYBASE

Description =

Database = test

User = sa

Password =

SERVER_HOST = server_name

SERVER_PORT = 4100

Other optional attribute values may be set in the odbc.ini file, as follows:

A description of this data source entry.

When ON (i.e. set to 1), the default value of the Connection Attribute SQL_ATTR_METADATA_ID is set to SQL_TRUE .

Note that METADATA_ID is added to odbc.ini automatically with a default setting of 0.

When ON (i.e. set to 1), the case of the parameter values passed to metadata calls will not change.

This attribute sets the maximum size, in bytes, of text/image data returned from the server. The default size is 32000. If data is larger than this value the data will be truncated, with out any indication that it has been truncated.

This attribute switches the sybase database 'quoted_identifier' setting to 'on'. This enables support for quoted identifiers and also changes the appropriate SQLGetInfo values returned

Environment

The Easysoft ODBC-Sybase Driver must be able to find the following shared objects (which are installed as part of the Easysoft ODBC-Sybase Driver install routine):

By default this will always be located in /usr/local/easysoft/unixODBC/lib/libodbcinst.so:

By default this will always be located in /usr/local/easysoft/lib/libeslicshr.so

By default this will always be located in /usr/local/easysoft/lib/libessupp.so

You may need to set up and export LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH (depending on your operating system and run-time linker) to include the directories where libodbcinst.so, libeslicshr.so and libessupp.so are located.


NB

The shared object file extension (.so) may vary depending on the operating system.


Establishing a Test Connection

You can prove that the Easysoft ODBC-Sybase Driver is working by executing the following Unix commands to run the isql query tool:

1.  Change directory into

/usr/local/easysoft/unixODBC/bin

2.  Type ./isql -vDSN

where [DSN] is the name of the target data source

3.  At the prompt you will be able to enter SQL commands to query your database, such as:

 SQL> select * from systypes;

 to return sample data.