<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

    主站蜘蛛池模板: 美女视频黄频a免费| 亚洲AV无码成人专区| 一级毛片a免费播放王色电影 | 无码av免费网站| 亚洲AV无码乱码在线观看裸奔| 亚洲成av人片天堂网老年人| 亚洲中文字幕无码亚洲成A人片| 免费A级毛片无码无遮挡内射| 亚洲欧洲日韩国产一区二区三区| 一个人免费播放在线视频看片| 亚洲国产日韩在线观频| 国产免费福利体检区久久| 最新国产AV无码专区亚洲| 青柠影视在线观看免费高清| 亚洲国产成人高清在线观看| 99久热只有精品视频免费看| 亚洲人成电影青青在线播放| 成年人视频在线观看免费| 精品久久久久久亚洲中文字幕| 亚洲人成色77777在线观看大| 精品国产污污免费网站| 亚洲男人电影天堂| 永久免费观看的毛片的网站| 老司机午夜性生免费福利| 国产gv天堂亚洲国产gv刚刚碰 | 1000部啪啪毛片免费看| 国产亚洲精品VA片在线播放| 免费一级肉体全黄毛片| 精品乱子伦一区二区三区高清免费播放| 人人狠狠综合久久亚洲婷婷| 免费三级毛片电影片| 国产成人亚洲毛片| 国产亚洲人成无码网在线观看| 美女内射毛片在线看免费人动物| 亚洲日本va一区二区三区| 中文字幕亚洲乱码熟女一区二区| 麻豆亚洲AV永久无码精品久久| 亚洲AV无码之国产精品| 国产无遮挡无码视频免费软件| 亚洲精品乱码久久久久久下载| 国产色爽免费视频|