jdbc链接各种数据库
2008-05-06 21:06
411 查看
1、链接Sqlserver2000
驱动类
com.microsoft.jdbc.sqlserver.SQLServerDriver
连接字符串
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs
(pubs为数据库名,localhost为主机地址,若数据库在远程则为IP地址)
2、链接mysql
驱动类
com.mysql.jdbc.Driver
连接字符串
jdbc:mysql://localhost:3306/pubs
(pubs为数据库名,localhost为主机地址,若数据库在远程则为IP地址)
3、jdbc-odbc桥链接
驱动类
sun.jdbc.odbc.JdbcOdbcDriver
连接字符串
jdbc:odbc:dsnname
(dsnname为odbc数据源的名称)
4、链接Oracle
驱动类:
oracle.jdbc.driver.OracleDriver
链接字符串
jdbc:oracle:thin:@localhost:1521:ora9
(localhost为主机地址,若数据库,在远程则为IP地址其中“1521”为端口,“ora9”为sid )
====================================================================================
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,user,password);
驱动类
com.microsoft.jdbc.sqlserver.SQLServerDriver
连接字符串
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs
(pubs为数据库名,localhost为主机地址,若数据库在远程则为IP地址)
2、链接mysql
驱动类
com.mysql.jdbc.Driver
连接字符串
jdbc:mysql://localhost:3306/pubs
(pubs为数据库名,localhost为主机地址,若数据库在远程则为IP地址)
3、jdbc-odbc桥链接
驱动类
sun.jdbc.odbc.JdbcOdbcDriver
连接字符串
jdbc:odbc:dsnname
(dsnname为odbc数据源的名称)
4、链接Oracle
驱动类:
oracle.jdbc.driver.OracleDriver
链接字符串
jdbc:oracle:thin:@localhost:1521:ora9
(localhost为主机地址,若数据库,在远程则为IP地址其中“1521”为端口,“ora9”为sid )
====================================================================================
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,user,password);
相关文章推荐
- 常用的jdbc各种数据库的链接
- JDBC与各种数据库的链接
- jdbc链接数据库
- JDBC连接各种数据库方法
- jdbc连接各种数据库的方法
- 各种数据库的jdbc驱动下载及连接方式
- JDBC链接数据库的流程
- 各种数据库JDBC驱动
- JDBC加载各种数据库方法和URL
- JDBC连接mysql和各种数据库连接串
- 在jsp中如何有JDBC连接各种数据库之MySQL
- 各种数据库的jdbc连接大全
- 我的JDBC Dao模式链接数据库
- Java JDBC数据库链接
- ASP连接数据库的11种方法——本文总结了使用ASP链接各种数据库的方法
- JDBC连接各种数据库方法
- JDBC连接各种数据库的方式
- JDBC编程-----数据库的链接
- jdbc连接各种数据库方式列表
- jdbc链接数据库mysql