1、Oracle8/8i/9i数据库(精简模式) class.forname (' Oracle.JDBC.driver.Oracle driver ' ).newInstance ); string URL=' JDBC : Oracle : thin : @ localhost 33601521: orcl '; //orcl是数据库的SID String user='test '; String password='test '; connection conn=driver manager.getconnection (URL,user,password );
2、DB2数据库class.forname (com.IBM.DB2.JDBC.app.DB2 driver ).newInstance ); string URL=' JDBC : db 2://localhost 33605000/sample '; //sample是您的数据库名称String user='admin '; 字符串密码=' '; connection conn=driver manager.getconnection (URL,user,password );
3、Sql Server7.0/2000数据库class.forname (com.Microsoft.JDBC.SQL server.SQL server driver ) ).newInstance; string URL=' JDBC : Microsoft : SQL server ://localhost 33601433; DatabaseName=mydb '; //mydb是数据库字符串用户=' sa '; 字符串密码=' '; connection conn=driver manager.getconnection (URL,user,password );
4、Sybase数据库class.forname (com.Sybase.JDBC.syb driver ).newInstance ); string URL=' JDBC : Sybase : TDS : localhost 33605007/mydb '; //myDB是您的数据库名称properties sysprops=system.get properties (; sysprops.put(user ),userid ); sysprops.put(password,) user_password; connection conn=driver manager.getconnection (URL,SysProps );
5、Informix数据库class.forname (' com.Informix.JDBC.ifx驱动程序' ).newInstance ); string URL=' JDBC : Informix-sqli ://123.45.67.8933601533/mydb : Informix server=my server; 用户=testuser; password=testpassword '; //myDB是数据库名称connection conn=driver manager.getconnection (URL );
6、MySQL数据库class.forname (org.gjt.mm.MySQL.driver ) ).newInstance ); string URL=' JDBC : MySQL ://localhost/mydb? user=soft password=soft 1234 use unicode=true优秀可乐=8859_1'/mydb是数据库名称connection conn=driver manager.getconnectiod
7、PostgreSQL数据库class.forname (org.PostgreSQL.driver ) ).newInstance; string URL=' JDBC : PostgreSQL ://localhost/mydb '/mydb是数据库名称String user='myuser '; string password='我的密码'; connection conn=driver manager.getconnection (URL,user,password );