Configuring ODBC

This section provides additional information on configuring ODBC data sources using the drivers installed with EAServer.

Before you begin:

  1. Ensure that TDSQUERY and DSQUERY environment variables are set to null.

  2. Remove .odbc.ini file from the user home directory, if it exists. Otherwise, this may affect the attributes defined file in $JAGUAR/unixODBC/odbc.ini.


Creating a unixODBC connection cache

When you create a unixODBC connection cache, you must define the “Server Name” with the ODBC data source name. You can obtain the data source name from the odbc.ini file, which is located in $JAGUAR/unixodbc.


Using ODBC to connect to ASA

Adaptive Server® Anywhere is installed as part of both a typical and a full installation. The installation includes the ODBC driver to connect to ASA database. For example, to connect to the jagdemo sample database, specify the absolute path to the ASA ODBC driver in the data source’s driver entry of the $JAGUAR/unixodbc/odbcinist.ini file.

  1. Use a text editor to modify the ODBC driver information in $JAGUAR/unixodbc/odbcinst.ini.For example:

    [SYBASA]
    Description = Sybase ASA9.0 ODBC Driver
    Driver = $JAGUAR/SYBSasa9/lib/libdbodbc9.so
    Setup = $JAGUAR/unixodbc/lib/libtdsS.so
    TDS_Version = 5
    UsageCount = 3
    CPTimeout =
    CPReuse = 
    
  2. Add ODBC data source information to $JAGUAR/unixodbc/odbc.ini. For example:

    [EAS Demo DB V10]
    Driver = SYBASA
    Trace = no
    Tracefile = sql.log
    Port = 2640
    ServerName = easdemodb10
    TDS_version = 5.0
    

    The name of the driver must be the same as that defined in odbcinst.ini. The server name is the database name without the extension.

    To verify whether the connection is correct, go to $JAGUAR/unixodbc/bin, and use the isql command-line tool to execute:

    ./isql -v “EAS Demo DB V10” user password

    If isql shows a command prompt and not an error message, the connection is successful.


Using ODBC to connect to ASE

If you are using ASE as a data source, and FreeTDS as the database driver, you must configure the EAServer.

  1. Add the data source information to $JAGUAR/freetds/etc/freetds.conf file. For example, to connect to the MySybase sample database, enter:

    [MySybase]
    host = ASE hostname
    port = 5000
    tds version = 5.0
    

    where:

    Test the connection to MySybase using the command-line tool in $JAGUAR/freetds/bin/tsql.

    ./tsql -S MySybase -U dba -P dba

    If the connection is successful, the data source name should be the same as the ASE database name. This implies that FreeTDS is working correctly.

  2. Modify the odbcinst.ini file in $JAGUAR/unixodbc to include the ODBC data source information. Add an ODBC driver item to include the FreeTDS ODBC library. For example:

    [SYBASE]
    Description = Sybase ASE ODBC Driver
    Driver = $JAGUAR/freetds/lib/libtdsodbc.so
    Setup = $JAGUAR/unixodbc/lib/libtdsS.so
    TDS_Version = 5
    UsageCount = 3
    CPTimeout =
    CPReuse =
    
  3. Add the ODBC data source information to $JAGUAR/unixodbc/odbc.ini. For example:

    [testase]
    Driver = SybaseASE
    Trace = yes
    Servername = ASE hostname
    Port = 5000
    Database = tempdb
    uid = dba
    

    The name of the driver must be the same as that defined in odbcinst.ini. The server name is the database name without the extension.

    To verify whether the connection is correct, go to $JAGUAR/unixodbc/bin, and use the isql command-line tool to execute:

    ./isql testase user password

    If isql shows a command prompt rather than an error message, the connection is successful.


Using ODBC from other client applications

If you have an ODBC client that uses an ODBC driver manager from a third party, edit the driver name in odbc.ini file, and modify the odbcinst.ini file to specify that driver. Refer to the third-party documentation for more details.