java.sql.SQLException:No suitable driver found forhttp://localhost:3306/school
733 ワード
1、エラー説明
java.sql.SQLException:No suitable driver found forhttp://localhost:3306/school
2、エラーの原因
3、解決策
上記の「conn=DriverManager.get Connection」をhttp://localhost:3306/school"root","root",""""";を"conn=DriverManager.get Connection("jdbc:mysql://localhost:3306/school「root」「root」「)」
java.sql.SQLException:No suitable driver found forhttp://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.get Connection」をhttp://localhost:3306/school"root","root",""""";を"conn=DriverManager.get Connection("jdbc:mysql://localhost:3306/school「root」「root」「)」