|
Build 1.0_r1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.sql.DriverManager
public class DriverManager
Provides facilities for managing JDBC Drivers.
The DriverManager class will load JDBC drivers during its initialization, from the list of drivers referenced by the System Property "jdbc.drivers".
| Method Summary | |
|---|---|
static void |
deregisterDriver(Driver driver)
Removes a driver from the DriverManager's registered driver list. |
static Connection |
getConnection(String url)
Attempts to establish a connection to the given database URL. |
static Connection |
getConnection(String url,
Properties info)
Attempts to establish a connection to the given database URL. |
static Connection |
getConnection(String url,
String user,
String password)
Attempts to establish a connection to the given database URL. |
static Driver |
getDriver(String url)
Tries to find a driver that can interpret the supplied URL. |
static Enumeration |
getDrivers()
Returns an Enumeration that contains all of the loaded JDBC drivers that the current caller can access. |
static int |
getLoginTimeout()
Returns the login timeout when connecting to a database, in seconds. |
static PrintStream |
getLogStream()
This method is deprecated. |
static PrintWriter |
getLogWriter()
Retrieves the log writer. |
static void |
println(String message)
Prints a message to the current JDBC log stream. |
static void |
registerDriver(Driver driver)
Registers a given JDBC driver with the DriverManager. |
static void |
setLoginTimeout(int seconds)
Set the login timeout when connecting to a database, in seconds. |
static void |
setLogStream(PrintStream out)
This method is deprecated. |
static void |
setLogWriter(PrintWriter out)
Sets the PrintWriter that will be used by all loaded drivers, and also the DriverManager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void deregisterDriver(Driver driver)
throws SQLException
If the removal succeeds, the DriverManager will not in future use this driver when asked to get a Connection.
SQLException - if there is an exception accessing the database.
public static Connection getConnection(String url)
throws SQLException
url - a URL string representing the database target to connect with
SQLException - if there is an error while attempting to connect to the
database identified by the URL
public static Connection getConnection(String url,
Properties info)
throws SQLException
url - a URL string representing the database target to connect withinfo - a set of Properties to use as arguments to set up the
connection. Properties are arbitrary string/value pairs.
Normally, at least the properties "user" and "password" should
be passed, with appropriate settings for the userid and its
corresponding password to get access to the database
concerned.
SQLException - if there is an error while attempting to connect to the
database identified by the URL
public static Connection getConnection(String url,
String user,
String password)
throws SQLException
url - a URL string representing the database target to connect withuser - a userid used to login to the databasepassword - a password for the userid to login to the database
SQLException - if there is an error while attempting to connect to the
database identified by the URL
public static Driver getDriver(String url)
throws SQLException
url - the URL of a database
SQLException - if there is any kind of Database Access problempublic static Enumeration getDrivers()
public static int getLoginTimeout()
public static PrintStream getLogStream()
This method is deprecated. Gets the log PrintStream used by the DriverManager and all the JDBC Drivers.
public static PrintWriter getLogWriter()
public static void println(String message)
message - the message to print to the JDBC log stream
public static void registerDriver(Driver driver)
throws SQLException
A newly loaded JDBC driver class should register itself with the DriverManager by calling this method.
driver - the Driver to register with the DriverManager
SQLException - if a database access error occurs.public static void setLoginTimeout(int seconds)
seconds - seconds until timeout. 0 indicates wait forever.public static void setLogStream(PrintStream out)
This method is deprecated. Sets the Print Stream to use for logging data from the DriverManager and the JDBC drivers.
Use setLogWriter(PrintWriter) instead.
out - the PrintStream to use for logging.public static void setLogWriter(PrintWriter out)
out - the PrintWriter to be used
|
Build 1.0_r1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||