I have installed a new instance of SQL Anywhere on Windows 7-64 (Developer version, 12.1.3457) and am trying to connect a remote Quantum DB (also Windows 7-64) under Eclipse using the new sajdbc4.jar. I am getting a hang whenever I try and connect. At first I was getting an error that dbjdbc12.dll could not be found in the system path, so I copied dbjdbc12.dll directly to my Windows/System32 folder.
Now whenever I try and establish the connection, it just hangs, Eclipse crashes. The only thing I can think of is that there seems to be some problem loading the dll. I have tried regsvr32 on the dll, no effect. Rebooted the machine, no difference, etc. etc. I have tried using the following connection URLs:
...and several other variations of the above. No luck with any of it.
I have confirmed the server is actually listening, as I am able to use the jConnect jconn3 driver to establish the connection, but so far have had no luck whatsoever in getting the connection even "out of the box" using the sajdbc4 connection method, which I really would like to use.
Note, I also tried running Dependency Walker on the dll and came up with a dependency not found for IEShim.dll, which I located and also placed in the system path, no help there either.
Anyone out there have any experience with this or can give me any clues where I might be going wrong? In the end, we have a java application that makes connections to various different RDBMS targets, and would like to use a different driver for ASE and SQL Anywhere for the connections, so I really do not want to go back to using jconn3 or jconn4 for the connections.
Oh, for more info, I am using Java 1.6 update 20 (and have tried other update versions as well with no difference).
Thanks in advance!
After some playing with the DLL files, I have now figured this situation out... not on my production laptop. :)
The reason both yourself and Jonathan are seeing the "Invalid ODBC Handle" message in the 'deployed' JDBC scenario is because while the JDBC JAR driver can find the 'dbjdbc12.dll' native library in the path, the native driver cannot locate the additional support DLLs that go along with this file, that are mentioned in the documentation. Specifically, the
It should be mentioned that if you are looking at these DLLs in a tool like 'Dependency Walker', you won't see the explicit static links to notice that these are required - they are dynamically loaded at runtime.
Once all native libraries were present, I was able to connect to servers without issue, on the latest JDBC build - I didn't go back and try earlier versions, but I assume all of these situations were just improper deployments of the native DLLs.
I will see if we can improve the error message we throw in this instance to make it more obvious that we are missing the language file DLL rather than 'Invalid ODBC Handle'. Thank you for the bug report.
The latest release of SQLAnywhere - 126.96.36.19953 - contains a bug in the native code for the type-2 JDBC driver (sajdbc4.jar). The bug appears to be a native code linking problem. I get the same message: "Invalid ODBC handle" whenever I try to run an application from inside Eclipse. It's also new to this patch - as it just started happening right after I installed it.
I've attempted to trace the problem down, and it appears to be a problem where a 64 bit binary is linked to a 32 bit binary. I'm not certain that's the problem, though, as it seems to work fine from the command line. If I find anything more, I'll post it here.
Two potential workarounds. First, you can run the code from the command line. If you load the proper lib64 & lib32 directories in to your PATH, or run the sa_config.sh (from UNIX/Mac), you can run an executable Java or JAR file from the command line. Second, you can use an older sajdbc4.jar file and lib64 directory from a previous release. Just put them in a separate place, and point to them separately. I'm using both workarounds successfully from my machine.
answered 03 Apr '13, 20:08