0

I got this error when I use Class.forName[...]. I used the JConnector MSI Installer (http://dev.mysql.com/downloads/connector/j/5.1.html) so I got no ZIP file to add to my build path or I don't know where the installer put it.

Any ideas?

8
  • Include the mysql.jar file in your build path. Commented Oct 21, 2015 at 8:16
  • add mysql-connector-java-5.1.5-bin.jar in your classpath Commented Oct 21, 2015 at 8:17
  • You can get the file from here : java2s.com/Code/Jar/m/Downloadmysqlconnectorjar.htm Commented Oct 21, 2015 at 8:19
  • I don't know where the installer put it. It didn't show a directory and immediatly closed after finishing the installation. Commented Oct 21, 2015 at 8:23
  • 2
    Possible duplicate of ClassNotFoundException com.mysql.jdbc.Driver Commented Oct 21, 2015 at 8:55

1 Answer 1

1

Try to insert this:

DriverManager.registerDriver(new com.mysql.jdbc.Driver());

before getting the JDBC Connection.

Other option :

1: Download the mysql-connector-java.jar

2: You need to drop JAR in /WEB-INF/lib folder.

3: properties of project->build path->add JAR and selected the JAR above.

Sign up to request clarification or add additional context in comments.

3 Comments

Which server you are using?
Apache, and I'm using XAMPP if this is kind of helpful.
Thanks! I created the project as a Dynamic Web Project and follow your instructions with the /WEB/INF/lib and the build path ;) Works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.