Java Reference
In-Depth Information
 
java.sql.ResultSet. The ResultSet object controls access to the results of a given Statement in a
structure that can be traversed by moving a cursor and from which data can be accessed using a
family of getter methods.
The DriverManager
The java.sql.DriverManager provides basic services fo r managing JDBC drivers.
During initialization, the DriverManager attempts to load the driver classes referenced
in the "jdbc.drivers" system property. Alternatively, a program can explicitly load
JDBC drivers at any time using Class.forName(). This allows a user to customize the
JDBC drivers their applications use.
A newly loaded driver class should call registerDriver() to make itself known to the
DriverManager. Usually, the driver does this internally.
When getConnection() is called, the DriverManager a ttempts to locate a suitable
driver from among those loaded at initialization and those loaded explicitly using the
same classloader as the current applet or application. It does this by polling all
registered drivers, passing the URL of the database to the drivers' acceptsURL()
method.
There are three forms of the getConnection() method, allowing the user to pass
additional arguments in addition to the URL of the database:
public static synchronized Connection getConnection(String url) throws
SQLException
public static synchronized Connection getConnection(String url,
String user,
String password)
throws SQLException
public static synchronized Connection getConnection(String url,
Properties info)
throws SQLException
When searching for a driver, JDBC uses the first driver it finds that can
successfully connect to the given URL. It starts with the drivers specified
in the sql.drivers list, in the order given. It then tries the loaded drivers in
the order in which they are loaded.
Note
JDBC drivers
To connect with individual databases, JDBC requires a driver for each database.
JDBC drivers come i n these four basic varieties.
 
Types 1 and 2 are intended for programmers writing applications.
Search WWH ::




Custom Search