How will you determine which driver is connected to the database

Can u give correct answer for this....!

Showing Answers 1 - 6 of 6 Answers

Nitesh Gupta

  • Sep 10th, 2007
 

Through Method

DriverManger.getDriver(url)  you will get the driver name.

  Was this answer useful?  Yes

public static Enumeration getDrivers() method in java.sql.DriverManager class will do this for us.

Some more useful information below:
public class DriverManager is the basic service for managing a set of JDBC drivers. As part of its initialization, the DriverManager class will attempt to load the driver classes referenced. A program can also explicitly load JDBC drivers at any time. For example, the my.sql.Driver is loaded with the following statement: 

 Class.forName("my.sql.Driver");

This allows a user to customize the JDBC Drivers used by their applicationsWhen the method getConnection is called, the DriverManager will attempt to locate a suitable driver from amongst those loaded atinitialization and those loaded explicitly using the same classloader.

Thanks,
Vinay

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions