隨筆 - 100  文章 - 50  trackbacks - 0
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          我收藏的一些文章!

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          1、Oracle8/8i/9i數(shù)據(jù)庫(thin模式)
          Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
          String url="jdbc:oracle:thin:@localhost:1521:orcl";
          //orcl為數(shù)據(jù)庫的SID
          String user="test";
          String password="test";
          Connection conn= DriverManager.getConnection(url,user,password);

          2、DB2數(shù)據(jù)庫
          Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
          String url="jdbc:db2://localhost:5000/sample";
          //sample為你的數(shù)據(jù)庫名
          String user="admin";
          String password="";
          Connection conn= DriverManager.getConnection(url,user,password);

          3、Sql Server7.0/2000數(shù)據(jù)庫
          Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
          String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";
          //mydb為數(shù)據(jù)庫
          String user="sa";
          String password="";
          Connection conn= DriverManager.getConnection(url,user,password);

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

          5、Informix數(shù)據(jù)庫
          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為數(shù)據(jù)庫名
          Connection conn= DriverManager.getConnection(url);

          6、MySQL數(shù)據(jù)庫
          Class.forName("org.gjt.mm.mysql.Driver").newInstance();
          String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
          //myDB為數(shù)據(jù)庫名
          Connection conn= DriverManager.getConnection(url);

          7、PostgreSQL數(shù)據(jù)庫
          Class.forName("org.postgresql.Driver").newInstance();
          String url ="jdbc:postgresql://localhost/myDB"
          //myDB為數(shù)據(jù)庫名
          String user="myuser";
          String password="mypassword";
          Connection conn= DriverManager.getConnection(url,user,password);

          posted on 2010-05-12 11:02 fly 閱讀(574) 評論(0)  編輯  收藏 所屬分類: java學(xué)習(xí)
          主站蜘蛛池模板: 禄丰县| 彭阳县| 荥经县| 庄浪县| 仲巴县| 建昌县| 揭东县| 萍乡市| 梁平县| 同心县| 石门县| 昆明市| 浪卡子县| 景东| 白银市| 新晃| 汽车| 抚远县| 芮城县| 湾仔区| 昌吉市| 淮滨县| 武定县| 洛阳市| 兴隆县| 唐山市| 隆子县| 闸北区| 昭觉县| 庄河市| 曲靖市| 凤翔县| 丹巴县| 金平| 宁晋县| 盘山县| 陇川县| 赤水市| 中山市| 平阴县| 湛江市|