1
Java
连接
Oralce
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
Connection conn= DriverManager.getConnection(url,user,password);
String url="jdbc:oracle:thin:@localhost:1521:orcl";
Connection conn= DriverManager.getConnection(url,user,password);
2
Java
连接
MySQL
Class.forName("
org.gjt.mm.mysql.Driver
").newInstance();
String URL = "jdbc:mysql://localhost/test";
Connection conn= DriverManager.getConnection(url,user,password);
3
Java
连接
SQLServer
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
String URL =”
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";
Connection conn= DriverManager.getConnection(url,user,password);
4 Java
连接
DB2
Class.forName(“com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
String URL =”
jdbc:db2://localhost:5000/sample";
Connection conn= DriverManager.getConnection(url,user,password);
5 Java
连接
Infomix
Class.forName("com.informix.jdbc.IfxDriver ").newInstance();
String URL
=
jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver
Connection conn= DriverManager.getConnection(url,user,password);
6 Java
连接
SyBase
Class.forName("com.sybase.jdbc.SybDriver").newInstance();
Properties sysProps = System.getProperties();
SysProps.put("user","userid");
SysProps.put("password","user_password");
Connection conn= DriverManager.getConnection(url, SysProps);
SysProps.put("user","userid");
SysProps.put("password","user_password");
Connection conn= DriverManager.getConnection(url, SysProps);
7 Java
连接
PostgreSQL
Class.forName("org.postgresql.Driver").newInstance();
String url ="jdbc:postgresql://localhost/soft"
Connection conn= DriverManager.getConnection(url,user,password);
String url ="jdbc:postgresql://localhost/soft"
Connection conn= DriverManager.getConnection(url,user,password);