SE452: Loading a JDBC Driver [6/12] Previous pageContentsNext page

Need to know the driver Class name

The java.sql.DriverManager is responsible for loading the Driver files in memory. It uses the jdbc.drivers system property to load Driver classes.

Or, use Class.forName() at any time to load dynamically: Class.forName("my.sql.Driver");

Drivers can also be managed by the implementation of the javax.sql.DataSource interface via JNDI. This is the preferred method for obtaining connections to a JDBC data source. We'll talk about this in a minute.

Getting a connection:


        DriverManager.getConnection(url)
        DriverManager.getConnection(url, username, password)
        

All DriverManager methods are declared static.

Previous pageContentsNext page