on 2014 Mar 17 7:31 PM
I've written a JDBC application that connects to a ODBC DSN. The local Sybase 10 system DSN called TEST connects to a running Sybase database server using TCP. When tested the DSN connects to the remote server successfully
On the local system DBISQL -c "DSN=TEST;USERID=dba;password=password" also connects fine
But when I attempt to connect to the local DSN using JDBC code below I get error [Sybase][ODBC Driver][SQL Anywhere]Database server not found)
Class.forName("ianywhere.ml.jdbcodbc.IDriver"); con = DriverManager.getConnection("jdbc:odbc:Driver=SQL Anywhere 10;DSN=TEST;;uid=dba;pwd=password");
If I run the same code on the same PC as the Sybase DB server the jdbc code works fine.
Why can't JDBC connect to local DSNs that connect to remote sybase DB servers?
My guess is that you created the DSN for a specific bitness (i.e. either 32-bit or 64-bit) but the JAVA VM is a different bitness. Trying creating the DSN for both 32-bit and 64-bit binaries.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, it meets my experience and fits well to John's answer on your older question:
Please explain the ODBC Administrator situation in 64-bit Windows 7
Aside: I just stumbled over this again yesterday...:(
You can run this at the Command Prompt to check out my claim:
To list 64-bit System DSNs: reg query HKLM\\SOFTWARE\\ODBC\\ODBC.INI /s
To list 32-bit System DSNs: reg query HKLM\\SOFTWARE\\Wow6432Node\\ODBC\\ODBC.INI /s
To list User DSNs: reg query HKCU\\SOFTWARE\\ODBC\\ODBC.INI /s
HKLM is the LOCAL MACHINE hive.
HKCU is the CURRENT USER hive (this hive is bitness-agnostic).
Hence, there is no HKCU\\SOFTWARE\\Wow6432Node\\ODBC\\ODBC.INI.
Where things get really interesting is when you are developing 64-bit applications with Visual Studio. VS design-time is 32-bit (in the version that I use) and run-time is 64-bit. So if you are doing something at design-time that requires the System DSN, then you had better make sure that you have the 32-bit DSN.
If the jvm is 32bit, use windowsSysWOW64odbcad32.exe to set up the 32-bit SYSTEM DSN. Otherwise just create default 64bit SYSTEM DSN.
After create it, please try to test the connection in the odbc manager.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have your tried using the iAnywhere JDBC driver. Try something like this ...
// Open the connection. May throw a SQLException. DriverManager.registerDriver( (Driver) Class.forName( "ianywhere.ml.jdbcodbc.jdbc3.IDriver").newInstance() ); Connection con = DriverManager.getConnection( "jdbc:ianywhere:DSN=test" );
If this doesn't work, go to the ODBC administrator and try the Test Connection button for your DSN. If the connection fails, then you haven't set up your DSN correctly.
Ref: http://dcx.sybase.com/index.html#1001/en/dbpgen10/pg-jdbc-s-3454968.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.