简体   繁体   中英

ClassNotFoundException 'com.mysql.jdbc.Driver'

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM