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.
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.
In addition to using a data source, you can also connect to a database by using a DSN-less connection string of the form:
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:
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.
There are two options when setting up a data source to your Sybase data:
- Create a system data source (which is available to anyone who logs onto this Unix machine)
¯ OR ¯
- Create a user data source (which is only available to the user who is currently logged into this Unix machine)
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.
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.
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.
To configure a Sybase DSN in your odbc.ini file, you need to edit:
- the physical database name (Database)
- the Sybase target database user name (User)
- the Sybase target database password (Password)
- the host name or IP address of the machine on which the Sybase server is running (SERVER_HOST)
- the port on which the Sybase server is listening, which is 4100 by default (SERVER_PORT)
Driver = SYBASE
Database = test
User = sa
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
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.
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
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.