unixODBC and Adaptive Server Enterprise

To communicate with an Adaptive Server Enterprise database, ODBC clients need an ODBC driver. On Linux platforms, the Open Client™ package includes an ODBC driver; on other UNIX platforms, it does not.

On UNIX, FreeTDS allows ODBC clients to talk to Adaptive Server Enterprise databases. FreeTDS is an open source implementation of the TDS (Tabular Data Stream) protocol. You can install FreeTDS to use with unixODBC.

StepsInstalling FreeTDS

  1. Download FreeTDS from the FreeTDS Web site. Under Quick Links | Latest Versions, select Stable Release.

  2. Save freetds-stable.tgz to your machine, then uncompress the file with gunzip.

  3. Change to the FreeTDS installation directory, and run:

    On Solaris and HP UNIX platforms:

    ./configure --prefix=$DJC_HOME/freetds \
    --with-tdsver=5.0 \
    --with-unix-nodm=$DJC_HOME/odbc
    

    On AIX:

    ./configure --prefix=$DJC_HOME/freetds \
    --with-tdsver=5.0 \
    --disable-shared \
    --with-unix-nodm=$DJC_HOME/odbc
    

    The console displays the configuration status.

  4. On Solaris, verify that cc is before gcc in the path to use the SUNWspro6.1 compiler.

  5. Change to the src subdirectory, and run:

    make; make install
    

    If you see the following error messages, the problem may be errors in the libtool script.

    ld: fatal: option -z has illegal argument `-Wl,allextract
    ld: fatal: option -z has illegal argument `-Wl,defaultextract
    ld: fatal: Flags processing errors
    

    To fix the problem:

    1. In the FreeTDS installation directory, open libtool with a text editor.

    2. Search for this line:

      whole_archive_flag_spec="\${wl}-z \${wl}allextract\$convenience \
      ${wl}-z \${wl}defaultextract"
      

      and replace it with:

      whole_archive_flag_spec="\${wl}-z allextract\$convenience \
      ${wl}-z defaultextract"
      
    3. Change to src, and run:

      make; make install
      

StepsConfiguring FreeTDS and unixODBC support

  1. Change to the FreeTDS etc subdirectory, open freetds.conf with a text editor, and add these lines:

    [MySybase]
    host=<ASE host> 
    port=5000 
    tds version=5.0
    

    where ASE host is the name of the machine where Adaptive Server Enterprise is installed.

    To test the connection to MySybase, change to the FreeTDS bin subdirectory, and run

    tsql
    
  2. Change to $DJC_HOME/unixodbc, and edit odbcinst.ini to define the ODBC driver:

    [SybaseASE]
    Description=Sybase ODBC
    Driver =EAServer/freetds/lib/libtdsodbc.so
    Setup =EAServer/freetds/lib/libtds.so
    FileUsage =1
    UsageCount =3
    

    where EAServer is the full path to the EAServer installation directory.

  3. Edit odbc.ini to define an ODBC data source:

    [testase]
    Driver =EAServer/freetds/lib/libtdsodbc.so
    Trace =yes
    Server =<ASE host>
    Port =5000
    Database =tempdb
    uid =sa
    

    where the value of Driver is the same as in odbcinst.ini, and ASE host is the name of the machine where Adaptive Server Enterprise is installed.

  4. Edit odbc.sh (Bash shell) or odbc.csh (C shell), and add $DJC_HOME/freetds/lib to the LD_LIBRARY_PATH.

  5. To test the connection, change to $DJC_HOME/unixodbc/bin, and run:

    ./isql -v “testase” <user name> <password>
    
  6. Change to $DJC_HOME, and edit local-setenv.sh to add:

    if [ "$LD_LIBRARY_PATH" = "" ]; then
    LD_LIBRARY_PATH=$DJC_HOME/freetds/lib
    else
    LD_LIBRARY_PATH=$DJC_HOME/freetds/lib:$LD_LIBRARY_PATH
    fi
    export LD_LIBRARY_PATH
    
  7. Start EAServer.