0
public static void main(String[] args){
private String DRIVER = "com.mysql.jdbc.Driver";
Connection con= null;
try {
con = DriverManager.getConnection("jdbc::mysql://localhost:3306/sampledb?useSSL=false","root","");
} catch(SQLException ex){
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
I am trying to run this method to make a connection with Mysql database and at run time I am having the following error :
Sqlexception: No suitable driver found for jdbc::mysql:/localhost:3306/sampledb? useSSL=false Sqlstate: 08001 Vendorerror: 0
I tried to change my Connection String and could not make it work, tried to change Referenced Libraries(connection drive) and also did not succeed.
I know little of Java and I’ve taken some classes of connection and I came to the same error, which may be occurring?
I indicated where is my connection driver in the question description
– Patric Enderson
Right, because try the following solution: Within your project create a package called libs (or as you prefer) and by file explorer move the driver into that package, then you import again. BEFORE THIS PROCESS REMOVE THE DRIVER YOU POINTED OUT.
– GEVERSON SOUZA
Dude, I can pull out and add the drive. Now, move it impossible
– Patric Enderson
Do the following, first REMOVE A THE DRIVER YOU POINTED, then download the driver at this link -> http://geverson.000webhostapp.com/view/projeto/uploads/mysql-connector-java-5.1.48.jar, then create the package within your project then copy or move the downloaded driver into the package you created, and finally add the downloaded driver and copied/moved into your project.
– GEVERSON SOUZA
I was able to fix it. Missing connection Class.forName("com.mysql.Cj.jdbc.Driver");
– Patric Enderson
blz then, until next.
– GEVERSON SOUZA