国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

詳細講解各種數據庫使用JDBC連接的方式

瀏覽:4日期:2024-07-05 14:36:00

下文中羅列了各種數據庫使用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(); //或者Class.forName("com.mysql.jdbc.Driver");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() ;
標簽: JDBC
相關文章:
主站蜘蛛池模板: 麻豆国产 | 成人毛片视频免费网站观看 | 一级毛片免费在线观看网站 | 草草影院国产第一页 | 欧美人与z0z0xxxx| 蝴蝶成人世界第八影院 | 欧美一级毛片欧美一级成人毛片 | 亚洲一区二区三区不卡在线播放 | 国产一区二区久久 | 9久9久女女热精品视频免费观看 | 亚洲人成在线播放网站 | 热e国产 | 亚洲成人7777 | 99er精品| 久久亚洲综合 | 日本道色| 精品国产区一区二区三区在线观看 | 免费视频观看在线www日本 | 精品一精品国产一级毛片 | 成人在线毛片 | 日韩精品福利视频一区二区三区 | 黄毛片一级毛片 | 久久久久国产精品免费 | 久久一二| 在线日韩欧美 | 精品一久久 | 三级视频在线 | 在线播放亚洲视频 | 免费乱人伦 | 在线播放高清国语自产拍免费 | 99在线精品免费视频九九视 | 国产99在线播放 | 国产日韩欧美精品在线 | 精品国产免费一区二区三区 | 男女午夜爱爱久久无遮挡 | 欧美一区二区三区男人的天堂 | 久久综合伊人77777 | 在线看黄网址 | 国产成人一区二区三区在线播放 | 波多野结衣一级视频 | 九九视频在线观看6 |