adspace


I need to know the driver name associated with the DSN ?
In java we can get it by using getDriverName()(implemented
by 3rd party vendors.) method ?
but i need the implemetation to get the driver name?
so can u give me the code ? how to get the code ?

Answer Posted / Shobhit Jain

To obtain the JDBC driver name, you can use the java.sql.DriverManager class's getDriver() method. However, keep in mind that each database vendor provides its own specific JDBC driver with a unique implementation of the Driver interface. Here is an example using the MySQL JDBC driver:nn// Load the drivernClass.forName("com.mysql.jdbc.Driver");nn// Get a connectionnString url = "jdbc:mysql://localhost/mydb";nString user = "myusername";nString password = "mypassword";nConnection conn = DriverManager.getConnection(url, user, password);nn// Retrieve the driver namenDriver driver = conn.getDriver();nString driverName = driver.getClass().getName();

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is your most recent experience with VERTAS backup software?

2180


1. What ports does FTP traffic travel over? 2. What ports does mail traffic utilize? 3. What ports do HTTP and HTTPS use? 4. Why is NTP required in an NFS network? 5. Name some common mal software on the server side 6. What is CPAN? How do you access it? 7. What is PEAR? 8. What advantages does mod_perl have over a perl CGI? 9. What is required to do SSL in Apache 1.x? 10. What is Tcl? 11. What is a servlet engine/container? 12. What is BIND? 13. Name the steps to setup a slave zone in BIND 14. Name the steps to setup a primary zone in BIND 15. What commands would you use under Solaris or Linux to modify/view an LDAP tree?

2841


What do you understand by the term ‘structured cabling’. State the main rules that should be used when installing a cable. 31. Show that maximum cabling area for LAN for horizontal cabling runs is approximately 200m.

1712