I've been trying to load the JDBC MySQL connector with the following code:
import java.sql.*;
public class dbTest{
public static void main(String[] args) throws SQLException, ClassNotFoundException
{
Class.forName("com.mysql.jdbc.Driver");
}
}
And I keep getting a class not found exception:
java.lang.ClassNotFoundException
at edu.rice.cs.plt.reflect.PathClassLoader.findClass(PathClassLoader.java:148)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at dbTest.main(dbTest.java:6)
I have added the path to the driver (mysql-connector-java-3.1.14-bin.jar) to my classpath and double checked to make sure it was correct. I also added copies of the jar to the ext folder of my Java installation based on what I read from this article: http://www.developer.com/java/data/jdbc-and-mysql-installation-and-preparation-of-mysql.html
I also searched through posts of others who have had this problem, but all of the responses so far have been saying to add the connector jar to the classpath, which I have already done.
Any help would be greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…