java.sql.SQLException: No suitable driver found for jdbc.mysql://127.0.0.1:3306/user
packagecom.test;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql...
package com.test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class One {
public static void main(String[] args) {
String driver="com.mysql.jdbc.Driver";
String url="jdbc.mysql://127.0.0.1:3306/user";
String root="root";
String pass="123456";
Connection con=null;
Statement sm=null;
ResultSet rs=null;
try {
Class.forName(driver);
con=DriverManager.getConnection(url,root,pass);
sm=con.createStatement();
rs=sm.executeQuery("select * from user");
System.out.println(rs);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} 展开
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class One {
public static void main(String[] args) {
String driver="com.mysql.jdbc.Driver";
String url="jdbc.mysql://127.0.0.1:3306/user";
String root="root";
String pass="123456";
Connection con=null;
Statement sm=null;
ResultSet rs=null;
try {
Class.forName(driver);
con=DriverManager.getConnection(url,root,pass);
sm=con.createStatement();
rs=sm.executeQuery("select * from user");
System.out.println(rs);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询