1、Oracle8/8i/9i数据库(thin模式)<wbr><br> Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();<wbr><br> String url="jdbc:oracle:thin:@localhost:1521:orcl";<wbr><br> //orcl为数据库的SID<wbr><br> String user="test";<wbr><br> String password="test";<wbr><br> Connection conn= DriverManager.getConnection(url,user,password);</wbr></wbr></wbr></wbr></wbr></wbr>
2、DB2数据库<wbr><br> Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();<wbr><br> String url="jdbc:db2://localhost:5000/sample";<wbr><br> //sample为你的数据库名<wbr><br> String user="admin";<wbr><br> String password="";<wbr><br> Connection conn= DriverManager.getConnection(url,user,password);</wbr></wbr></wbr></wbr></wbr></wbr>
3、Sql Server7.0/2000数据库<wbr><br> Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();<wbr><br> String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";<wbr><br> //mydb为数据库<wbr><br> String user="sa";<wbr><br> String password="";<wbr><br> Connection conn= DriverManager.getConnection(url,user,password);</wbr></wbr></wbr></wbr></wbr></wbr>
4、Sybase数据库<wbr><br> Class.forName("com.sybase.jdbc.SybDriver").newInstance();<wbr><br> String url =" jdbc:sybase:Tds:localhost:5007/myDB";<wbr><br> //myDB为你的数据库名<wbr><br> Properties sysProps = System.getProperties();<wbr><br> SysProps.put("user","userid");<wbr><br> SysProps.put("password","user_password");<wbr><br> Connection conn= DriverManager.getConnection(url, SysProps);</wbr></wbr></wbr></wbr></wbr></wbr></wbr>
5、Informix数据库<wbr><br> Class.forName("com.informix.jdbc.IfxDriver").newInstance();<wbr><br> String url =<wbr><br> "jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;<wbr><br> user=testuser;password=testpassword";<wbr><br> //myDB为数据库名<wbr><br> Connection conn= DriverManager.getConnection(url);</wbr></wbr></wbr></wbr></wbr></wbr>
6、MySQL数据库<wbr><br> Class.forName("org.gjt.mm.mysql.Driver").newInstance();<wbr><br> String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"<wbr><br> //myDB为数据库名<wbr><br> Connection conn= DriverManager.getConnection(url);</wbr></wbr></wbr></wbr>
7、PostgreSQL数据库<wbr><br> Class.forName("org.postgresql.Driver").newInstance();<wbr><br> String url ="jdbc:postgresql://localhost/myDB"<wbr><br> //myDB为数据库名<wbr><br> String user="myuser";<wbr><br> String password="mypassword";<wbr><br> Connection conn= DriverManager.getConnection(url,user,password);</wbr></wbr></wbr></wbr></wbr></wbr>