How do you know which driver is connected to a database?

Answer Posted / ramakant

// By the help of DatabaseMetadata it gives all the
information about the date base for which our progrim is
connected
// here it goes

1.Class.forName("DriverClass name");
2.Connection con =driverManager.getConection("URL Of
Manager Class");
DatabaseMetada dmeta= con.getMetadata();
// by calling the method getDriverName() name we can
able to know that which driver is coonected to the database.
3. System.out.println(" driver name " +
dmeta.getDriverName())

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is ojdbc?

530


Which package is used for jdbc application?

512


any one can explain about policy file rule? when i connect database with applet then ther is no compile time error but the run time error is occureed.i.e access is denied.policy file rule is related to this problem.

1842


What is jdbc url for mysql?

588


How the JDBC application works?

530






Which is better jpa or jdbc?

501


What is a datasource in java?

502


What is statement and preparedstatement in java?

490


What is JDBC Statement?

563


State the three different ways in which you can create a table?

516


Does jpa use jdbc?

488


Which type of JDBC driver is the fastest one?

569


Give an example of code used for setting up connection with a driver.

517


If I use the JDBC API, do I have to use ODBC underneath?

602


What are the common tasks of JDBC?

564