java.sql.SQLException:No suitable driver found for http://localhost:3306/school,nosuitabledriver
1、错误描述
java.sql.SQLException:No suitable driver found for http://localhost:3306/school
2、错误原因
Class.forName("com.mysql.jdbc.Driver");
Connection conn = null;
Statement stat = null;
ResultSet rs = null;
try
{
conn = DriverManager.getConnection("http://localhost:3306/school", "root", "root");
stat = conn.createStatement();
stat.execute("");
}
catch (SQLException e)
{
e.printStackTrace();
}由于连接数据库的URL写的有问题
3、解决办法
将上述“conn = DriverManager.getConnection("http://localhost:3306/school", "root", "root");”改写成“conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/school", "root", "root");”
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。