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

JAVA中十六种主流数据库的JDBC连接字符串

JAVA中十六种主流数据库的JDBC连接字符串,方便大家查询。

1.?Microsoft?SQLServer(http://www.microsoft.com)

????????(SqlServer?2000)
????????????Class.forName(?"com.microsoft.jdbc.sqlserver.SQLServerDriver"?);
????????????cn?=?DriverManager.getConnection(?"jdbc:microsoft:sqlserver://localhost:1433;databaseName=pubs",?sUsr,?sPwd?);

????????(SqlServer?2005)
????????????Class.forName(?"com.microsoft.sqlserver.jdbc.SQLServerDriver"?);
????????????cn?=?DriverManager.getConnection(?"jdbc:sqlserver://localhost:1433;databaseName=pubs",?sUsr,?sPwd?);
项目开发流程详解:http://zz563143188.iteye.com/blog/1825168?

2.?Oracle(http://www.oracle.com/ip/deploy/database/oracle9i/)classes12.zip
????????Class.forName(?"oracle.jdbc.driver.OracleDriver"?);
????????cn?=?DriverManager.getConnection(?"jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL",?sUsr,?sPwd?);
????????
3.?MySQL(http://www.mysql.com)mm.mysql-2.0.2-bin.jar
????????Class.forName(?"org.gjt.mm.mysql.Driver"?);
????????cn?=?DriverManager.getConnection(?"jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName",?sUsr,?sPwd?);

4.?PostgreSQL(http://www.de.postgresql.org)