Name

DriverManager

Synopsis

The DriverManager class is responsible for loading JDBC drivers and creating Connection objects. It starts by loading all of the drivers specified in the jdbc.drivers system property. Individual drivers can also be loaded by calling Class.forName() with the driver class name.

Programs use the static DriverManager.getConnection() method to create individual database connections. The driver manager creates the Connection using the appropriate driver, based on the JDBC URL specified in the call to getConnection().

public class DriverManager {
// No Constructor
                  // Public Class Methods
   public static void deregisterDriver(                          // synchronized
        Driver driver) throws SQLException;  
   public static java.sql.Connection getConnection(              // synchronized
        String url) throws SQLException;  
   public static java.sql.Connection getConnection(String url,   // synchronized
        java.util.Properties info) throws SQLException;  
   public static java.sql.Connection getConnection(String url,   // synchronized
        String user, String password) throws SQLException;  
   public static Driver getDriver(                               // synchronized
        String url) throws SQLException;  
   public static java.util.Enumeration getDrivers();             // synchronized
   public static int getLoginTimeout();  
   public static PrintWriter getLogWriter();                     // 1.2

   public static void println( String message);  
   public static void registerDriver(                            // synchronized
        Driver driver) throws SQLException;  
   public static void setLoginTimeout( int seconds);  
   public static void setLogWriter( PrintWriter ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.