cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Anywhere 17 client odbc connection from linux

Former Member
0 Kudos
9,809

Hi,

We are trying to establish SQL Anywhere 17 client connection to SQL Anywhere database using ODBC driver on Linux 64 machine. We have installed driver from https://wiki.scn.sap.com/wiki/display/SQLANY/SAP+SQL+Anywhere+Database+Client+Download

Below is the odbc.ini entry [xxxxxxxx] Driver=/sas/sqlanywhere17/install/lib64/libdbodbc17.so Description=SQL Anywhere 17 Host=xxxxxxxxxxxx Userid=xxxxxx DatabaseName=xxxxx Port=50094 Password=xxxxxx

Below is the odbcinst.ini entry [SQL Anywhere 17] Driver=/sas/sqlanywhere17/install/lib64/libdbodbc17.so Setup=/sas/sqlanywhere17/install/lib64/libdbodbc17.so

And below are the environment variables that are being set.

ODBCHOME=/etc ODBCINI=/etc/odbc.ini ODBCINST=/etc/odbcinst.ini LD_LIBRARY_PATH=/sas/sqlanywhere17/install/lib64/

When we run isql or dbisql to connect to this DSN we get below error.

[sasinst@compute1p 9.4]$ isql -v Ticketmaster xxxxxxx xxxxxxx [08001][unixODBC][SAP][ODBC Driver][SQL Anywhere]Database server not found [ISQL]ERROR: Could not SQLConnect

We get the same error in dbisql.

But the same connection works for the windows driver. However there are 2 parameters in windows which are not in unix. 1. Authentication type "Database" 2. Action "Connect to a running server in the cloud"

We believe as we are not able to provide these parameter the connection cannot find the Database server and errors out.

Could you please help us in providing the parameters to make connection in Linux. Or do we need to add anything else.

Regards, Sid

Accepted Solutions (1)

Accepted Solutions (1)

chris_keating
Product and Topic Expert
Product and Topic Expert

If you have a working DSN on Windows, you can copy the settings from the Windows Registry into the Unix DSN. The infomation can be found in one of the following locations (where <dsn> is the Windows DSN Name)

HKLM\\SOFTWARE\\ODBC\\ODBC.INI\\<dsn> (a SYSTEM DSN) HKCU\\SOFTWARE\\ODBC\\ODBC.INI\\<dsn> (a USER DSN)

For a SA ODBC Cloud based DSN (which is SQL Anywhere On Demand Edition or SAODE), you do not specify server name but HOST is of the form that I have described previously i.e., host=MyHost:50094. You have PORT as a separate connection parameter which is incorrect.

Former Member
0 Kudos

Thanks Chris. It works with host=MyHost:50094.

Answers (1)

Answers (1)

chris_keating
Product and Topic Expert
Product and Topic Expert
0 Kudos

It appears that the ODBC environment is properly setup but the DSN (or connection string) is not correct. This is what I would expect to see in the DSN.

DatabaseName       MyDBName
Driver             /sas/sqlanywhere17/install/lib64/libdbodbc17.so
Host               MyHost:50094
ServerName         MyDBEngName

The database server would be started on a machine named MyHost with a start line like:

dbsrv17 -n MyDBEngName -x tcpip(port=50094) database.db -n MyDBName

If the database is hosted on dbeng17, connections can only be made on MyHost (as it is a local server).

If you continue to have problems, it would be helpful to add LogFile=<filespec> to the DSN which creates a debug log for the connection on the client and add -z option on the engine to enable connection debugging on the server.

Former Member
0 Kudos

I want to connect to a SQL Anywhere database already running in the cloud. Will I need to use ServerName and do I need to start on a machine. That is the option I give in my Windows ODBC connection and it works.

chris_keating
Product and Topic Expert
Product and Topic Expert
0 Kudos

The HOST= is incorrect. It should be HOST=<host>:<port>. You are specifying PORT separately and the correct syntax for that would be like:

CommLinks=TCPIP{IP=<host>;ServerPort=<port>}

Without knowing how the database engine was started, I am not able to tell you what the ServerName value should be. Since you are able connect on Windows, you can query its value:

select property('ServerName')

When you say you are running in the cloud, what specifically do you mean?

Former Member
0 Kudos

Thanks Chris.

Basically to connect Windows ODBC driver I follow the steps mentioned in this link.

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.sqlanywhere.12.0.1/dbadmin/da-dbc...

I don't know much about the database setup. But as I don't need ServerName to connect to it from Windows I would assume I wuld not need that for unix too. I am not able to to find equivalent steps (mentioned in the link) for unix.