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

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

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

    weidagang2046的專欄

    物格而后知致
    隨筆 - 8, 文章 - 409, 評論 - 101, 引用 - 0
    數據加載中……

    JDBC連接各種數據庫方法

    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);

    from: http://www.jspcn.net/htmlnews/11049388537651402.html

    posted on 2006-05-06 23:29 weidagang2046 閱讀(127) 評論(0)  編輯  收藏 所屬分類: Java

    主站蜘蛛池模板: 亚洲最大免费视频网| 亚洲av成人无码久久精品| 91免费福利精品国产| 日韩一级片免费观看| 亚洲免费综合色在线视频| 亚洲女同成av人片在线观看| 亚洲成a人在线看天堂无码| 免费观看亚洲人成网站| 免费观看午夜在线欧差毛片 | 久久99亚洲网美利坚合众国| 国产av无码专区亚洲av桃花庵| 亚洲国产成人久久综合碰| 亚洲国产一区视频| 亚洲精品无码久久一线| 国产AV无码专区亚洲精品| 亚洲中文字幕无码av在线| 亚洲国产成人AV在线播放| ssswww日本免费网站片| 久久免费美女视频| 免费三级毛片电影片| 日批日出水久久亚洲精品tv| 亚洲国产一区二区三区青草影视| 亚洲字幕在线观看| 又长又大又粗又硬3p免费视频| 七色永久性tv网站免费看| 国产精品成人四虎免费视频| 国产成A人亚洲精V品无码性色| 国产成人精品亚洲日本在线| 国产日韩精品无码区免费专区国产 | 免费看黄的成人APP| 女人张开腿给人桶免费视频| 亚洲精品成人无限看| 国产区图片区小说区亚洲区| 国产精品久久久久免费a∨ | 狼群影院在线观看免费观看直播| 啦啦啦中文在线观看电视剧免费版| 国产亚洲婷婷香蕉久久精品 | 久久久无码精品亚洲日韩京东传媒 | www亚洲精品少妇裸乳一区二区 | 久久精品国产精品亚洲精品| 一区二区三区免费视频播放器|