i am trying to solve this problem by following all steps which is required to connect a Apache Wicket web application to MySQL database.
step1 Right Click on project -> Build Path ->Configure Build Path -> Java Build Path -> Libraries Tab -> Add external jar -> then i browse MySql-Connector-5.0.8 jar file.
step2In program i write down
public static Connection con=null;
public static Connection getConnection()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/db1", "root", "root");
}catch(ClassNotFoundException ex){ex.printStackTrace();}
catch(SQLException e){System.out.println(e);}
finally{
try
{
con.close();
}catch(Exception e){}
}
return con;
}
but still facing Error the java.lang.ClassNotFoundException: com.mysql.jdbc.Driver now what to do..I need your help
MySql-Connector-5.0.8.jar
under Libraries. If it not there might broken ref , try to add it with the project – San Krish Nov 21 '14 at 11:50