- JDBC 4.0 and Oracle JDeveloper for J2EE Development
- Deepak Vohra
- 165字
- 2021-08-25 18:08:46
Automatic SQL Driver Loading
JDBC 4.0 has facilitated the loading of a JDBC driver. In JDBC 3.0, a JDBC driver is loaded with the Class.forName(String)
method. The Oracle JDBC driver is loaded in the following manner:
Class.forName("oracle.jdbc.OracleDriver");
In JDBC 4.0, a JDBC driver is loaded automatically with the Java Standard Edition Service Provider mechanism. The JDBC driver is loaded when the java.sql.DriverManager.getConnection()
method is invoked. To load a JDBC driver with the Service Provider mechanism, JDBC 4.0 drivers should include the META-INF/services/java.sql.Driver
file. In the java.sql.Driver
file, specify the JDBC driver class to load. If the oracle.jdbc.OracleDriver
is to be loaded then specify the following line in the java.sql.Driver
file:
oracle.jdbc.OracleDriver
Multiple driver classes can be specified in a java.sql.Driver
file, each on a separate line. A list of JDBC drivers available to a DriverManager
can be obtained with the getDrivers()
method:
Enumeration<Driver> drivers=DriverManager.getDrivers();
A JDBC connection can be obtained using the getConnection()
method of the DriverManager
class:
String url="jdbc:oracle:thin:@localhost:1521:ORCL"; Connection connection = DriverManager.getConnection(url,"oe", "pw");
- Photoshop CS6 商業(yè)應(yīng)用案例實(shí)戰(zhàn)
- 剪映專業(yè)版(電腦版)視頻剪輯全攻略:音效添加+轉(zhuǎn)場特效+視頻制作
- Instant Microsoft SQL Server Analysis Services 2012 Dimensions and Cube
- Ogre 3D 1.7 Beginner's Guide
- Procreate+ SketchUp +Photoshop建筑設(shè)計(jì)手繪表現(xiàn)技法
- 邊做邊學(xué):平面設(shè)計(jì)(Photoshop CS6 +CorelDRAW X6)
- AutoCAD 2016中文版基礎(chǔ)教程(全圖解視頻版)
- Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook
- 中文版Maya 2016基礎(chǔ)培訓(xùn)教程
- Quality Assurance for Dynamics AX-Based ERP Solutions
- LaTeX論文寫作教程
- Oracle Application Express Forms Converter
- Mastering Redis
- 選擇的藝術(shù):Photoshop圖像處理深度剖析(第3版)
- Premiere視頻編輯案例教程:Premiere Pro 2020(微課版·第2版)