- 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");
- 創(chuàng)意UI:Photoshop玩轉(zhuǎn)移動UI設(shè)計
- Photoshop 2022從入門到精通
- AutoCAD Civil 3D 2018 場地設(shè)計實例教程
- 中文版Rhino 5.0完全自學(xué)教程(第3版)
- iPhone User Interface Cookbook
- Puppet權(quán)威指南
- 虛擬現(xiàn)實:沉浸于VR夢境
- Power Query For Excel:讓工作化繁為簡
- Photoshop+CorelDRAW 字體設(shè)計與創(chuàng)意:草圖/實現(xiàn)/包裝(微課版)
- IBM Lotus Notes and Domino 8.5.1
- PPT設(shè)計與制作實戰(zhàn)教程
- 剪映:從零開始精通短視頻剪輯(電腦版)
- Photoshop CS6淘寶美工完全實例教程(培訓(xùn)教材版)
- Photoshop CG 古風(fēng)插畫繪制技法精解
- 中文版SolidWorks 2016完全實戰(zhàn)技術(shù)手冊