wood burning stoves 2.0*
The moose likes JDBC and the fly likes problem in loading Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem in loading Driver" Watch "problem in loading Driver" New topic
Author

problem in loading Driver

viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74

Hi All,

I am trying to write simple servlet having jdbc code that connect to mysql database and retrieve a details of table fields , and i am using netbeans and wamp server to do my job.
let me explain what problem i am facing.....
Apache tomcat is complaining regarding Driver that....
java.lang.ClassNotFoundException: com.jdbc.mysql.Driver

and what i have tried to solve this..
1-i attached mysql-connector-java-5.1.6.jar to my project library
but i found the same problem ,when i observed wamp server's containing mysql folder that is- wamp/bin/mysql 5.1.36
and also i have been tried by adding mysql-connector-java-5.1.25 but still facing same above issue...
my simple servlet code is bellow...


i am not getting any clue that what i am missing or any extra stuff to do with my code please help me .
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

Vivek Bhardwaj wrote:1-i attached mysql-connector-java-5.1.6.jar to my project library

But did you add it to Tomcat's lib folder?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74

Rob Spoor wrote:
Vivek Bhardwaj wrote:1-i attached mysql-connector-java-5.1.6.jar to my project library

But did you add it to Tomcat's lib folder?


first i would say thanks Rob for your hint ,i tried to add as like you suggested but i am unable to find the location . actually i am using netbeans IDE and managing mysql and apache tomcat through wamp server ,so as you suggested i tried to do like this-
1-i looked for the place(tomcat's lib) in my project in netbeans but there is only project's library folder exists.
2-also i tried to search that directory in the wamp server folder like wamp/bin/apache/apache2.2.11 folder but there is no lib folder
3-and also tried by adding jar file in installed apache home directory lib folder(installed on C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib)

but still i am getting the same error....please help me out.
your reply would be highly appreciable.
viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74

Please help me, still i am waiting for your valuable reply that would be helpful to resolve my problem , really i am curious to learn that how to work with wamp server to develop web application ,but i am stuck in a very common problem which i have posted above already.....please help me. i would be very thankful to your help.
viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74


Class.forName("com.jdbc.mysql.Driver");


I corrected, actually i had taken wrong qualified diver name as above ,now code is running fine...
thanks .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem in loading Driver