I am trying to connect to mysql in java (I use Wamp) so I used the following code : (I'm using Eclipse)
package genererPlanning;
import java.sql.*;
public class genererPlanning{
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost/mysql";
static final String USER = "root";
static final String PASS = "";
public static void main(String[] args){
Connection conn = null;
try {
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root", "");
}
catch (SQLException ex){
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
}
}
But it returned me this text :
SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mysql
SQLState: 08001
VendorError: 0
Do you know why it does not work?
PS : I looked at theses links but don't find my answer :
- stackoverflow
- stackoverflow
- stackoverflow
- commentcamarche
Thanks for all.