<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Java: Java常見數據庫連接

    [轉帖]Java常見數據庫連接

    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&useUnicode=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-08-02 17:22 心硯 閱讀(209) 評論(0)  編輯  收藏 所屬分類: Java

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導航

    統計

    常用鏈接

    留言簿(2)

    隨筆分類

    文章分類

    文章檔案

    Forum

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 免费少妇a级毛片| 亚洲成色www久久网站夜月| 在线免费观看亚洲| 亚洲视频无码高清在线| 无码精品人妻一区二区三区免费| 99免费观看视频| 久久久亚洲欧洲日产国码aⅴ| 国产精品成人亚洲| 大胆亚洲人体视频| 亚洲国产综合自在线另类| 美女视频黄的全免费视频| 亚洲AV色吊丝无码| 国产精品冒白浆免费视频| 精品亚洲成a人片在线观看| 日韩免费无码一区二区三区| 亚洲jjzzjjzz在线观看| 日韩中文无码有码免费视频| 亚洲精品偷拍无码不卡av| 国产无遮挡又黄又爽免费网站| 亚洲精品无码专区在线在线播放| 亚洲成AV人影片在线观看| 亚洲?v无码国产在丝袜线观看| 乱爱性全过程免费视频| 亚洲AV无码专区电影在线观看| 疯狂做受xxxx高潮视频免费| 亚洲综合国产精品第一页| 亚洲精品无码你懂的| www亚洲精品少妇裸乳一区二区| 国产精品美女久久久免费| 2022年亚洲午夜一区二区福利 | 亚洲精品91在线| 一二三四视频在线观看中文版免费| 相泽南亚洲一区二区在线播放| 青娱乐免费在线视频| 亚洲Av永久无码精品一区二区| 久久亚洲国产精品123区| 2019中文字幕在线电影免费| 成人婷婷网色偷偷亚洲男人的天堂| 亚洲色WWW成人永久网址| 精品久久久久久久久免费影院| 一级女人18片毛片免费视频 |