Module java.sql
Package java.sql

Class DriverManager

java.lang.Object
java.sql.DriverManager

public class DriverManager extends Object
The basic service for managing a set of JDBC drivers.

NOTE: The DataSource interface, provides another way to connect to a data source. The use of a DataSource object is the preferred means of connecting to a data source.

As part of its initialization, the DriverManager class will attempt to load available JDBC drivers by using:

  • The jdbc.drivers system property which contains a colon separated list of fully qualified class names of JDBC drivers. Each driver is loaded using the system class loader:
    • jdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver
  • Service providers of the java.sql.Driver class, that are loaded via the service-provider loading mechanism.

Implementation Note:
DriverManager initialization is done lazily and looks up service providers using the thread context class loader. The drivers loaded and available to an application will depend on the thread context class loader of the thread that triggers driver initialization by DriverManager.

When the method getConnection is called, the DriverManager will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same class loader as the current application.

Since:
1.1
See Also: