Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi all, Using SA12 I've noticed two jdbc4 drivers:

  • sajdbc4.jar
  • jodbc4.jar

What's the difference (I've only tried jodbc4.jar) ? Thanks.

asked 16 Apr '12, 07:00

NCister's gravatar image

NCister
211111219
accept rate: 0%

edited 18 Apr '12, 08:06

Volker%20Barth's gravatar image

Volker Barth
40.2k361550822


The following FAQ may clarify the issue:

What is the recommended JDBC driver for SQL Anywhere 11.0.1

It deals with 11.0.1 but the same seems correct for v12 (other than the Xyz4.jar drivers support JDBC 4.0).

Here's a further link to an SQL Anywhere blog article from Jason Hinsperger:

permanent link

answered 16 Apr '12, 07:07

Volker%20Barth's gravatar image

Volker Barth
40.2k361550822
accept rate: 34%

Comment Text Removed

Hi, I'm trying sajdbc4.jar on Linux with a very simple code launched by Eclipse IDE:

DriverManager.getConnection("jdbc:sqlanywhere:uid=xxx; pwd=xxx; eng=asa12dev; links=tcpip");

... but the following error occours:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/sqlanywhere12/lib64/libdbjdbc12.so.1: libdbtasks12_r.so: cannot open shared object file: No such file or directory

I've just added all required references to library path (/opt/sqlanywhere/lib64) .... and "libdbtasks12" library is included in that path !!

Any idea ? Thanks.

permanent link

answered 16 Apr '12, 12:42

NCister's gravatar image

NCister
211111219
accept rate: 0%

Which (bitness) version of the Java JRE are you launching? Is it 32-bit or 64-bit?

(16 Apr '12, 13:38) Jeff Albion

Hi Jeff, and thanks for replay ...

  • Which (bitness) version of the Java JRE are you launching? Is it 32-bit or 64-bit?

$ java -version java version "1.6.0_27" Java(TM) SE Runtime Environment (build 1.6.0_27-b07) Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

$ uname -a Linux XDev91 2.6.32-24-generic #39-Ubuntu SMP Wed Jul 28 05:14:15 UTC 2010 x86_64 GNU/Linux

  • Check your Eclipse launch configuration - it's likely that it's not taking into the local environment's library path You may need to define a "-Djava.library.path" variable for Eclipse to pick this up.

You're right (... it's not taking into the local environment's library path ...), because in a production scenario all works fine .... but I've already set -Djava.library.path="/opt/sqlanywhere12/lib64" in the "Argument" tab of my Debug configuration. I've also tried to set "Native library location" in the sajdbc4.jar section managed by Java Build Path.

  • Check your "LD_LIBRARY_PATH" environment variable (which should be done by sourcing '/bin64/sa_config.sh'). This should include the "/sqlanywhere/lib64" directory. This should load as the "java.library.path" variable inside your program.

I already call '/bin64/sa_config.sh' script in my .bashrc ...

  • Check the "ldd" output against 'libdbjdbc12.so.1' - see if there are any obvious linking/permission errors.

$ ldd ./libdbjdbc12.so.1 linux-vdso.so.1 => (0x00007fff0db12000) libdbtasks12_r.so => not found libpthread.so.0 => /lib/libpthread.so.0 (0x00007f8056be3000) libdl.so.2 => /lib/libdl.so.2 (0x00007f80569de000) libm.so.6 => /lib/libm.so.6 (0x00007f805675b000) libc.so.6 => /lib/libc.so.6 (0x00007f80563d8000) /lib64/ld-linux-x86-64.so.2 (0x00007f805727a000)

But libdbtasks12_r.so is in /opt/sqlanywhere12/lib64 !!!!

$ ldconfig -v | grep libdbtasks /sbin/ldconfig.real: Can't stat /lib/x86_64-linux-gnu: No such file or directory

... Boh :-( ... I'm confused ...

permanent link

answered 17 Apr '12, 08:21

NCister's gravatar image

NCister
211111219
accept rate: 0%

edited 17 Apr '12, 08:44

  • Check the "ldd" output against 'libdbjdbc12.so.1' - see if there are any obvious linking/permission errors.


$ ldd ./libdbjdbc12.so.1
linux-vdso.so.1 => (0x00007fff0db12000)
libdbtasks12_r.so => not found
...

This certainly seems to be a permissions/access issue. Can you "echo $LD_LIBRARY_PATH" to verify that "/opt/sqlanywhere12/lib64" is listed in this output? Can you verify the file system permissions on the file from the user you're starting the java executable with?

(17 Apr '12, 14:59) Jeff Albion
Replies hidden

System permissions and $LD_LIBRARY_PATH ar correct. The problem is the combination: Eclipse + Linux 64bit + SA driver. On the same host, out of Eclipse (production scenario), all works fine. Now I'm trying 32bit environment.

(18 Apr '12, 07:18) NCister

"ldd" is a pretty low-level library-resolution utility and solely relies on "LD_LIBRARY_PATH" to resolve the associated libraries. This command should not fail to find referenced libraries.

My ldd reference is okay from a default SQL Anywhere 12 install after sourcing the appropriate environment script:

===============================

 jalbion@localhost ~ $ . /opt/sqlanywhere12/bin64/sa_config.sh
 iAnywhere Solutions, Inc. One Sybase Drive, Dublin, CA 94568, USA
 Copyright (c) 2001-2011, iAnywhere Solutions, Inc. Portions copyright (c) 
 1988-2011, Sybase, Inc. All rights reserved. All unpublished rights reserved.

 jalbion@localhost ~ $ cd /opt/sqlanywhere12/lib64
 jalbion@localhost /opt/sqlanywhere12/lib64 $ ldd ./libdbjdbc12.so.1
linux-vdso.so.1 =>  (0x00007fff365ff000)
libdbtasks12_r.so => /opt/sqlanywhere12/lib64/libdbtasks12_r.so (0x00007f320a55a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f320a329000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f320a125000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3209ea1000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3209b01000)
/lib64/ld-linux-x86-64.so.2 (0x00007f320abe5000)

===============================

Can you run "file" on the libdbjdbc12.so / libdbtasks12.so file in your LD_LIBRARY_PATH and show that it's the appropriate bitness? What does "dbversion" report for the library file?

(19 Apr '12, 13:16) Jeff Albion

I've just completed some tests in a 32bit scenario (on the same previous 64bit OS): The following combo:

  • Eclipse 32bit (JBoss Developer Studio)
  • JRE 32bit
  • bin32/sa_config.sh

WORKS FINE. What about ? No one uses Java 64-bit software on Linux ?

permanent link

answered 18 Apr '12, 07:56

NCister's gravatar image

NCister
211111219
accept rate: 0%

1

The problem is the combination: Eclipse [64-bit] + Linux 64bit + SA driver. On the same host, out of Eclipse (production scenario), all works fine.

Eclipse 32bit (JBoss Developer Studio), JRE 32bit, bin32/sa_config.sh, works fine


I can only see between your "working and "not working" cases is the difference between the launching it with a 64-bit Eclipse IDE versus a 32-bit Eclipse IDE. Is that correct? And that the 64-bit version is otherwise working when not being launched from Eclipse?

If so, you may be better to ask this question in a specific Eclipse forum asking about "How to set the native library path when deploying/testing your application".

(19 Apr '12, 13:20) Jeff Albion
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:

×438
×145
×86
×68
×36

question asked: 16 Apr '12, 07:00

question was seen: 6,044 times

last updated: 19 Apr '12, 13:21