JDBC連接Mysql
原碼:
try {
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://10.180.48.19:3306/hsp_db";
Properties info = new Properties();
info.setProperty("user", "root");
info.setProperty("password", "hillstone");
Connection conn = DriverManager.getConnection(url, info);
System.out.println(conn);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}