GeezerVison is showing docs.oracle.com — DriverManager (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
- Summary:
- Nested |
- Field |
- Constr |
- Method
- Detail:
- Field |
- Constr |
- Method
compact2, compact3
java.sql
Class DriverManager
-
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getLogWriter
public static PrintWriter getLogWriter()
Retrieves the log writer.
The getLogWriter and setLogWriter
methods should be used instead
of the get/setlogStream methods, which are deprecated.
- Returns:
- a
java.io.PrintWriter object
- Since:
- 1.2
- See Also:
setLogWriter(java.io.PrintWriter)
-
getConnection
public static Connection getConnection(String url)
throws SQLException
Attempts to establish a connection to the given database URL.
The DriverManager attempts to select an appropriate driver from
the set of registered JDBC drivers.
- Parameters:
url - a database url of the form
jdbc:subprotocol:subname
- Returns:
- a connection to the URL
- Throws:
SQLException - if a database access error occurs or the url is
null
SQLTimeoutException - when the driver has determined that the
timeout value specified by the setLoginTimeout method
has been exceeded and has at least tried to cancel the
current database connection attempt
-
getDriver
public static Driver getDriver(String url)
throws SQLException
Attempts to locate a driver that understands the given URL.
The DriverManager attempts to select an appropriate driver from
the set of registered JDBC drivers.
- Parameters:
url - a database URL of the form
jdbc:subprotocol:subname
- Returns:
- a
Driver object representing a driver
that can connect to the given URL
- Throws:
SQLException - if a database access error occurs
-
registerDriver
public static void registerDriver(Driver driver)
throws SQLException
Registers the given driver with the DriverManager.
A newly-loaded driver class should call
the method registerDriver to make itself
known to the DriverManager. If the driver is currently
registered, no action is taken.
- Parameters:
driver - the new JDBC Driver that is to be registered with the
DriverManager
- Throws:
SQLException - if a database access error occurs
NullPointerException - if driver is null
-
registerDriver
public static void registerDriver(Driver driver,
DriverAction da)
throws SQLException
Registers the given driver with the DriverManager.
A newly-loaded driver class should call
the method registerDriver to make itself
known to the DriverManager. If the driver is currently
registered, no action is taken.
- Parameters:
driver - the new JDBC Driver that is to be registered with the
DriverManager
da - the DriverAction implementation to be used when
DriverManager#deregisterDriver is called
- Throws:
SQLException - if a database access error occurs
NullPointerException - if driver is null
- Since:
- 1.8
-
getLogStream
@Deprecated
public static PrintStream getLogStream()
Deprecated. Use getLogWriter
Retrieves the logging/tracing PrintStream that is used by the DriverManager
and all drivers.
- Returns:
- the logging/tracing PrintStream; if disabled, is
null
- See Also:
setLogStream(java.io.PrintStream)
Java™ Platform Standard Ed. 8
- Summary:
- Nested |
- Field |
- Constr |
- Method
- Detail:
- Field |
- Constr |
- Method
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|