- 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");
- Procreate插畫入門必修課
- 虛擬現實:開啟現實與夢想之門
- Software Testing using Visual Studio 2010
- Microsoft BizTalk Server 2010 Patterns
- InDesign平面設計案例教程:從設計到印刷
- Photoshop CS6中文版從入門到精通(核心技法卷):摳圖、修圖、Camera Raw、調色、銳化、合成
- SOLIDWORKS Visualize 實例詳解(微視頻版)
- Photoshop數碼攝影后期處理技法從入門到精通
- Flash基礎與實戰教程
- CAXA電子圖板2016基礎與實例教程
- Backbone.js Cookbook
- 機械CAD軟件應用入門指導書
- Quality Assurance for Dynamics AX-Based ERP Solutions
- Photoshop后期強:多重曝光專業技法寶典
- AI繪畫精講:Stable Diffusion從入門到精通