I\'ve been having a problem with mySQL database connectivity. I\'m getting an error:
No suitable driver found for jdbc:mysql://127.0.0.1/sakila.
You need to instantiate the driver before calling the getConnection :
String pdriver = "com.mysql.jdbc.Driver";
Class.forName(pdriver).newInstance();
You need to add the MySQL connecter library jar file
to the classpath, rather than the directory where it is contained.
Are you not using an IDE like Netbeans or Eclipse? Setting up a command line development environment in Windows is not hard but it's not trivial either
You need to place the connector jar file to your classpath
or ...\jre1.6.0\lib\ext
Classpath is the one you should favor instead of the latter
Add the following
String driver = "com.mysql.jdbc.Driver";
Class.forName(driver).newInstance();
right before the line "con = DriverManager.getConnection(url, user, password);"
All you need to do is load the driver class before getting the connection from the drivermanager.