- JDBC 4.0 and Oracle JDeveloper for J2EE Development
- Deepak Vohra
- 183字
- 2021-08-25 18:08:44
DriverManager Class
The DriverManager
class is used to obtain a connection with a database. A JDBC driver is required to be loaded before obtaining a connection with the database. In JDBC 3.0, a JDBC driver can be loaded either by specifying it in the jdbc.drivers
system property, or by using the Class.forName()
method. We require invoking the Class.forName()
method by loading the Oracle JDBC driver, oracle.jdbc.OracleDriver
, using JDBC 3.0.
Class.forName("oracle.jdbc.OracleDriver");
In JDBC 4.0 specifications, the DriverManager
class has added support to getConnection()
and getDrivers()
methods, for the Java SE (Service Provider) mechanism. By using these methods, JDBC drivers may be loaded automatically. The Class.forName()
method is not required to be invoked. Loading drivers using the Java SE Service Provider mechanism will be discussed in the Automatic SQL Driver Loading section.
A JDBC connection is represented by a java.sql.Connection
object, and may be obtained from a DriverManager
by calling the overloaded static getConnection()
methods. The getConnection()
method is listed in following table:

For example, a connection with the Oracle database may be obtained as shown below:
String url="jdbc:oracle:thin:@localhost:1521:ORCL"; Connection connection = DriverManager.getConnection(url, "oe", "pw");
- AI繪畫教程:Midjourney使用方法與技巧從入門到精通
- Beginning Swift
- 從零開始:AutoCAD 2015中文版機械制圖基礎培訓教程
- Drools規則引擎技術指南
- Oracle VM Manager 2.1.2
- AI圖像處理:Photoshop+Firefly后期處理技術基礎與實戰
- BlackBerry Enterprise Server 5 Implementation Guide
- Photoshop+CorelDRAW 字體設計與創意:草圖/實現/包裝(微課版)
- Choosing an Open Source CMS: Beginner's Guide
- 修片有道:PHOTOSHOP攝影后期專業技法
- 原片蛻變:Photoshop CC商業修圖必修課
- 電腦寫作與定制五筆(第2版)
- 中文版Photoshop CS5基礎培訓教程(移動學習版)
- AutoCAD 2016從入門到精通
- Hello HarmonyOS!:鴻蒙應用開發從入門到精通