Hi all, Using SA12 I've noticed two jdbc4 drivers:
What's the difference (I've only tried jodbc4.jar) ? Thanks. |
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: |
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. 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 ...
$ 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
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.
I already call '/bin64/sa_config.sh' script in my .bashrc ...
$ 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 ...
$ 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:
WORKS FINE. What about ? No one uses Java 64-bit software on Linux ? 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
|