| Author |
Unable to Load the Driver!
|
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
|
|
Hi Everyone,
I am getting this error when i am loading the JDBC class driver code. The funny thing is the code was taken from a working JDBC code written compiled and run successfully. But now its throwing an error:
|
 |
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
|
|
The code that throws the error is:
|
 |
Sebastian Janisch
Ranch Hand
Joined: Feb 23, 2009
Posts: 1183
|
|
You should not use newInstance. You simply load the class once using Class.forName () so the static block runs doing whatever it is doing.
You obtain a Connection using the DriverManager.
|
JDBCSupport - An easy to use, light-weight JDBC framework -
|
 |
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
|
|
|
Even without newInstance() method its throwing the error. I first coded without it, then as it was throwing the error i added the newInstance() in the end to check!
|
 |
Sebastian Janisch
Ranch Hand
Joined: Feb 23, 2009
Posts: 1183
|
|
|
well it's throwing a CNF error meaning that either the you got the wrong path to the driver or the jar is not in the classpath.
|
 |
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
|
|
I have the jar added in the classpath. The thing is i guess its something to do with Tomcat rather the jars and classpaths. I have made a post in the Tomcat section as well about this:
http://www.coderanch.com/t/476492/Tomcat/Tomcat-Throwing-java-lang-ClassNotFoundException
|
 |
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
|
|
Issue resolved.
|
 |
 |
|
|
subject: Unable to Load the Driver!
|
|
|