< prev index next >

src/java.sql/share/classes/java/sql/Driver.java

Print this page




  37  * <P>The DriverManager will try to load as many drivers as it can
  38  * find and then for any given connection request, it will ask each
  39  * driver in turn to try to connect to the target URL.
  40  *
  41  * <P>It is strongly recommended that each Driver class should be
  42  * small and standalone so that the Driver class can be loaded and
  43  * queried without bringing in vast quantities of supporting code.
  44  *
  45  * <P>When a Driver class is loaded, it should create an instance of
  46  * itself and register it with the DriverManager. This means that a
  47  * user can load and register a driver by calling:
  48  * <p>
  49  * {@code Class.forName("foo.bah.Driver")}
  50  * <p>
  51  * A JDBC driver may create a {@linkplain DriverAction} implementation in order
  52  * to receive notifications when {@linkplain DriverManager#deregisterDriver} has
  53  * been called.
  54  * @see DriverManager
  55  * @see Connection
  56  * @see DriverAction

  57  */
  58 public interface Driver {
  59 
  60     /**
  61      * Attempts to make a database connection to the given URL.
  62      * The driver should return "null" if it realizes it is the wrong kind
  63      * of driver to connect to the given URL.  This will be common, as when
  64      * the JDBC driver manager is asked to connect to a given URL it passes
  65      * the URL to each loaded driver in turn.
  66      *
  67      * <P>The driver should throw an <code>SQLException</code> if it is the right
  68      * driver to connect to the given URL but has trouble connecting to
  69      * the database.
  70      *
  71      * <P>The {@code Properties} argument can be used to pass
  72      * arbitrary string tag/value pairs as connection arguments.
  73      * Normally at least "user" and "password" properties should be
  74      * included in the {@code Properties} object.
  75      * <p>
  76      * <B>Note:</B> If a property is specified as part of the {@code url} and




  37  * <P>The DriverManager will try to load as many drivers as it can
  38  * find and then for any given connection request, it will ask each
  39  * driver in turn to try to connect to the target URL.
  40  *
  41  * <P>It is strongly recommended that each Driver class should be
  42  * small and standalone so that the Driver class can be loaded and
  43  * queried without bringing in vast quantities of supporting code.
  44  *
  45  * <P>When a Driver class is loaded, it should create an instance of
  46  * itself and register it with the DriverManager. This means that a
  47  * user can load and register a driver by calling:
  48  * <p>
  49  * {@code Class.forName("foo.bah.Driver")}
  50  * <p>
  51  * A JDBC driver may create a {@linkplain DriverAction} implementation in order
  52  * to receive notifications when {@linkplain DriverManager#deregisterDriver} has
  53  * been called.
  54  * @see DriverManager
  55  * @see Connection
  56  * @see DriverAction
  57  * @since 1.1
  58  */
  59 public interface Driver {
  60 
  61     /**
  62      * Attempts to make a database connection to the given URL.
  63      * The driver should return "null" if it realizes it is the wrong kind
  64      * of driver to connect to the given URL.  This will be common, as when
  65      * the JDBC driver manager is asked to connect to a given URL it passes
  66      * the URL to each loaded driver in turn.
  67      *
  68      * <P>The driver should throw an <code>SQLException</code> if it is the right
  69      * driver to connect to the given URL but has trouble connecting to
  70      * the database.
  71      *
  72      * <P>The {@code Properties} argument can be used to pass
  73      * arbitrary string tag/value pairs as connection arguments.
  74      * Normally at least "user" and "password" properties should be
  75      * included in the {@code Properties} object.
  76      * <p>
  77      * <B>Note:</B> If a property is specified as part of the {@code url} and


< prev index next >