Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have an eclipse project.
If I try to start it from eclipse, it fails returnong No suitable driver found for jdbc.db2.dbname.
If I try to start it from command line, it runs well.

I tried to search for unloaded class by the verbose command.
This is when I start from command line:
JVM in esecuzione:

C:\jdk1.6.0\JAVA\bin\java
java version "1.6.0"
Java(TM) SE Runtime Environment (build pwi3260sr2-20080818_01(SR2))
IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Windows Vista x86-32 jvmwi3260-20080816_22093 (JIT enabled, AOT enabled)

[...]
class load: ObRun.ObDatabase.ObDatabaseMgr from: file:/C:/finance/610/ObRun.jar
class load: java/sql/Wrapper
class load: java/sql/Statement
class load: java/sql/Driver
class load: COM.ibm.db2.jdbc.app.DB2Driver from: file:/C:/IBM/SQLLIB/java/db2java.zip
class load: java/lang/UnsatisfiedLinkError
class load: java/sql/Connection
class load: COM.ibm.db2.jdbc.app.DB2Driver$1 from: file:/C:/IBM/SQLLIB/java/db2java.zip
class load: java/net/URLDecoder
class load: java/net/URLEncoder
class load: COM.ibm.db2.jdbc.app.DB2Driver$3 from: file:/C:/IBM/SQLLIB/java/db2java.zip
class load: COM.ibm.db2.jdbc.app.DB2Statement from: file:/C:/IBM/SQLLIB/java/db2java.zip
class load: java/sql/PreparedStatement


This is when I start from Eclipse:
[...]
[Loaded ObRun.ObDatabase.ObDatabaseMgr from file:/C:/finance/610/ObRun.jar]
[Loaded java.sql.Wrapper from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded java.sql.DatabaseMetaData from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded java.sql.Statement from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded java.sql.Driver from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded COM.ibm.db2.jdbc.app.DB2Driver from file:/C:/IBM/SQLLIB/java/db2java.zip]
[Loaded java.sql.Connection from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded java.lang.UnsatisfiedLinkError from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded COM.ibm.db2.jdbc.app.DB2Driver$1 from file:/C:/IBM/SQLLIB/java/db2java.zip]
[Loaded java.net.URLDecoder from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded java.net.URLEncoder from K:\Programmi\jdk1.6.0\jre\lib\rt.jar]
[Loaded COM.ibm.db2.jdbc.app.DB2Driver$3 from file:/C:/IBM/SQLLIB/java/db2java.zip]
[Loaded COM.ibm.db2.mri.DB2Messages from file:/C:/IBM/SQLLIB/java/db2java.zip]
[Loaded COM.ibm.db2.mri.DB2ErrorMessages from file:/C:/IBM/SQLLIB/java/db2java.zip]
[...]
java.sql.SQLException: No suitable driver found for jdbc:db2:MyDBName
	at java.sql.DriverManager.getConnection(DriverManager.java:602)


What I have tried:

I tried also to set a newer jre in eclipse (1.8.0.65).
I tried also to enter into decompiled class to see what's appening.
It seems that the java.sql.DriverManager class isn't able to search for the available drivers.
Posted
Updated 25-May-16 22:43pm

Have you tried to search the web? The answer is pretty easy to find.

IBM Knowledge Center[^]

https://www-304.ibm.com/support/docview.wss?uid=swg21432559[^]


Good luck!
 
Share this answer
 
Comments
Menci Lucio 27-Jun-16 12:53pm    
Hi,
It's possible that Crystal Report 8 crashes when I try to connect to DB2 for the same reason?
Maybe (I'm not sure about it) that when the Legacy Type 2 driver stopped to connect to my db2 engine, Crystal report 8 stopped to connect too.

I'm not sure because I use a newer Crystal Report, but I have a customer that needs to use the old one and I have to edit an its report...

How can I re-estabilish the prior conditions?
E.F. Nijboer 29-Jun-16 18:11pm    
Might indeed be the case but sadly unable to confirm. You should be able to download the deprecated database driver from one of the links anyway and give it a go. Maybe worth a try.
Menci Lucio 30-Jun-16 4:14am    
FOUND!!!! Damn'it!!!! Some strange update (I think Skype) drop the IBM\SQLLIB\BIN path from the path environment variable!!!! I still having some problems with Crystal report, but MAYBE the cause that Crystal report doesn't run are differents. Now the Legacy type 2 run wells.

My machine is for a battle use, I know that it was better if there would be a server for db, but I have to use it in this way...
Hi,

Thank you for your answer.

I already read your second link. I was constrained to use the Legacy Type 2 driver because it was not parametrized in a non my java class:
Java
public String getDriverName()
{
    return "COM.ibm.db2.jdbc.app.DB2Driver";
}


I continuing to don't know why, for years, this approach was runned well, and yesterday stopped (note that all four points of Resolving problems paragraph are validated).
The title of the first link convinced me to stop lost time and pass to Universal and Data Server driver for JDBC overwriting that class.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900