一.連接oracle數(shù)據(jù)庫(kù)
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); 
    String url="jdbc:oracle:thin:@服務(wù)器ip:1521:數(shù)據(jù)庫(kù)名稱";
    Connection conn=DriverManager.getConnection(url,"用戶名","密碼");

二.連接mssql數(shù)據(jù)庫(kù)

     連接驅(qū)動(dòng)文件jtds-0.6.jar

     String url="jdbc:jtds:sqlserver://localhost:1433/‘?dāng)?shù)據(jù)庫(kù)名′";
     自帶驅(qū)動(dòng):

     Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
     String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";

三.連接DB2數(shù)據(jù)庫(kù)
     Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance(); 
     String url="jdbc:db2://localhost:5000/數(shù)據(jù)庫(kù)名稱";
四、jsp連接Informix數(shù)據(jù)庫(kù)

      Class.forName("com.informix.jdbc.IfxDriver").newInstance();
      String url = "jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;
      user=testuser;password=testpassword";
     //testDB為你的數(shù)據(jù)庫(kù)名
     Connection conn= DriverManager.getConnection(url);
     Statement stmt=conn.createStatement

五、jsp連接Sybase數(shù)據(jù)庫(kù)

    Class.forName("com.sybase.jdbc.SybDriver").newInstance();
   String url =" jdbc:sybase:Tds:localhost:5007/tsdata";
   //tsdata為你的數(shù)據(jù)庫(kù)名
   Properties sysProps = System.getProperties();
   SysProps.put("user","userid");
   SysProps.put("password","user_password");
   Connection conn= DriverManager.getConnection(url, SysProps);


六、jsp連接MySQL數(shù)據(jù)庫(kù) 
       Class.forName("org.gjt.mm.mysql.Driver").newInstance();
      String url ="jdbc:mysql://localhost/softforum?

      user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
    //testDB為你的數(shù)據(jù)庫(kù)名
     Connection conn= DriverManager.getConnection(url);

未完待續(xù)....