Java examples for JDBC:Driver
Getting the Driver of a Connection
import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public void main(String[] argv) { try {//from w w w. j a va2 s .c om Connection connection = null; DatabaseMetaData dmd = connection.getMetaData(); String driverName = dmd.getDriverName(); // Create connection from URL String url = null, username = null, password = null; Connection conn = DriverManager.getConnection(url, username, password); // Get driver from URL Driver driver = DriverManager.getDriver(url); } catch (SQLException e) { } } }