<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

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 欧洲美女大片免费播放器视频| 亚洲熟妇无码爱v在线观看| 亚洲日本VA中文字幕久久道具| 无码人妻AV免费一区二区三区| 亚洲人成色77777| 日本高清不卡aⅴ免费网站| 国产亚洲成归v人片在线观看| 精品在线视频免费| 亚洲AV伊人久久青青草原| 美女被免费网站在线视频免费| 亚洲av无码不卡私人影院| 国产高潮流白浆喷水免费A片 | 亚洲精品无码永久在线观看你懂的 | 久久精品国产精品亚洲精品| 在线播放免费人成毛片乱码| 亚洲AV无码AV男人的天堂| 日韩av无码久久精品免费| 亚洲欧洲另类春色校园小说| 成人免费一级毛片在线播放视频 | 亚洲色大成网站WWW久久九九| 中文字幕成人免费高清在线| 国产亚洲精品va在线| 一级毛片免费观看不卡的| 亚洲喷奶水中文字幕电影| 在线免费观看一区二区三区| 羞羞网站在线免费观看| 亚洲精品自在在线观看| 亚洲免费在线视频观看| 国产精品亚洲一区二区三区| 国产91精品一区二区麻豆亚洲| 久久免费国产精品一区二区| 亚洲乱码无限2021芒果| 国产精品久久久久影院免费| 中国一级特黄高清免费的大片中国一级黄色片 | 99精品一区二区免费视频| 色婷五月综激情亚洲综合| 免费国产在线观看不卡| 欧洲人免费视频网站在线| 亚洲综合av一区二区三区| 国产亚洲一区二区三区在线不卡| 日韩在线不卡免费视频一区|