• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in loading Driver

 
viki Bhardwaj
Ranch Hand
Posts: 74
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
viki Bhardwaj
Ranch Hand
Posts: 74
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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


I corrected, actually i had taken wrong qualified diver name as above ,now code is running fine...
thanks .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic