top button
Flag Notify
Site Registration

What is the role of JDBC DriverManager class?

0 votes
190 views
What is the role of JDBC DriverManager class?
posted Jan 13, 2016 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

DriverManager class

It's used for establishing JDBC connections and for managing JDBC drivers. JDBC 2.0 API has a new interface DataSource and the preferred means of connecting to a data source has now become by using a DataSource object.

DriverManager tries to load the driver classes mentioned in the 'jdbc.drivers' system property while the initialization. You can explicitly load JDBC drivers at any time by using the 'Class.forName("driver class");' syntax.

getConnection method of the DriverManager class tries to locate a suitable driver from amongst those loaded either during the initialization or by using Class.forName() explicitly. On successful invocation, this method returns a Connection object. You need to specify the database url having the subprotocol & subname, user id, password, etc. If any error occours during the database access then a SQLException is thrown.

answer Jan 19, 2016 by Shivaranjini
Similar Questions
+3 votes

Which JDBC Driver class is used by ojdbc14.jar(Oracle11g) and jconn-7.0 jar(Sybase ASE 15.7) ?
As we know there are 4 different types of JDBC Driver types are present, such as

  1. JDBC-ODBC Bridge Driver
  2. Native-API Driver
  3. Network Protocol Driver
  4. Thin Driver
+2 votes

I declared a variable and incremented/modified it inside Mapper class. Now I need to use the modified value of that variable in Driver class. I declared a static variable inside Mapper class and its modified value works in Driver class when I run the code in Eclipse IDE. But after creating that code as a runable jar from Eclipse and run jar file as “$ hadoop jar filename.jar input output” modified value does not reflect (value is 0) in Driver class.

...