posts - 33,  comments - 17,  trackbacks - 0
           1MySQL:    
           2    String Driver="com.mysql.jdbc.Driver";    //驅(qū)動(dòng)程序
           3    String URL="jdbc:mysql://localhost:3306/db_name";    //連接的URL,db_name為數(shù)據(jù)庫(kù)名    
           4    String Username="username";    //用戶(hù)名
           5    String Password="password";    //密碼
           6    Class.forName(Driver).new Instance();
           7    Connection con=DriverManager.getConnection(URL,Username,Password);
           8Microsoft SQL Server 2.0驅(qū)動(dòng)(3個(gè)jar的那個(gè)):
           9    String Driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";    //連接SQL數(shù)據(jù)庫(kù)的方法
          10    String URL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_name";    //db_name為數(shù)據(jù)庫(kù)名
          11    String Username="username";    //用戶(hù)名
          12    String Password="password";    //密碼
          13    Class.forName(Driver).new Instance();    //加載數(shù)據(jù)可驅(qū)動(dòng)
          14    Connection con=DriverManager.getConnection(URL,UserName,Password);    //
          15Microsoft SQL Server 3.0驅(qū)動(dòng)(1個(gè)jar的那個(gè)): // 老紫竹完善
          16    String Driver="com.microsoft.sqlserver.jdbc.SQLServerDriver";    //連接SQL數(shù)據(jù)庫(kù)的方法
          17    String URL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_name";    //db_name為數(shù)據(jù)庫(kù)名
          18    String Username="username";    //用戶(hù)名
          19    String Password="password";    //密碼
          20    Class.forName(Driver).new Instance();    //加載數(shù)據(jù)可驅(qū)動(dòng)
          21    Connection con=DriverManager.getConnection(URL,UserName,Password);    //
          22Sysbase:
          23    String Driver="com.sybase.jdbc.SybDriver";    //驅(qū)動(dòng)程序
          24    String URL="jdbc:Sysbase://localhost:5007/db_name";    //db_name為數(shù)據(jù)可名
          25    String Username="username";    //用戶(hù)名
          26    String Password="password";    //密碼
          27    Class.forName(Driver).newInstance();    
          28    Connection con=DriverManager.getConnection(URL,Username,Password);
          29Oracle(用thin模式):
          30    String Driver="oracle.jdbc.driver.OracleDriver";    //連接數(shù)據(jù)庫(kù)的方法
          31    String URL="jdbc:oracle:thin:@loaclhost:1521:orcl";    //orcl為數(shù)據(jù)庫(kù)的SID
          32    String Username="username";    //用戶(hù)名
          33    String Password="password";    //密碼
          34    Class.forName(Driver).newInstance();    //加載數(shù)據(jù)庫(kù)驅(qū)動(dòng)
          35    Connection con=DriverManager.getConnection(URL,Username,Password);    
          36PostgreSQL:
          37    String Driver="org.postgresql.Driver";    //連接數(shù)據(jù)庫(kù)的方法
          38    String URL="jdbc:postgresql://localhost/db_name";    //db_name為數(shù)據(jù)可名
          39    String Username="username";    //用戶(hù)名
          40    String Password="password";    //密碼
          41    Class.forName(Driver).newInstance();    
          42    Connection con=DriverManager.getConnection(URL,Username,Password);
          43DB2:
          44    String Driver="com.ibm.db2.jdbc.app.DB2.Driver";    //連接具有DB2客戶(hù)端的Provider實(shí)例
          45    //String Driver="com.ibm.db2.jdbc.net.DB2.Driver";    //連接不具有DB2客戶(hù)端的Provider實(shí)例
          46    String URL="jdbc:db2://localhost:5000/db_name";    //db_name為數(shù)據(jù)可名
          47    String Username="username";    //用戶(hù)名
          48    String Password="password";    //密碼
          49    Class.forName(Driver).newInstance();    
          50    Connection con=DriverManager.getConnection(URL,Username,Password);
          51Informix:
          52    String Driver="com.informix.jdbc.IfxDriver";    
          53    String URL="jdbc:Informix-sqli://localhost:1533/db_name:INFORMIXSER=myserver";    //db_name為數(shù)據(jù)可名
          54    String Username="username";    //用戶(hù)名
          55    String Password="password";    //密碼
          56    Class.forName(Driver).newInstance();    
          57    Connection con=DriverManager.getConnection(URL,Username,Password);
          58JDBC-ODBC:
          59    String Driver="sun.jdbc.odbc.JdbcOdbcDriver";
          60    String URL="jdbc:odbc:dbsource";    //dbsource為數(shù)據(jù)源名
          61    String Username="username";    //用戶(hù)名
          62    String Password="password";    //密碼
          63    Class.forName(Driver).newInstance();    
          64    Connection con=DriverManager.getConnection(URL,Username,Password);
          65
          posted on 2008-07-24 08:27 scea2009 閱讀(212) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): 網(wǎng)摘

          <2008年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(1)

          隨筆分類(lèi)

          隨筆檔案

          PL/SQL存儲(chǔ)過(guò)程與函數(shù)

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 台北市| 陵川县| 永昌县| 绥芬河市| 寻乌县| 那曲县| 延寿县| 齐河县| 仲巴县| 乐亭县| 榆社县| 兴和县| 万年县| 盐边县| 九龙坡区| 新野县| 江陵县| 靖宇县| 东海县| 和平区| 搜索| 宾川县| 兴宁市| 阳高县| 陕西省| 栾川县| 西青区| 始兴县| 莆田市| 天柱县| 乌拉特中旗| 宁波市| 华蓥市| 东丽区| 无为县| 冷水江市| 资兴市| 彰化市| 凌源市| 武冈市| 马龙县|