cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Anywhere 16 ODBC Setup Linux

Former Member
6,852

Is there any documentation on the configuration of the SAP/Sybase ODBC Manager under Linux, the only documentation I found says it exists and the install places entries in the {home}/.odbc.ini file? Is there an odbcinst.ini file somewhere and/or an odbc.ini for system wide instead of user based entries? What does one need to tell other non-SAP/Sybase applications that the system is using the SAP/Sybase ODBC manager (like wine for example)?

Another alternative -- The documentation says that unixODBC >= 2.2.14 can be used as the ODBC manager. Does anyone know how SAP/ Sybase applications are told unixODBC and not the default SAP/Sybase is the ODBC manager for this system? (What is the recommended contents of odbcint.ini for SQL Anywhere 16, if not identified above?)

Former Member
0 Kudos

I was better at finding documentation this morning:

Wine ODBC Environment Variable LIB_ODBC_DRIVER_MANAGER

SAP/Sybase ODBC Manager libdbodb16.so which can be found as a link in both /opt/sqlanywhere16/lib{32&64}/

I am going to try using the SAP/Sybase ODBC Manager for now with the Unix ENVIRONMENT variable for Wine and see what happens. I still need to figure which one I use to open 32bit clients from Wine. My first try will be the lib64 manager with the ini file specifying the bin64 start and the lib32 ODBC driver.

Sybase uses the following environment variables ODBCHOME, HOME and either ODBC_INI or ODBCINI

ODBCHOME is used to specify the location of the system .odbc.ini file HOME is used to specify the location of the user .odbc.ini file

ODBCINI and ODBC_INI can be used with full paths when the odbc.ini file is not named .odbc.ini

Former Member
0 Kudos

I could never get this to work with wine and adopted another approach.

Accepted Solutions (0)

Answers (1)

Answers (1)

jeff_albion
Advisor
Advisor

Does anyone know how SAP/ Sybase applications are told unixODBC and not the default SAP/Sybase is the ODBC manager for this system?

Let's start with general ODBC linking on Linux:

When you compile/link your generic ODBC program on Linux, you will typically specify -lodbc to link to the generic ODBC libraries - this then tells the linker (ld) to include whichever libodbc.so from the LD_LIBRARY_PATH environment variable that appears first, at run time when your program is run. A unixODBC installation includes libodbc.so, which triggers the loading of the actual unixODBC driver manager and related drivers / sources from the unixODBC installation (libodbcinst.so, etc.). The unixODBC libodbcinst.so then does the actual reading of ODBCHOME, HOME, ODBC_INI, etc. to find its information (Reading .odbc.ini, etc.).

( Sidenote: if you didn't want to use unixODBC as a driver manager, and instead picked yet another third-party ODBC driver manager like iODBC, whichever libodbc.so appears first in LD_LIBRARY_PATH will be the ODBC driver manager used for your program. )

What does one need to tell other non-SAP/Sybase applications that the system is using the SAP/Sybase ODBC manager (like wine for example)?

The SQL Anywhere ODBC Driver for Unix is the shared library libdbodm16.so (found in /lib32 or /lib64), so in order to reference this library as the primary ODBC driver manager, linking to -ldbodm16 at compile/link time would specify this for your program. If you (or your third-party program) already have linked against -lodbc, then you would need to create a symbolic link from libodbc.so to our driver manager file:

 ln -s $SQLANY16/lib64/libodbc.so $SQLANY16/lib64/libdbodm16.so

and ensure that the lib64 (or lib32) path then appears first in LD_LIBARY_PATH when you load your program (which would happen if you always source the sa_config.(c)sh script, for instance).

You could also link directly against our ODBC driver file by specifying -ldbodbc16 in your linker options, skip the driver manager, and just provide the connection string information in a SQLDriverConnect call.


I could never get this to work with wine and adopted another approach.

According to the unixODBC page regarding the topic of interfacing with Wine, Wine is linking against a natively running ODBC.DLL, which should be linked against -lodbc in the Linux environment, as most ODBC programs are usually linked. I would guess that the environment variable LIB_ODBC_DRIVER_MANAGER should point to a location with a linkable libodbc.so shared object - if you create the libodbc.so symbolic link as I mentioned above and then provide the path to $SQLANY16/lib64 to LIB_ODBC_DRIVER_MANAGER, Wine should be able to call out to our driver manager (although actual compatibility of the ODBC programs involved may still be incompatible - you would need to test this configuration).