【从API学英语】-DriverManager
原文:
The basic service for managing a set of JDBC drivers.
NOTE: The DataSource interface, new in the JDBC 2.0 API, provides another way to connect to a data source. The use of a DataSource object is the preferred means of connecting to a data source. As part of its initialization, the DriverManager class will attempt to load the driver classes referenced in the "jdbc.drivers" system property. This allows a user to customize the JDBC Drivers used by their applications. For example in your ~/.hotjava/properties file you might specify: jdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver
The DriverManager methods getConnection and getDrivers have been enhanced to support the Java Standard Edition Service Provider mechanism. JDBC 4.0 Drivers must include the file META-INF/services/java.sql.Driver. This file contains the name of the JDBC drivers implementation of java.sql.Driver. For example, to load the my.sql.Driver class, the META-INF/services/java.sql.Driver file would contain the entry: my.sql.Driver
Applications no longer need to explictly load JDBC drivers using Class.forName(). Existing programs which currently load JDBC drivers using Class.forName() will continue to work without modification. When the method getConnection is called, the DriverManager will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application. Starting with the Java 2 SDK, Standard Edition, version 1.3, a logging stream can be set only if the proper permission has been granted. Normally this will be done with the tool PolicyTool, which can be used to grant permission java.sql.SQLPermission "setLog".
翻译:
用来管理一组JDBC驱动的基础服务 备注:DataSource接口(这个接口是在JDBC2.0之后新出现的)提供了另一种连接数据源的方式。使用DataSource接口是首选连接到数据源的方式。 作为初始化的一部分,DriverManager类将尝试加载驱动类(这些类引用“jdbc.driver”系统属性)。这允许使用者定制被他们JDBC驱动(这些去掉给他们自己应用程序使用的)。 DriverManger中的方法getConnection和getDrivers已经被增强了用来支持Java SE。JDBC4.0驱动必须包含文件META-INF/services/java.sql.Driver。这个文件包含实现java.sql.Driver的JDBC驱动。 应用程序不再需要显示的加载JDBC驱动(通过使用Class.forName()),现在使用Class.forName()加载JDBC驱动的现有程序将继续保持没有修改。 当getConnectioin()被调用时,DriverManger将会尝试找到一个合适的驱动(从所有这些已经加载的初始化和显示的使用相同classloader作为当前applet或者应用程序) 从Java2 SDK SE 1.3开始,一个日志流可以被设置(只有在合适的权限已经被认证)。正常情况下这些由会PolicyTool处理,它常常被用来认证权限
【从API学英语】-DriverManager的更多相关文章
- 【从API学英语】-PreparedStatement
原文 An object that represents a precompiled SQL statement. A SQL statement is precompiled and stored ...
- Effective Java
Effective Java 创建和销毁对象---考虑用静态工厂方法代替构造器 构造器是创建一个对象实例最基本也最通用的方法,大部分开发者在使用某个class的时候,首先需要考虑的就是如何构造和初始化 ...
- JavaEE系列之(三)JDBC操作MySQL数据库
一.JDBC简介 JDBC(Java Data Base Connectivity)java数据库连接 SUN公司为了简化.统一对数据库的操作,定义了一套Java操作数据库 ...
- [Java] 一、对象的创建 & 销毁
*1.考虑静态工厂方法(static factory method)代替构造器?!优势?不足? 服务提供者架构: 1.服务接口(Service Interface) -- 提供者实现的: 2.提供者注 ...
- Effective Java 第三版——1. 考虑使用静态工厂方法替代构造方法
Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...
- 【JDBC】Java 连接 MySQL 基本过程以及封装数据库工具类
一. 常用的JDBC API 1. DriverManager类 : 数据库管理类,用于管理一组JDBC驱动程序的基本服务.应用程序和数据库之间可以通过此类建立连接.常用的静态方法如下 static ...
- JDBC数据库连接简介(一)
jdbc的由来 odbc(open database connection) 最初各个数据库比如mysql和oracle等,虽然都支持sql,但是他们的连接方式是不一样的,需要按照相应的api来编写不 ...
- Java连接数据库 #01# JDBC单线程适用
官方教程(包括 javase的基础部分):JDBC Basics 重新梳理.学习一下“Java连接数据库”相关的内容. 因为最开始没有认真学多线程和JDBC,一直在自己写的多线程程序中维持下面的错误写 ...
- JSP开发Web应用系统
1.动态网站开发基础 1-1:动态网页 a.为什么需要动态网页(当我们需要修改网页内容的时候,都要重新上传一次覆盖原来的页面.而且,制作必须要通过专用的网页制作工具,比如:Dreamweaver.Fr ...
随机推荐
- IOS 基础-define、const、extern、全局变量
这里介绍一下define.const.extern的用法.优劣以及要注意的地方. 1.define 宏define是定义一个变量,没有类型信息.define定义的常量在内存中有若干个拷贝. defin ...
- UStore-自定义JDF文件格式输出
系统默认的JDF输出不能满足我们的需求,往往不同的供应商输出不同要求的JDF格式.这里我们开始介绍ustore的自定义JDF输出 1.先屏蔽掉默认的JDF格式输出 我们进入Tigger来设置ustro ...
- Redis教程(十一):虚拟内存介绍:
转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/138.html 一.简介: 和大多NoSQL数据库一样,Redis同样遵循 ...
- C#并行编程-相关概念
菜鸟初步学习,不对的地方请大神指教,参考<C#并行编程高级教程.pdf> 目录 C#并行编程-相关概念 C#并行编程-Parallel C#并行编程-Task C#并行编程-并发集合 C# ...
- Java面试(1)-- Java赋值表达式
1 class Demo01{ 2 public static void main(String[] args){ 3 //赋值运算符 = 4 5 //例1 6 int a = 1; 7 System ...
- Python下划线与命名规范
Python下划线与命名规范 先看结论,节省只想知道答案你的宝贵时间: _xxx 不能用于from module import * 以单下划线开头的表示的是protected类型的变量.即保护类型只能 ...
- CSS3 transform 属性详解(skew, rotate, translate, scale)
写这篇文章是因为在一个前端QQ群里,网友 "小豆豆" (应他要求要出现他的网名......) ,问skew的角度怎么算,因为他看了很多文章还是不能理解skew的原理.于是,我觉得有 ...
- CSS两列高度自适应,右边自适应
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- CSS中的::after ::before
利用::after和before来清除浮动 <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- Unity3D 常用插件
1.FX Maker FX Maker是一款制作特效的工具,它专为移动操作系统做了优化.FX Maker包括300种Prefab特效,300种纹理结构.100种网格.100种曲线效果.支持英文和韩文, ...