SE452: Loading a JDBC Driver [6/12] ![]() ![]() ![]() |
Need to know the driver Class name
sun.jdbc.odbc.JdbcOdbcDriverorg.hsqldb.jdbcDriveroracle.jdbc.driver.OracleDrivercom.microsoft.jdbc.sqlserver.SQLServerDriver
The java.sql.DriverManager is responsible for loading
the Driver files in memory. It uses the jdbc.drivers system property
to load Driver classes.
jdbc.drivers=foo.bah.Driver:wombat.sql.Driver
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.