Using the DriverManager to Get a Connection
Go Up to Opening a Database Connection
When you want to access a database, you can get a java.sql.Connection object from the JDBC management layer's java.sql.DriverManager.getConnection() method. The getConnection() method takes a URL string and a java.util.Properties object as arguments. For each connection request, the DriverManager uses the URL to locate a driver that can connect to the database represented by the URL. If the connection is successful, a java.sql.Connection object is returned. The following example shows the syntax for establishing a database connection:
java.sql.Connection connection = java.sql.DriverManager.getConnection (url,properties);
The Connection object in turn provides access to all of the InterClient classes and methods that allow you to execute SQL statements and get back the results.