connect to SQL Anywhere 17

I've been successfully using SQLAPI++ to connect and execute SQL statements against Oracle 11.2.0.4 and PostgreSQL 9.6.3.
I've had no joy with SQL Anywhere 17 however.

The g++ command I use is:
1
2
$ export LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64:$LD_LIBRARY_PATH
$ g++ -g -Wall -std=c++14  -o sa_connect_test sa_connect_test.o /home/bluefrog/SQLAPI/lib/libsqlapi.a -L/usr/lib/x86_64-linux-gnu -lpthread -pthread -lboost_thread -DBOOST_THREAD_VERSION=4 -lboost_system -ldl -lpq

There are no compile or link errors.
Connection to PostgreSQL and execution of statements are successful
1
2
3
4
5
$ ~/bin/pgstart.sh 
$ ./pg_connect_test 
Row : x = 1, y = 'Fill'
Row : x = 2, y = 'Pop'
$ ~/bin/pgstop.sh 

The same code, apart from the connect string returns the same result on Oracle (the same table name and data exists on all 3 databases).

Connection to SQL Anywhere however returns the following runtime error:
1
2
3
4
5
6
7
8
9
10
$ ~/bin/sastart.sh 
$ ./sa_connect_test 
libdbcapi.so: cannot open shared object file: No such file or directory

DBMS API Library loading fails
This library is a part of DBMS client installation, not SQLAPI++
Make sure DBMS client is installed and
this required library is available for dynamic loading

$ ~/bin/sastop.sh 

Bu the file does exist:
1
2
$ ls -l /opt/sqlanywhere17/lib64/libdbcapi.so
lrwxrwxrwx 1 bluefrog bluefrog 14 Jul 12 11:48 /opt/sqlanywhere17/lib64/libdbcapi.so -> libdbcapi.so.1

and the LD_LIBRARY_PATH is set correctly
1
2
$ echo $LD_LIBRARY_PATH 
/opt/sqlanywhere17/lib64:/home/bluefrog/SQLAPI/lib

The test code looks as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include </home/bluefrog/SQLAPI/include/SQLAPI.h>

int main(int argc, char* argv[]) {
    SAConnection con;
    SACommand cmd(&con, "select x, y from test1");

    try {
//con.Connect("localhost,5432@ft_node", "bluefrog", "bluefrog", SA_PostgreSQL_Client);
//con.Connect("//localhost:1521/ftnode", "ordb", "ordb", SA_Oracle_Client);

      con.Connect("localhost,2638@ftnode_sa", "sadb", "sadb", SA_SQLAnywhere_Client);
      cmd.Execute();
      while(cmd.FetchNext())
        printf("Row : x = %ld, y = '%s'\n", cmd.Field("x").asLong(), (const char*)cmd.Field("y").asString());
    }
    catch(SAException &x) {
      try {
        con.Rollback();
      }
      catch(SAException &) { }
      printf("%s\n", (const char*)x.ErrText());
    }
    return 0;
};


I do not understand why the library file is not been found. Any suggestion ?
Topic archived. No new replies allowed.