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

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

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

    神秘的 J2ee 殿堂

    ·古之學者必有師·做學者亦要做師者·FIGHTING·

    連接各種數據庫方式速查表

    連接各種數據庫方式速查表

    下面羅列了各種數據庫使用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&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數據庫直連用ODBC的

    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() ;
    《轉》

    posted on 2008-04-25 16:07 月芽兒 閱讀(235) 評論(0)  編輯  收藏 所屬分類: J2EE學習摘錄

    導航

    統計

    常用鏈接

    留言簿(2)

    隨筆分類

    隨筆檔案

    相冊

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 成人黄色免费网站| 一级毛片成人免费看a| 久久精品a亚洲国产v高清不卡| 亚洲人AV永久一区二区三区久久| 免费va人成视频网站全| 国产大片免费观看中文字幕| 精品久久免费视频| 在线免费观看韩国a视频| 国产精品美女自在线观看免费| 日本无卡码免费一区二区三区| 国产精品无码免费视频二三区| 在线观看永久免费视频网站| 又粗又硬免费毛片| 色久悠悠婷婷综合在线亚洲| 亚洲无人区午夜福利码高清完整版| 亚洲无线观看国产精品| 亚洲国产精品不卡在线电影| 亚洲综合综合在线| 亚洲Av无码一区二区二三区| 亚洲欧美日韩综合俺去了| 精品国产亚洲AV麻豆| 一区二区三区免费视频网站| 国产在线观看免费av站| 99热这里只有精品6免费| 999国内精品永久免费观看| 免费观看的毛片手机视频| 免费国产一级特黄久久| 区久久AAA片69亚洲| 久久夜色精品国产嚕嚕亚洲av| 亚洲色图校园春色| 亚洲色偷偷综合亚洲AV伊人蜜桃 | a级毛片视频免费观看| 99爱免费观看视频在线| 成全影视免费观看大全二| 免费人妻av无码专区| 亚洲s色大片在线观看| 国产成人精品日本亚洲网址| 免费人成再在线观看网站| a级片免费在线播放| 成人免费午夜无码视频| 亚洲国产成人久久笫一页|