cancel
Showing results for 
Search instead for 
Did you mean: 

SA12 jdbc driver

6,410

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.

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

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 ?

jeff_albion
Product and Topic Expert
Product and Topic Expert

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".

0 Kudos

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 ...

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos
  • 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?

0 Kudos

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.

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos

"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?

0 Kudos

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.

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

VolkerBarth
Contributor
0 Kudos

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: