Java connect a variety of database instances Source: Network of the whole world: Zenith code in this article lists the key code to connect to the main database, other database access code is omitted 1, Oracle8 / 8i / 9i database (thin mode) Class.forName ( " Oracle.jdbc.driver.racleDriver "). NewInstance (); string url =" JDBC: Oracle: Thin: @Localhost: 1521: ORCL "; // ORCL is the sid string user =" test "; string password =" Test "; connection conn = drivermanager.getConnection (URL, User, Password); 2, DB2 database class.Forname (" com.ibm.db2.jdbc.app.db2driver ") .newinstance (); string url =" JDBC: DB2: // localhost: 5000 / Sample "; // Sample for your database name string user =" admin "; string password =" "; connection conn = drivermanager.getConnection (URL, User, Password); 3, SQL Server7 .0 / 2000 database class.Forname ("com.microsoft.jdbc.sqlser.sqlserdriver). NewInstance (); string url =" JDBC: Microsoft: SQLServer: // localhost: 1433; databasename = mydb "; // mydb For database string user = "sa"; string password = "; connection conn = drivermanager.getConnection (URL, User, Password); 4, Sybase Database Class.Forname (" com.sybase.jdbc.sybdriver). NewInstance String Url = "JDBC: Sybase: TDS: Localhost: 5007 / mydb"; // mydb for your database Name Properties sysProps = System.getProperties (); SysProps.put ( "user", "userid"); SysProps.put ( "password", "user_password"); Connection conn = DriverManager.getConnection (url, SysProps); 5, Informix database Class.forName ( "com.informix.jdbc.IfxDriver") newInstance (); String url = "jdbc:. informix-sqli: //123.45.67.89: 1533 / myDB: INFORMIXSERVER = myserver; user = testuser; password = TestPassword "; // mydb is the database name Connection Conn = DriverManager.getConnection (URL);