import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class inensshow {
public Connection conn(){
String DRIVER="com.mysql.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/mystudent";
String user="root";
String password="123456";
try{
Class.forName("com.mysql.jdbc.Driver");
} catch(ClassNotFoundException e){
System.out.print("加载错误");
}
Connection conn = null;
try{
conn=DriverManager.getConnection(url, user, password);
System.out.print("已经连接");
}catch(SQLException e){
System.out.print("核对用户名和密码");
}
return conn;
}
}
亲们,驱动包也导入了,下面是异常,好多啊~~~
The user to connect as
The password to use when connecting
The name of the class that the driver should use for creating socket connections to the server. This class must implement the interface 'com.mysql.jdbc.SocketFactory' and have public no-args constructor.
(其实很长的,大概都是属性之类的错误)