JDBC链接

//1. MySQL(http://www.mysql.com)mm.mysql-2.0.2-bin.jar 
Connection con = null; 
Class.forName( "org.gjt.mm.mysql.Driver" );// 加载驱动程序 
con = DriverManager.getConnection( "jdbc:mysql://DbComputerNameOrIPAddr:3306/DatabaseName", UserName, Password ); 
 
 
//2. PostgreSQL(http://www.de.postgresql.org)pgjdbc2.jar 
Connection con = null; 
Class.forName( "org.postgresql.Driver" );// 加载驱动程序 
con = DriverManager.getConnection( "jdbc:postgresql://DbComputerNameOrIPAddr/DatabaseName", UserName, Password ); 
 
 
//3. Oracle(http://www.oracle.com/ip/deploy/database/oracle9i/)classes12.zip 
Connection con = null; 
Class.forName( "oracle.jdbc.driver.OracleDriver" );// 加载驱动程序 
con = DriverManager.getConnection( "jdbc:oracle:thin:@DbComputerNameOrIPAddr:1521:DatabaseName", UserName, Password ); 
 
 
//4. Sybase(http://jtds.sourceforge.net)jconn2.jar 
Connection con = null; 
Class.forName( "com.sybase.jdbc2.jdbc.SybDriver" );// 加载驱动程序 
con = DriverManager.getConnection( "jdbc:sybase:Tds:DbComputerNameOrIPAddr:2638/DatabaseName", UserName, Password ); 
//(Default-Username/Password: "dba"/"sql") 
 
 
//5. Microsoft SQLServer(http://jtds.sourceforge.net
Connection con = null; 
28.Class.forName( "net.sourceforge.jtds.jdbc.Driver" );// 加载驱动程序 
29.con = DriverManager.getConnection( "jdbc:jtds:sqlserver://DbComputerNameOrIPAddr:1433/DatabaseName", UserName, Password ); 
30. 
31. 
32.//6. Microsoft SQLServer(http://www.microsoft.com
33.Connection con = null; 
34.Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );// 加载驱动程序 
35.con = DriverManager.getConnection( "jdbc:microsoft:sqlserver://DbComputerNameOrIPAddr:1433;databaseName=master", UserName, Password );

原文地址:https://www.cnblogs.com/xgxhellboy/p/3217201.html