Easysoft
TOC PREV NEXT INDEX



Easysoft ODBC-Sybase Driver User Guide - Configuration

Configuring the Easysoft ODBC-Sybase Driver

The Easysoft ODBC-Sybase Driver is usually installed on the computer where your applications are running. ODBC applications access ODBC drivers through the ODBC Driver Manager and a data source. The data source tells the Driver Manager which ODBC driver to load, which database to connect to and how to connect to it. This chapter describes how to create data sources, use DSN-less connections and configure the Easysoft ODBC-Sybase Driver.

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

For Easysoft ODBC-Sybase Driver installation instructions, see Installation.

Chapter Guide

Configuring the Easysoft ODBC-Sybase Driver

This section describes how to configure the Easysoft ODBC-Sybase Driver to connect to a Sybase database by using a data source or a a DSN-less connection string. The section assumes you are, or are able to consult with, a system administrator.

Setting Up Data Sources

There are two ways to set up a data source to your Sybase data:

¯ OR ¯

With the unixODBC included with the Easysoft ODBC-Sybase Driver distribution, a default data source named SYBASE is created and added to the SYSTEM odbc.ini file on the client computer when the Easysoft ODBC-Sybase Driver is installed.

By default, the Easysoft ODBC-Sybase Driver installation creates a SYSTEM data source named [SYBASE]. If you are using the unixODBC included in the Easysoft ODBC-Sybase Driver distribution, the SYSTEM odbc.ini file is in /etc.

If you built unixODBC yourself, or installed it from some other source, SYSTEM data sources are stored in the path specified with the configure option --sysconfdir=directory. If sysconfdir was not specified when unixODBC was configured and built, it defaults to /usr/local/etc.

If you accepted the default choices when installing the Easysoft ODBC-Sybase Driver, USER data sources must be created and edited in $HOME/.odbc.ini.


Notes

To display the directory where unixODBC stores SYSTEM and USER data sources, type odbcinst -j.

By default, you must be logged in as root to edit a SYSTEM data source defined in /etc/odbc.ini.


You can either edit the sample data source or create new 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.


Note

Attribute names in odbc.iniare not case sensitive.


The Driver attribute identifies the ODBC driver in the odbcinst.ini file to use for a data source. When the Easysoft ODBC-Sybase Driver is installed into unixODBC, it places a SYBASE entry into the odbcinst.ini file. You should always have Driver = SYBASE in your Easysoft ODBC-Sybase Driver data sources therefore.

To configure a Sybase data source, in your odbc.ini file, you need to specify:

For example:

[SYBASE]

 Driver = SYBASE

 Database = my_database

 User = my_user

 Password = my_password

 SERVER_HOST = my_server_name_or_ip_address

 SERVER_PORT = 4100 # For Sybase ASE Express use 5000.

Optional Attribute Fields

The following optional attributes may also be set in the odbc.ini file..

Attribute Description
Description A single line of descriptive text that may be retrieved by some applications to describe the data source.
METADATA_ID When ON (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 value of 0.
METADATA_DONT_CHANGE_CASE When ON (set to 1), the case of the parameter values passed to metadata calls will not change.
TEXTSIZE Sets the maximum size, in bytes, of text or image data returned from the server. The default size is 32000. If data is larger than this value, the data will be truncated, without any indication that it has been truncated.
QUOTED_IDENTIFIERS 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.

Figure 4: Optional Easysoft ODBC-Sybase Driver data source settings.

Environment

The Easysoft ODBC-Sybase Driver must be able to find the following shared objects, which are installed during the Easysoft ODBC-Sybase Driver installation:

By default, this is located in /usr/local/easysoft/unixODBC/lib/libodbcinst.so.

By default, this is located in /usr/local/easysoft/lib/libeslicshr.so.

By default, this is located in /usr/local/easysoft/lib/libessupp.so.

You may need to set 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.


Note

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


Establishing a Test Connection

The isql query tool lets you test your Easysoft ODBC-Sybase Driver data sources.

To test the Easysoft ODBC-Sybase Driver connection

1.  Change directory into /usr/local/easysoft/unixODBC/bin.

2.  Type ./isql -vdata_source, where data_source is the name of the target data source.

3.  At the prompt, type an SQL query. For example:

 SQL> select * from systypes;

¯ OR ¯

 Type help to return a list of tables:

 SQL> help

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 computer, nnnn is the port number with which to connect to the server and sybase is the driver name.

Further Easysoft ODBC-Sybase Driver attribute settings, as described in Setting Up Data Sources, can also be added to the connection string using the same "PARAMETER=value;" format. For example:

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.

 


Copyright Notice
TOC PREV NEXT INDEX


© 1993 - 2008 Easysoft Limited. All rights reserved.