Trying to connect a Servlet to Mysql
(I can read the Herew, just can't install it at work)
I am using Eclipse.
I created a new web project,
Dropped the jdbc driver (JAR) inside WEB-INF/lib
When I run, I get java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/lms2prod
The exact same code, when I run under simple Java project, works just fine.
Code:
PrintWriter out = response.getWriter();
String mySqlUrl = "jdbc:mysql://localhost:3306/lms2prod";
Properties userInfo = new Properties();
userInfo.put("user", "root");
userInfo.put("password", "yababa13");
try{
Connection connection = DriverManager.getConnection(mySqlUrl, userInfo);
}catch(Exception e) {
out.println(e);
}
Where do I need to put the *.JAR?
I use Eclipse with Tomcat
(I can read the Herew, just can't install it at work)
I am using Eclipse.
I created a new web project,
Dropped the jdbc driver (JAR) inside WEB-INF/lib
When I run, I get java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/lms2prod
The exact same code, when I run under simple Java project, works just fine.
Code:
PrintWriter out = response.getWriter();
String mySqlUrl = "jdbc:mysql://localhost:3306/lms2prod";
Properties userInfo = new Properties();
userInfo.put("user", "root");
userInfo.put("password", "yababa13");
try{
Connection connection = DriverManager.getConnection(mySqlUrl, userInfo);
}catch(Exception e) {
out.println(e);
}
Where do I need to put the *.JAR?
I use Eclipse with Tomcat