Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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)

share|improve this question
    
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 4 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 4 at 19:27
    
I downloaded this one dev.mysql.com/downloads/connector/j , –  Hussien Mohamed Jan 4 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 4 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 4 at 19:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.