import java.sql.*;
public class JDBC {


public JDBC()
{
try {
Class.forName("com.mysql.jdbc.Driver"); 
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try 
Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/database=bookmisuser=root&password=202636"); 
Statement stat=conn.createStatement();
ResultSet rst=stat.executeQuery("select * from user");
while(rst.next())
{
System.out.println(rst.getString(1));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public  static void main(String[] args)
{
new JDBC();
}
}Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/database=bookmisuser=root&password=202636");
这句驱动管理器设置报错。请大家帮忙解决一下

解决方案 »

  1.   

    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/mytest";
    String uname = "root";
    String psw = "****";
    String sql = "select username, password from ***";
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    conn = DriverManager.getConnection(url,uname,psw);
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
      

  2.   

    要加载mysql的驱动包
    从网上下载个,导入再试试
      

  3.   

    对啊 mysql的驱动包要自己下来的
      

  4.   

    database=bookmisuser=root&password=202636在root和password之间的符号你就这么写的么
    找找转意符替换了