cancel
Showing results for 
Search instead for 
Did you mean: 

Java app fails to connect to SA

3,657

Hi,
We have a problem with a third party Java application (we don't have the source) which tries to connect to our SQL Anywhere database using such connect string:

jdbc:ianywhere:ENG=demo;DBN=demo;UID=uid;PWD=pwd;LINKS=TCPIP;CON=conn name;DRIVER=SQL Anywhere 11;LOG=db.log
We have never had such a problem with that application before (it worked for some years before with ASA9, SA10, SA11, SA12). I'm not sure if that could be the reason but last weekend we had a loss of power so all machines were down. But after restart everything works fine except that application. I've put a LOG parameter in connect string but db.log file was not generated. The log of that application shows:
Could not initialize class ianywhere.ml.jdbcodbc.jdbc3.IDriver
I tried to copy that application to another machine - it DOES connect successfully. So I tried to look for differences in environment variables (both machines run Windows OS) but nothing suspicious was found. What else should be checked? Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

jeff_albion
Product and Topic Expert
Product and Topic Expert
Could not initialize class ianywhere.ml.jdbcodbc.jdbc3.IDriver

This message could either be related to:

A reminder that if you're using a 64-bit Java Virtual Machine (JVM), you need to deploy the 64-bit 'dbjdbc##.dll' file, and if you're using the 32-bit JVM, the 32-bit 'dbjdbc##.dll' file.

0 Kudos

Well, dbjdbc11.dll exists in C:\\Program Files\\SQL Anywhere 12\\Bin32. And this directory is included in the PATH environment variable in both machines. The jdbc3.jar file does not exist in any of these 2 machines. More ideas?

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos

Sorry, that was my mistake - the filenames in my original response were incorrect. Let me try a new response again and edit my original response...

I meant to say you need the files "jodbc.jar" (not "jdbc3.jar") and "dbjodbc11.dll" (not "dbjdbc11.dll") in your installation.

See: http://dcx.sybase.com/index.html#1101/en/dbprogramming_en11/pg-jdbc-sectb-3838486.html


The jdbc3.jar file does not exist in any of these 2 machines.

Does "jodbc.jar" exist and is it in your CLASSPATH for your Java application?

dbjdbc11.dll exists in C:\\Program Files\\SQL Anywhere 12\\Bin32

Does dbjodbc11.dll also exist?

Can you confirm if you are launching a 32-bit JVM for your application? (e.g. What does 'java -version' report:)

  • Java HotSpot(TM) Client VM
  • Java HotSpot(TM) Server VM
  • Java HotSpot(TM) 64-bit Server VM
0 Kudos

jodbc.jar exists in both machines in all SQL Anywhere directories (9,10, 11, 12) and in IQ directory in the "faulty" machine. CLASSPATH environment variable does not exist in any of these machines.

dbjodbc11.dll also exists in both machines.

'java -version' returns the same results in both machines:

java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode, sharing)

Former Member
0 Kudos

Since IQ includes SQL Anywhere 11, there can sometimes be conflicts when both are installed. Just a thought...

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos

and in IQ directory in the "faulty" machine.

Is there a 'dbjodbc11.dll' also in the IQ directory? Is the IQ directory included in the PATH? Does the IQ directory appear before or after the SQL Anywhere directory in the PATH?

0 Kudos

Yes, dbjodbc11.dll exists in IQ directory too. IQ directory was the first in the PATH.
I tried to remove IQ directory from the PATH (and rebooted after that) but it did not help.

VolkerBarth
Contributor
0 Kudos

As the PATH variable can have both system-specific and user-specific settings: Could this play a role in your case?

And note that environment variables can be set differently for different processes...

0 Kudos

I've found jodbc.jar file in one of that mystical application's directories too. So I copied the newer version of that file from SQL Anywhere 12 directory - it works. 🙂

Answers (0)