package 学生管理系统;
import java.sql.*;
public class GetConnection {
public Connection connection;
private Statement statement;
private ResultSet resultset;
private String delet_s;
private String adds_s;
private String select_s;
public Connection getCon()/*获取数据库的方法,实现对数据库的连接*/ {
try{
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://location:3306/xwt","root","123456");
}catch(ClassNotFoundException e1){
System.err.println(e1.toString());
}catch(SQLException e2){
System.err.print(e2.toString());
}
return connection;
}
}
import java.sql.*;
public class GetConnection {
public Connection connection;
private Statement statement;
private ResultSet resultset;
private String delet_s;
private String adds_s;
private String select_s;
public Connection getCon()/*获取数据库的方法,实现对数据库的连接*/ {
try{
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://location:3306/xwt","root","123456");
}catch(ClassNotFoundException e1){
System.err.println(e1.toString());
}catch(SQLException e2){
System.err.print(e2.toString());
}
return connection;
}
}