码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2015-02-11 21:58:19      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:java   mysql   jdbc   

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");”

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

标签:java   mysql   jdbc   

原文地址:http://blog.csdn.net/you23hai45/article/details/43740445

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!