标签:static trace tco exce gen dmi emd art cat
public class DBUtil {
static {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch
(ClassNotFoundException e) {
// TODO
Auto-generated catch block
e.printStackTrace();
}
}
public static Connection getConnection(){
Connection conn=null;
try {
conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/apartmentsystemdb", "root", "admin");
} catch
(SQLException e) {
// TODO
Auto-generated catch block
e.printStackTrace();
}
return conn;
}
public static void
close(Connection conn){
try {
conn.close();
} catch
(SQLException e) {
// TODO
Auto-generated catch block
e.printStackTrace();
}
}
}
标签:static trace tco exce gen dmi emd art cat
原文地址:http://www.cnblogs.com/JimCalark/p/6754701.html