1. MySQL
(1) 3选1
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
new com.mysql.jdbc.Driver();
(2)
Connection conn = DriverManager.getConnection("jdbc:mysql://ip/数据库名?user=用户名&password=密码");//类似http get请求
2.Oracle
(1) 3选1
Class.forName("oracle.jdbc.driver.oracleDriver");
Class.forName("oracle.jdbc.driver.oracleDriver").newInstance();
new oracle.jdbc.driver.oracleDriver();
(2)
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@ip:1521:服务器","用户名","密码");