Using ODBC to connect to SQL Anywhere

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

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

    [SYBASA]
    Description = Sybase ASA10 ODBC Driver
    Driver = $DJC_HOME/ASA100/client/lib32/libdbodbc10_r.so
    Setup = $DJC_HOME/odbc/lib/libtdsS.so
    TDS_Version = 5.0
    UsageCount = 1
    CPTimeout =
    CPReuse = 
    
  2. Add ODBC data source information to $DJC_HOME/odbc/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 $DJC_HOME/odbc/bin, and use isql 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.