In this particular case (assuming that the Class#forName()
didn't throw an exception; your code is namely continuing with running instead of throwing the exception), this SQLException
means that Driver#acceptsURL()
has returned false
for any of the loaded drivers.
And indeed, your JDBC URL is wrong:
String url = "'jdbc:mysql://localhost:3306/mysql";
Remove the singlequote:
String url = "jdbc:mysql://localhost:3306/mysql";
See also:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…