1.首先建一个公共的包,里面包括连接数据库的方法,不用每次都连接数据库。
public String url="jdbc:mysql://localhost:3306/rwgl?useSSL=false";
@SuppressWarnings("unused")
public String userName="root";//数据库的账号
@SuppressWarnings("unused")
public String pwd="password";//数据库的密码
protected void initDriver() {//数据加载驱动
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
1.首先建一个公共的包,里面包括连接数据库的方法,不用每次都连接数据库。
public Strin