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

    隨筆分類

    隨筆檔案

    相冊

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲熟妇丰满多毛XXXX| 国产男女猛烈无遮挡免费视频网站 | 无码免费午夜福利片在线| 亚洲神级电影国语版| 99在线观看免费视频| 97久久精品亚洲中文字幕无码 | 日韩免费观看的一级毛片| 亚洲av无码专区亚洲av不卡| 大学生美女毛片免费视频| 亚洲精品自偷自拍无码| 日本二区免费一片黄2019| 美女黄频免费网站| 亚洲精品成人久久久| 你懂的在线免费观看| 亚洲国产精品人久久| 亚洲精品视频在线免费| 亚洲制服丝袜第一页| 日本免费一本天堂在线| 一边摸一边桶一边脱免费视频| 永久亚洲成a人片777777| 日本免费高清视频| 亚洲六月丁香六月婷婷色伊人| 在线a毛片免费视频观看| 一级做a爰黑人又硬又粗免费看51社区国产精品视 | 永久免费无码网站在线观看 | 丰满亚洲大尺度无码无码专线| 国产在线播放免费| 成人av片无码免费天天看| 久久亚洲精精品中文字幕| 最近免费中文字幕大全| 污网站在线免费观看| 亚洲成AV人片一区二区密柚| 免费能直接在线观看黄的视频| 亚洲日韩精品国产3区| 亚洲午夜久久久影院伊人| 免费A级毛片无码专区| 337P日本欧洲亚洲大胆艺术图 | 亚洲伊人久久精品影院| 我们的2018在线观看免费高清| 高h视频在线免费观看| 亚洲国产人成在线观看69网站|