DriverManager
Hi Friends
What is DriverManager?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 29, 2012, 1:25 AM EST
Satyapriya NayakRank #47 · 31.5K reputationPosted Nov 29, 2012, 1:38 AM EST
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.
http://geekexplains.blogspot.in/2008/05/role-of-drivermanager-class-and-driver.html
http://www.java-samples.com/showtutorial.php?tutorialid=632
http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/DriverManager.html