您的位置:首页 > 理论基础 > 计算机网络

java.sql.SQLException:No suitable driver found for http://localhost:3306/school

2015-02-11 21:24 831 查看
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");”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐