驱动:Class.forName("xxxxx");
数据库 | 驱动(各厂商实现的Driver.class) |
sqlserver | com.microsoft.jdbc.sqlserver.SQLServerDriver |
oracle | oracle.jdbc.driver.OracleDriver |
mysql | com.mysql.jdbc.Driver |
sybase | com.sybase.jdbc2.jdbc.SybDriver |
db2 | com.ibm.db2.jdbc.net.DB2Driver |
postgresql | org.postgresql.Driver |
连接字符串:Connection con = DriverManager.getConnection("xxxxx", [ID, Pwd]);
数据库 | 连接字符串 |
sqlserver | DriverManager.getConnection("jdbc:microsoft:sqlserver://ServerNameorIP:1433;databaseName=master", ID, Pwd); |
oracle | DriverManager.getConnection("jdbc:oracle:thin:@ServerNameorIP:1521:ORCL ", ID, Pwd); |
mysql | DriverManager.getConnection("jdbc:mysql://ServerNameorIP:3306/DBName", ID, Pwd); |
sybase | 一般不用 |
db2 | 一般不用 |
postgresql | 一般不用 |