【文件属性】:
文件名称:JDBC 数据库常用连接链接字符串
文件大小:2KB
文件格式:TXT
更新时间:2014-07-01 12:10:01
JDBC 数据库常用连接链接字符串 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);