连接数据库的方式
来源:互联网 发布:淘宝怎么能卖出东西 编辑:程序博客网 时间:2024/04/27 20:28
1、Oracle
Class.forName("oracle.jdbc.driver.OracleDriver");
String vurl = "jdbc:oracle:thin:@localhost:1521:dbName";
2、SQL Server2000
第一种方式:
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String vurl = "jdbc:microsoft:sqlserver://localhost:1433;databaseName=walker";
DriverManager.getConnection(vurl,"sa","");
第二种方式: 通过数据源
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String vurl = "jdbc:odbc:dbSourceName";
SQL Server2005直连
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String vurl = "jdbc:sqlserver://数据库实例名:1433;databaseName=数据库";
DriverManager.getConnection(vurl,"sa","");
3、MySQL
Class.forName("com.mysql.jdbc.Driver");//
String vurl = "jdbc:mysql://localhost/dbName";
4、 Access
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String vurl = "jdbc:odbc:datasourceName";
// con = DriverManager.getConnection("jdbc:mysql://localhost/test");//"jdbc:odbc:dsn"
//Connection conn = DriverManager.getConnection(vurl,"","");
//Connection conn =
5、数据源DataSource
Context ctx = new InitialContext();
ds = (javax.sql.DataSource) ctx.lookup("MyDataSource");
con = ds.getConnection();
- 连接数据库的方式
- 数据库的连接方式
- 连接数据库的方式
- 数据库的连接的方式
- JAVA连接数据库的方式
- JAVA连接数据库的方式
- 数据库驱动的连接方式
- 各种数据库的连接方式
- java 连接数据库的方式
- 常用数据库的连接方式
- 各种数据库的连接方式
- jdbc连接数据库的方式
- 连接Access数据库的方式
- JDBC连接数据库的方式
- JAVA连接数据库的方式
- 数据库通用的连接方式
- java连接数据库的方式
- oracle数据库的连接方式
- JAVA中的Map接口介绍
- CSS盒子模型
- 在Windows64位环境下.net访问Oracle解决方案
- Linux系统整体性能监控工具详解
- 详解iOS App生命周期
- 连接数据库的方式
- [java] Java中重要概念简述
- vs c++ Rebuilt 编译时不能生成 .dll文件
- epoll_create & epoll_ctl & epoll_wait Kernel实现 -- Kernel 3.0.8
- linux boot-go_to_protected_mode
- linux boot-protected_mode_jump
- 现场编写类似strstr/strcpy/strpbrk的函数
- Input Core和evdev基本知识 - Kernel3.0.8
- poj 2778 DNA Sequence