DriverManager.getConnection

DriverManager.getConnection

Class Overview | Class Members | This Package | All Packages

Syntax 1
public static synchronized Connection getConnection( String url, Properties info ) throws SQLException
Parameters
url
a database url of the form jdbc:subprotocol:subname
info
a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included
Returns
a Connection to the URL
Description
Attempt to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Exceptions
SQLException if a database-access error occurs.



Syntax 2
public static synchronized Connection getConnection( String url, String user, String password ) throws SQLException
Parameters
url
a database url of the form jdbc:subprotocol:subname
user
the database user on whose behalf the Connection is being made
password
the user's password
Returns
a Connection to the URL
Description
Attempt to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Exceptions
SQLException if a database-access error occurs.



Syntax 3
public static synchronized Connection getConnection( String url ) throws SQLException
Parameters
url
a database url of the form jdbc:subprotocol:subname
Returns
a Connection to the URL
Description
Attempt to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Exceptions
SQLException if a database-access error occurs.