java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbname [duplicate]

Make sure you run this first:

Class.forName("com.mysql.jdbc.Driver");

This forces the driver to register itself, so that Java knows how to handle those database connection strings.

For more information, see the MySQL Connector reference.

Leave a Comment