jdk/src/share/classes/java/sql/Driver.java
changeset 15278 e081d3f73b75
parent 6540 a4ae668f6125
child 17199 28853592ce2b
equal deleted inserted replaced
15277:245068ba31b3 15278:e081d3f73b75
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    63      *
    63      *
    64      * <P>The driver should throw an <code>SQLException</code> if it is the right
    64      * <P>The driver should throw an <code>SQLException</code> if it is the right
    65      * driver to connect to the given URL but has trouble connecting to
    65      * driver to connect to the given URL but has trouble connecting to
    66      * the database.
    66      * the database.
    67      *
    67      *
    68      * <P>The <code>java.util.Properties</code> argument can be used to pass
    68      * <P>The {@code Properties} argument can be used to pass
    69      * arbitrary string tag/value pairs as connection arguments.
    69      * arbitrary string tag/value pairs as connection arguments.
    70      * Normally at least "user" and "password" properties should be
    70      * Normally at least "user" and "password" properties should be
    71      * included in the <code>Properties</code> object.
    71      * included in the {@code Properties} object.
       
    72      * <p>
       
    73      * <B>Note:</B> If a property is specified as part of the {@code url} and
       
    74      * is also specified in the {@code Properties} object, it is
       
    75      * implementation-defined as to which value will take precedence. For
       
    76      * maximum portability, an application should only specify a property once.
    72      *
    77      *
    73      * @param url the URL of the database to which to connect
    78      * @param url the URL of the database to which to connect
    74      * @param info a list of arbitrary string tag/value pairs as
    79      * @param info a list of arbitrary string tag/value pairs as
    75      * connection arguments. Normally at least a "user" and
    80      * connection arguments. Normally at least a "user" and
    76      * "password" property should be included.
    81      * "password" property should be included.
    77      * @return a <code>Connection</code> object that represents a
    82      * @return a <code>Connection</code> object that represents a
    78      *         connection to the URL
    83      *         connection to the URL
    79      * @exception SQLException if a database access error occurs
    84      * @exception SQLException if a database access error occurs or the url is
       
    85      * {@code null}
    80      */
    86      */
    81     Connection connect(String url, java.util.Properties info)
    87     Connection connect(String url, java.util.Properties info)
    82         throws SQLException;
    88         throws SQLException;
    83 
    89 
    84     /**
    90     /**
    85      * Retrieves whether the driver thinks that it can open a connection
    91      * Retrieves whether the driver thinks that it can open a connection
    86      * to the given URL.  Typically drivers will return <code>true</code> if they
    92      * to the given URL.  Typically drivers will return <code>true</code> if they
    87      * understand the subprotocol specified in the URL and <code>false</code> if
    93      * understand the sub-protocol specified in the URL and <code>false</code> if
    88      * they do not.
    94      * they do not.
    89      *
    95      *
    90      * @param url the URL of the database
    96      * @param url the URL of the database
    91      * @return <code>true</code> if this driver understands the given URL;
    97      * @return <code>true</code> if this driver understands the given URL;
    92      *         <code>false</code> otherwise
    98      *         <code>false</code> otherwise
    93      * @exception SQLException if a database access error occurs
    99      * @exception SQLException if a database access error occurs or the url is
       
   100      * {@code null}
    94      */
   101      */
    95     boolean acceptsURL(String url) throws SQLException;
   102     boolean acceptsURL(String url) throws SQLException;
    96 
   103 
    97 
   104 
    98     /**
   105     /**