IT. Expert System.

Android Reference

DriverManager


java.sql

Class DriverManager



  • public class DriverManager
    extends Object
    Provides facilities for managing JDBC drivers.

    The DriverManager class loads JDBC drivers during its initialization, from the list of drivers referenced by the system property "jdbc.drivers".

    • Method Detail

      • deregisterDriver

        public static void deregisterDriver(Driver driver)
                                     throws SQLException
        Removes a driver from the DriverManager's registered driver list. This will only succeed when the caller's class loader loaded the driver that is to be removed. If the driver was loaded by a different class loader, the removal of the driver fails silently.

        If the removal succeeds, the DriverManager will not use this driver in the future when asked to get a Connection.

        Parameters:
        driver - the JDBC driver to remove.
        Throws:
        SQLException - if there is a problem interfering with accessing the database.
      • getConnection

        public static Connection getConnection(String url)
                                        throws SQLException
        Attempts to establish a connection to the given database URL.
        Parameters:
        url - a URL string representing the database target to connect with.
        Returns:
        a Connection to the database identified by the URL. null if no connection can be established.
        Throws:
        SQLException - if there is an error while attempting to connect to the database identified by the URL.
      • getConnection

        public static Connection getConnection(String url,
                               Properties info)
                                        throws SQLException
        Attempts to establish a connection to the given database URL.
        Parameters:
        url - a URL string representing the database target to connect with
        info - 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 user ID and its corresponding password to get access to the corresponding database.
        Returns:
        a Connection to the database identified by the URL. null if no connection can be established.
        Throws:
        SQLException - if there is an error while attempting to connect to the database identified by the URL.
      • getConnection

        public static Connection getConnection(String url,
                               String user,
                               String password)
                                        throws SQLException
        Attempts to establish a connection to the given database URL.
        Parameters:
        url - a URL string representing the database target to connect with.
        user - a user ID used to login to the database.
        password - a password for the user ID to login to the database.
        Returns:
        a Connection to the database identified by the URL. null if no connection can be established.
        Throws:
        SQLException - if there is an error while attempting to connect to the database identified by the URL.
      • getDriver

        public static Driver getDriver(String url)
                                throws SQLException
        Tries to find a driver that can interpret the supplied URL.
        Parameters:
        url - the URL of a database.
        Returns:
        a Driver that matches the provided URL. null if no Driver understands the URL
        Throws:
        SQLException - if there is any kind of problem accessing the database.
      • getDrivers

        public static Enumeration<Driver> getDrivers()
        Returns an Enumeration that contains all of the loaded JDBC drivers that the current caller can access.
        Returns:
        An Enumeration containing all the currently loaded JDBC Drivers.
      • getLoginTimeout

        public static int getLoginTimeout()
        Returns the login timeout when connecting to a database in seconds.
        Returns:
        the login timeout in seconds.
      • getLogStream

        @Deprecated
        public static PrintStream getLogStream()
        Deprecated. use getLogWriter() instead.
        Gets the log PrintStream used by the DriverManager and all the JDBC Drivers.
        Returns:
        the PrintStream used for logging activities.
      • getLogWriter

        public static PrintWriter getLogWriter()
        Retrieves the log writer.
        Returns:
        A PrintWriter object used as the log writer. null if no log writer is set.
      • println

        public static void println(String message)
        Prints a message to the current JDBC log stream. This is either the PrintWriter or (deprecated) the PrintStream, if set.
        Parameters:
        message - the message to print to the JDBC log stream.
      • registerDriver

        public static void registerDriver(Driver driver)
                                   throws SQLException
        Registers a given JDBC driver with the DriverManager.

        A newly loaded JDBC driver class should register itself with the DriverManager by calling this method.

        Parameters:
        driver - the Driver to register with the DriverManager.
        Throws:
        SQLException - if a database access error occurs.
      • setLoginTimeout

        public static void setLoginTimeout(int seconds)
        Sets the login timeout when connecting to a database in seconds.
        Parameters:
        seconds - seconds until timeout. 0 indicates wait forever.
      • setLogStream

        @Deprecated
        public static void setLogStream(PrintStream out)
        Deprecated. Use setLogWriter(java.io.PrintWriter) instead.
        Sets the print stream to use for logging data from the DriverManager and the JDBC drivers.
        Parameters:
        out - the PrintStream to use for logging.
      • setLogWriter

        public static void setLogWriter(PrintWriter out)
        Sets the PrintWriter that is used by all loaded drivers, and also the DriverManager.
        Parameters:
        out - the PrintWriter to be used.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1521 / . Delta: 0.01786 с