try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection
(
"jdbc://mysql://3306/localhost/labour",
"root",
"pb"
);
Statement st=con.createStatement();
String query="select userid,password from userregiter";
ResultSet rs= st.executeQuery(query);
while(rs.next())
{
String userid=rs.getString("USERID");
String password=rs.getString("PASSWORD");
if ((a.equals(userid)) && (b.equals(password)))
{
JOptionPane.showMessageDialog(null, "Username and Password exist");
} else {
JOptionPane.showMessageDialog(null, "Please Check Username and Password ");
}
}
} catch(Exception e) {
System.out.println(e);
}
ERROR : When I Run My Application It Shows the SQL Exception.
java.sql.SQLException: No suitable driver found for jdbc://mysql://3306/localhost/labour
Your db url must look like:
and you must have the mysql driver in your classpath.
See the official documentation for more details.