1
I am working on a JSP project with database my driver is not being recognized.
I am using the following method to connect to the bank.
public ConnectionDB(){
try {
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/loja";
String user = "hxf";
String password = "";
con = (Connection)DriverManager.getConnection(url,user,password);
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
I am using Tomcat. The following error is returned.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1891)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1734)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at DAO.ConnectionDB.<init>(ConnectionDB.java:13)
Does anyone have any idea what it might be?
added mysql driver to your project ?
– Eduardo Sampaio
Maybe this is a duplicate of this question: http://answall.com/q/141603/132 - Although the question is not exactly the same, I recommend the same answer.
– Victor Stafusa