unixODBC and SQL Anywhere

To use unixODBC with a SQL Anywhere database, configure an ODBC data source.

StepsConfiguring ODBC for SQL Anywhere

  1. If EAServer is running, shut it down.

  2. Change to the EAServer bin directory, and start SQL Anywhere with the default.db database:

    ./asa-init.sh ../data/default.db
    ./asa-start.sh -x "tcpip{MyIP=127.0.0.1;
    Host=localhost;Port=2638;DoBroadcast=no;BroadcastListener=no}" 
    -n EAS_TEST_DB ../data/default.db
    
  3. Change to the EAServer odbc directory.

  4. On Solaris, source either odbc.sh (Bash shell) or odbc.csh (C shell).

    On Linux, source odbc.sh.

  5. Edit odbc.ini, and add these lines:

    [EAS_TEST_DB]
    Driver =SYBASA
    Trace =no
    TraceFile =sql.log
    Port =2638
    ServerName =EAS_TEST_DB
    TDS_Version =5.0
    

    NoteThe value of ServerName must match the value of the -n option in step 2.

    On Solaris, there must not be a space between “ServerName =” and the value.

  6. Change to odbc/bin, then use isql to verify that you can connect to the database:

    ./isql -v "EAS_TEST_DB" dba sql
    

    A successful connection displays the SQL> prompt.

  7. If this error message displays:

    ./isql: error while loading shared libraries:
    libreadline.so.4: cannot open shared object file: No such file or directory
    

    isql cannot find libreadline.so.4.

    To rectify the problem:

    1. Find libreadline.so.4 by running:

      whereis libreadline.so.4
      

      The output should look similar to:

      libreadline.so: /lib/libreadline.so.5
      
    2. Change to odbc/lib, and create a soft link to libreadline.so.4:

      ln -s /lib/libreadline.so.5 libreadline.so.4
      
    3. Change to odbc/bin, then use isql to verify that you can connect to the database:

      ./isql -v "EAS_TEST_DB" dba sql
      
  8. Start EAServer, then start the Management Console.

  9. In the Management Console, create a data source named “EAS_TEST_DB”:

    1. Expand the Resources folder, right-click Data Sources, and select Add.

    2. To test the connection, click Ping.