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

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

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

    Life is filled with wonder

    Java中10種數據庫的直連方式

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

    8\access數據庫
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
    String url="jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ="+application.getRealPath("/Data/ReportDemo.mdb");
    Connection conn = DriverManager.getConnection(url,"","");
    Statement stmtNew=conn.createStatement() ;

    9\\cloudscape
    Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
    String Url="jdbc:derby:E:/database/luo";
    Connection con=DriverManager.getConnection(Url);
    Statement sta=con.createStatement();

    posted on 2008-01-15 09:29 小屁 閱讀(342) 評論(0)  編輯  收藏 所屬分類: javadatabase


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


    網站導航:
     
    主站蜘蛛池模板: 免费大片黄在线观看| 免费在线观看黄色毛片| 亚洲精品~无码抽插| 亚洲AV无码精品国产成人| 无码区日韩特区永久免费系列| 免费无码又爽又刺激聊天APP| 亚洲精品成人片在线观看精品字幕| 中文字幕亚洲综合久久| 99re6在线视频精品免费| 亚洲精品视频在线看| 亚洲av无码片vr一区二区三区 | 亚洲国产一成久久精品国产成人综合| 亚洲一区二区三区免费视频| 精品免费人成视频app| 亚洲av色福利天堂| 69精品免费视频| 亚洲码在线中文在线观看| 久久久久久国产精品免费免费男同 | 免费国产成人午夜电影| 九九视频高清视频免费观看| 国产aⅴ无码专区亚洲av麻豆| 野花香高清在线观看视频播放免费 | 白白国产永久免费视频| 亚洲国产精品热久久| 99re这里有免费视频精品| 亚洲人6666成人观看| 日本牲交大片免费观看| 国产免费A∨在线播放| 亚洲国产精品热久久| 成全影视免费观看大全二| 一级毛片正片免费视频手机看| 亚洲AV综合色区无码一区爱AV| 97免费人妻无码视频| 亚洲AV日韩AV永久无码色欲| 亚洲中文字幕无码日韩| 国产精品成人免费福利| 国产成人不卡亚洲精品91| 怡红院亚洲怡红院首页| 青青在线久青草免费观看| 又长又大又粗又硬3p免费视频| 亚洲图片一区二区|