1个回答
展开全部
public
static Connection getConnection(){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Connection conn=null;
try {
conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1/user?useEncode=true&characterEncoding=utf-8","root","root");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return conn;
}
static Connection getConnection(){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Connection conn=null;
try {
conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1/user?useEncode=true&characterEncoding=utf-8","root","root");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return conn;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询