troubleshooting Question

connecting to mysql database on localhost

Avatar of komlaaa
komlaaa asked on
15 Comments1 Solution289 ViewsLast Modified:
Below is code and and the output i received.
Does anyone know what is wrong?

//////////////code /////////////

package dbconnect;

import java.sql.*;

public class TestDriver
      private static String url = "jdbc:mysql://localhost/db1";
    private static String login = "achille";
    private static String password = "xia0011";
    public static void main(String[] args)
              System.out.println("Loaded Drivers!");
         catch(Exception e)
              System.out.println("Driver Error:" + e);
                   Connection con = DriverManager.getConnection(url, login, password);
                   System.out.println("Connection successful!");
         catch(Exception f)
              System.out.println("Connection Error: " + f);


//////////////// output //////////////////
Loaded Drivers!
Connection Error: java.sql.SQLException: No suitable driver

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros