I am trying to connect to DB using JDBC My code :-
public static Connection getConnection() {
String dbName = "test";
String userName = "test";
String password = "";
Connection connection = null;
try {
Class.forName("com.myqsl.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://localhost/" + dbName, userName, password);
} catch (Exception e) {
// connection = null;
System.out.println("error");
e.printStackTrace();
}
return connection;
}
And I am getting java.lang.ClassNotFoundException. I tried attaching rt.jar to the class file editor source but now getting Source attachment does not contain the source for the file drivermanager.class just don't know how to proceed
Note:- using eclipse and not on debugging mode.