国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|

服務器之家 - 編程語言 - JAVA教程 - Java連接六類數(shù)據(jù)庫技巧全攻略

Java連接六類數(shù)據(jù)庫技巧全攻略

2020-01-04 17:16lijiao JAVA教程

本文主要為大家介紹了Java與Oracle、DB2、Sql Server、Sybase、MySQL、PostgreSQL等數(shù)據(jù)庫連接的方法。

小編在本文將主要為大家介紹Java與Oracle、DB2、Sql Server、Sybase、MySQL、PostgreSQL等數(shù)據(jù)庫連接的方法。

1、Oracle數(shù)據(jù)庫

?
1
2
3
4
5
6
7
8
9
10
11
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
 
String url="jdbc:oracle:thin:@localhost:1521:orcl";
 
//orcl為數(shù)據(jù)庫的SID
 
String user="test";
 
String password="test";
 
Connection conn= DriverManager.getConnection(url,user,password);  

2、DB2數(shù)據(jù)庫

?
1
2
3
4
5
6
7
8
9
10
11
Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
 
String url="jdbc:db2://localhost:5000/sample";
 
//sample為你的數(shù)據(jù)庫名
 
String user="admin";
 
String password="";
 
Connection conn= DriverManager.getConnection(url,user,password);

 3、Sql Server數(shù)據(jù)庫

?
1
2
3
4
5
6
7
8
9
10
11
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
 
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";
 
//mydb為數(shù)據(jù)庫
 
String user="sa";
 
String password="";
 
Connection conn= DriverManager.getConnection(url,user,password);

 4、Sybase數(shù)據(jù)庫

?
1
2
3
4
5
6
7
8
9
10
11
12
13
Class.forName("com.sybase.jdbc.SybDriver").newInstance();
 
String url =" jdbc:sybase:Tds:localhost:5007/myDB";
 
//myDB為你的數(shù)據(jù)庫名
 
Properties sysProps = System.getProperties();
 
SysProps.put("user","userid");
 
SysProps.put("password","user_password");
 
Connection conn= DriverManager.getConnection(url, SysProps);

5、MySQL數(shù)據(jù)庫

?
1
2
3
4
5
6
7
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
 
String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
 
//myDB為數(shù)據(jù)庫名
 
Connection conn= DriverManager.getConnection(url);

 6、PostgreSQL數(shù)據(jù)庫

?
1
2
3
4
5
6
7
8
9
10
11
Class.forName("org.postgresql.Driver").newInstance();
 
String url ="jdbc:postgresql://localhost/myDB"
 
//myDB為數(shù)據(jù)庫名
 
String user="myuser";
 
String password="mypassword";
 
Connection conn= DriverManager.getConnection(url,user,password);

以上就是Java連接各類數(shù)據(jù)庫的技巧,相信一定會對大家實現(xiàn)java連接數(shù)據(jù)庫有所幫助。

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 国产福利视频 | 91久久精品一区二区二区 | 在线观看黄色电影 | 精品久久ai| 精品久久久99 | 日韩精品一区二区三区免费视频 | 国产一在线 | 久久久久久天堂 | 日韩欧美中文字幕一区二区三区 | 国产三区在线视频 | 国产日产精品一区二区三区四区 | 极品国产在线 | 久久精品一区二区三区四区 | 国产精品尤物在线观看 | 成人精品视频免费 | 日韩午夜 | 亚洲成人免费影院 | 2018天天操| 99青青草 | 视频一区二区三区在线播放 | 亚洲视频一区二区 | 欧美一级高清免费 | 日韩av片在线免费观看 | 欧美2区| 久久久久久久久久久网站 | 91在线 | 亚洲 | 五月婷婷综合激情网 | 一级全黄少妇性色生活片免费 | 综合久久综合久久 | 亚洲国产成人精品女人久久久 | 天天澡天天狠天天天做 | 日韩一区二区三区四区 | 日韩成人在线一区 | 欧美日韩视频在线观看免费 | av中文字幕在线观看 | 国产精品久久久久久 | 国产精品乱码久久 | 亚洲精品成人 | 久久久久久久久久久久国产 | 亚洲精品乱码 | 九色在线|