日期:2014-05-16  浏览次数:20520 次

连接各种数据库的sql语句

1.?????? mysql

driver = com.mysql.jdbc.Driver

url = jdbc:mysql://127.0.0.1:3306/db_name

username = root??

password = zxw1001??

?

2.??? oracle

driver = oracle.jdbc.driver.OracleDriver

url = jdbc:oracle:thin:@localhost:1521: db_name

username = scott??

password = zxw1001??

?

3.??? sqlserver

driver = com.microsoft.sqlserver.jdbc.SQLServerDriver

url = jdbc:sqlserver://localhost:1433;DatabaseName=db_name

username = e2qoa_v3

password = zxw1001

?

4.DB2

driver =com.ibm.db2.jdbc.net.DB2.Driver

url =jdbc:db2://localhost:5000/db_name

username =username

password =password

???

Class.forName(Driver)??

Connection con=DriverManager.getConnection(url, username, password)