Hello,

I cannot get sajdbc4 to work under Linux when trying to connect to a High Availability server system. I have successfully configured it for use with WildFly under Windows but when I try to recreate this same setup under Ubuntu 16.0.4 I get the following error as soon as I try to establish a connection to SQL Anywhere 17:

java.sql.SQLException: Invalid ODBC handle

java -XshowSettings:properties

shows:

java.library.path = /usr/java/packages/lib/amd64
        /usr/lib64
        /lib64
        /lib
        /usr/lib

I have placed in /lib64 the following files and created symbolic links as described in the documentation:

drwxr-xr-x  2 root   root   4.0K Apr  9 23:35 .
drwxr-xr-x 23 root   root   4.0K Apr  8 18:07 ..
lrwxrwxrwx  1 root   root     32 Jan 15 02:51 ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.23.so
lrwxrwxrwx  1 root   root     17 Apr  9 23:33 libdbicu17_r.so -> libdbicu17_r.so.1
-rwxrwxrwx  1 wizard wizard 1.7M Apr  9 22:03 libdbicu17_r.so.1
lrwxrwxrwx  1 root   root     17 Apr  9 23:33 libdbicudt17.so -> libdbicudt17.so.1
-rwxrwxrwx  1 wizard wizard 4.1M Apr  9 22:03 libdbicudt17.so.1
lrwxrwxrwx  1 root   root     16 Apr  9 23:34 libdbjdbc17.so -> libdbjdbc17.so.1
-rwxrwxrwx  1 wizard wizard 2.7M Apr  9 22:03 libdbjdbc17.so.1
lrwxrwxrwx  1 root   root     17 Apr  9 23:34 libdbrsa17_r.so -> libdbrsa17_r.so.1
-rwxrwxrwx  1 wizard wizard 2.3M Apr  9 22:03 libdbrsa17_r.so.1
lrwxrwxrwx  1 root   root     19 Apr  9 23:35 libdbtasks17_r.so -> libdbtasks17_r.so.1
-rwxrwxrwx  1 wizard wizard 180K Apr  9 22:03 libdbtasks17_r.so.1

My Connection String looks like:

jdbc:sqlanywhere:Host=[IPAddress]:[Port];DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;ServerName=[AlternateServerName]

Can someone help me understand what is wrong so I can use sajdbc4 under Linux?

Thank you.

asked 09 Apr, 20:06

AlK's gravatar image

AlK
550172641
accept rate: 33%

Here is an example of the connection string:

jdbc:sqlanywhere:UID=DBA;PWD=sql;SERVER=mirror_demo_primary

I am not familiar with the DB_CLOSE* options in the context of HA.

Lets start with the basic connection string.

(09 Apr, 20:28) Chris Keating
Replies hidden
1

Invalid ODBC handle

Note that this error might also be related to a missing PATH entry for the native components, cf. that older question, particularly Jeff's answer.

(10 Apr, 04:04) Volker Barth
Replies hidden

Try removing DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;

They have nothing to do with SQL Anywhere.

(10 Apr, 07:15) Breck Carter
Replies hidden

jdbc:sqlanywhere:Host=[IPAddress]:[Port];

Note that you usually have to specify two host names when using HA to be able to reach any of both partners...

(10 Apr, 07:31) Volker Barth
Replies hidden

Hi Chris,

I tried again with the exact format you provide and still get "Invalid ODBC handle". But I have a question. In a response to an earlier question you said that ServerName (instead of Server) should be used for connection to a High Availability server. Please elaborate on this. Thanks.

(10 Apr, 17:21) AlK

Hi Volker,

Thanks but I had tried that initially. When it failed I "simplified" it to the single host name and that's what I posted. I should have mentioned I tried it the other way as well. Any other ideas?

(10 Apr, 17:23) AlK

Hi Breck,

I moved your response so I could Reply. I tried again without them but still get the "Invalid ODBC handle". I have used these two parameters for years with the jConnect driver with no issues - I thought they we legitimate. Are you familiar with them/do you know what they are? Thanks.

(10 Apr, 17:26) AlK

HI Volker, When you say PATH do you mean Library Path or executable Path? In my original post I showed why I think that all five of the .so files are on the Library Path. However, The link you supplied (thanks) mentions that the problem is related to the language file. I don't have any such dblg[xx]17 in my SQL Anywhere 17 binary directory.

(10 Apr, 17:44) AlK

Hi Chris,

An additional question. Volker below provide a link that described this problem as being caused by a missing dblg[xx] file. My SQL Anywhere 17 installation's /lib64 (where I found the other five support files) doesn't contain a language file. Is this perhaps the problem? Thanks.

(10 Apr, 17:48) AlK

you said that ServerName (instead of Server) should be used for connection to a High Availability server

I don't see that earlier question but ServerName and Server are synonyms for the according connection parameter, so that should make no difference.


I guess Chris has pointed out to use the "Alternate server name" as value for the ServerName/Server connection parameter in contrast to the "regular server name".

Cf. that tutorial:

For a HA connection, you would use the alternate server name "...ServerName=mirror_demo_primary;..." instead of the regular server name "...ServerName=mirror_server1;...".

(11 Apr, 03:18) Volker Barth

I moved your response so I could Reply.

FWIW, you can also reply to an answer - there's an "add new comment" button right beneath each question and answer - to be precise: right beneath the last comment on each question and answer...:)

(11 Apr, 03:35) Volker Barth

I am also still not able to get the database connection with the native sajdbc4.jar to work. I got the same error messages as you do.

I asked in the following thread the similar question:

https://sqlanywhere-forum.sap.com/questions/16414/jdbc-driver-for-oracle-data-modeler

(11 Apr, 10:49) robert
Replies hidden

Hm, I had the impression that FAQ (at least the latest state) was primarily dealing with Mac OS X behaviour changes, which should not apply to AIK's Linux platform ...?

(11 Apr, 10:58) Volker Barth
showing 5 of 13 show all flat view

Hi Volker,

Well, it was the language file. Under a Linux installation of SQL Anywhere 17 the language files are not found along with the .so files and a web posting I saw (somewhere else) suggested that this was optional under Linux! That caused me to not proactively go looking for the language files. But since I had exhausted all other known possibilities I went looking, found them and adding one fixed the problem. I note that Sybase/SAP failed to improve the error message as was suggested might be done in the link you supplied.

Also, I don't know how to convert your reply to the answer! If you can explain how I'll do so!

permanent link

answered 12 Apr, 13:23

AlK's gravatar image

AlK
550172641
accept rate: 33%

converted 12 Apr, 13:23

I don't run SA on Linux, so I can only guess. According to the docs:

  1. Environment variables must be set accordingly, including PATH.

  2. JDBC does expect a language file, named dblg[LL]17.res.

I wasn't aware of that but v17 has introduced the Deployment Wizard for Linux/Unix and MAC OS X, so you might give that a try. - For client installs, I have often used the same tool on Windows, and it makes sure the required files and configurations are setup as expected.

permanent link

answered 11 Apr, 03:24

Volker%20Barth's gravatar image

Volker Barth
32.0k326468687
accept rate: 32%

converted 12 Apr, 14:54

Justin%20Willey's gravatar image

Justin Willey
7.0k120153223

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×73
×15

question asked: 09 Apr, 20:06

question was seen: 82 times

last updated: 12 Apr, 13:23