創造希望
          做一個精通技術的高級管理人員,做一個善於管理的高級技術人員!在學習中實踐,在實踐中學習!明日網豪之星
          posts - 5,  comments - 1,  trackbacks - 0

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

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

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

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

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

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

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

          posted on 2007-12-03 14:48 網豪 閱讀(107) 評論(0)  編輯  收藏 所屬分類: oracle

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          相冊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 绥德县| 潜山县| 礼泉县| 民权县| 万年县| 华宁县| 西峡县| 贞丰县| 体育| 讷河市| 吉林省| 盐城市| 虎林市| 瑞昌市| 偃师市| 枞阳县| 顺义区| 白朗县| 丹巴县| 黔江区| 长丰县| 庄河市| 易门县| 宁波市| 同心县| 常山县| 宁强县| 濮阳县| 三都| 天等县| 房山区| 沛县| 廉江市| 新平| 阿拉善盟| 易门县| 汕尾市| 昭通市| 巫溪县| 谢通门县| 喀喇沁旗|