1

I know that this question was asked many times before, but unfortunately none of the answers solved my problem, I'm using ubuntu 13.04 and I'm writing jsp file on eclipse that has to be connected to mysql database but whenever I wrote the following line in the code :

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

I found an exception java.lang.ClassNotFoundException: com.mysql.jdbc.Driver, I'm aware that I should use mysql-connector jar file and drop it in web-INF folder and tomcat lib folder and some other folder but unfortunately none of these worked!.Any help please?(please be specific)

Ravinder Reddy
  • 23,692
  • 6
  • 52
  • 82
  • Are you sure you are using a recent version of `mysql-connector`? In very old version the driver class name was something else (unfortunately don't remember it). Is `com.mysql.jdbc.Driver` available in your jar file? – Amir Pashazadeh Jan 04 '14 at 19:07
  • Did you restart Tomcat? Why did you copy the same jar in different folders? Could you try to use maven to build your war? – farvilain Jan 04 '14 at 19:27
  • I downloaded this one http://dev.mysql.com/downloads/connector/j/ , – Hussien Mohamed Jan 04 '14 at 19:28
  • Which web-INF / lib folder did you use? When you start Tomcat from within Eclipse, Eclipse uses its own configuration (including its own folders). This can (but does need to) result in some weird errors. – SirRichie Jan 04 '14 at 19:28
  • farvilain I restarted Tomcat several times, and I copied it in different folders because when I googled this question I found many answers and every answer state that the jar file should be copied in different folder, and I don't know what maven is ! – Hussien Mohamed Jan 04 '14 at 19:31

0 Answers0