src/java.sql/share/classes/java/sql/Connection.java
author psadhukhan
Fri, 09 Nov 2018 09:29:43 +0530
changeset 52543 3853631e6a07
parent 47216 71c04702a3d5
permissions -rw-r--r--
8213181: Updation of ProblemList.txt for removal of passing swing test Reviewed-by: serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 44550
diff changeset
     2
 * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.Properties;
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    29
import java.util.concurrent.Executor;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * <P>A connection (session) with a specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * database. SQL statements are executed and results are returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * within the context of a connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * A <code>Connection</code> object's database is able to provide information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * describing its tables, its supported SQL grammar, its stored
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * procedures, the capabilities of this connection, and so on. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * information is obtained with the <code>getMetaData</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <P><B>Note:</B> When configuring a <code>Connection</code>, JDBC applications
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    42
 *  should use the appropriate <code>Connection</code> method such as
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *  <code>setAutoCommit</code> or <code>setTransactionIsolation</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *  Applications should not invoke SQL commands directly to change the connection's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *   configuration when there is a JDBC method available.  By default a <code>Connection</code> object is in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * auto-commit mode, which means that it automatically commits changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * after executing each statement. If auto-commit mode has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * disabled, the method <code>commit</code> must be called explicitly in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * order to commit changes; otherwise, database changes will not be saved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * A new <code>Connection</code> object created using the JDBC 2.1 core API
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * has an initially empty type map associated with it. A user may enter a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * custom mapping for a UDT in this type map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * When a UDT is retrieved from a data source with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * method <code>ResultSet.getObject</code>, the <code>getObject</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * will check the connection's type map to see if there is an entry for that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * UDT.  If so, the <code>getObject</code> method will map the UDT to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * class indicated.  If there is no entry, the UDT will be mapped using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * standard mapping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * A user may create a new type map, which is a <code>java.util.Map</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * object, make an entry in it, and pass it to the <code>java.sql</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * methods that can perform custom mapping.  In this case, the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * will use the given type map instead of the one associated with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * the connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * For example, the following code fragment specifies that the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * type <code>ATHLETES</code> will be mapped to the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * <code>Athletes</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * The code fragment retrieves the type map for the <code>Connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * </code> object <code>con</code>, inserts the entry into it, and then sets
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * the type map with the new entry as the connection's type map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *      java.util.Map map = con.getTypeMap();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *      map.put("mySchemaName.ATHLETES", Class.forName("Athletes"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *      con.setTypeMap(map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * @see DriverManager#getConnection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * @see Statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * @see ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * @see DatabaseMetaData
44256
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 35302
diff changeset
    83
 * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 */
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    85
public interface Connection  extends Wrapper, AutoCloseable {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Creates a <code>Statement</code> object for sending
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * SQL statements to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * SQL statements without parameters are normally
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * executed using <code>Statement</code> objects. If the same SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * is executed many times, it may be more efficient to use a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * <code>PreparedStatement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * Result sets created using the returned <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * object will by default be type <code>TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @return a new default <code>Statement</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    Statement createStatement() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Creates a <code>PreparedStatement</code> object for sending
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * parameterized SQL statements to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * A SQL statement with or without IN parameters can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * pre-compiled and stored in a <code>PreparedStatement</code> object. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * object can then be used to efficiently execute this statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * multiple times.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * <P><B>Note:</B> This method is optimized for handling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * parametric SQL statements that benefit from precompilation. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * the driver supports precompilation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * the method <code>prepareStatement</code> will send
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * the statement to the database for precompilation. Some drivers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * may not support precompilation. In this case, the statement may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * not be sent to the database until the <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * object is executed.  This has no direct effect on users; however, it does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * affect which methods throw certain <code>SQLException</code> objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * Result sets created using the returned <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * object will by default be type <code>TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @param sql an SQL statement that may contain one or more '?' IN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * parameter placeholders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @return a new default <code>PreparedStatement</code> object containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * pre-compiled SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    PreparedStatement prepareStatement(String sql)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * Creates a <code>CallableStatement</code> object for calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * database stored procedures.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * The <code>CallableStatement</code> object provides
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * methods for setting up its IN and OUT parameters, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * methods for executing the call to a stored procedure.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * <P><B>Note:</B> This method is optimized for handling stored
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * procedure call statements. Some drivers may send the call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * statement to the database when the method <code>prepareCall</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * is done; others
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * may wait until the <code>CallableStatement</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * is executed. This has no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * direct effect on users; however, it does affect which method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * throws certain SQLExceptions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Result sets created using the returned <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * object will by default be type <code>TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @param sql an SQL statement that may contain one or more '?'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * parameter placeholders. Typically this statement is specified using JDBC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * call escape syntax.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @return a new default <code>CallableStatement</code> object containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * pre-compiled SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    CallableStatement prepareCall(String sql) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Converts the given SQL statement into the system's native SQL grammar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * A driver may convert the JDBC SQL grammar into its system's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * native SQL grammar prior to sending it. This method returns the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * native form of the statement that the driver would have sent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @param sql an SQL statement that may contain one or more '?'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * parameter placeholders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @return the native form of this statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    String nativeSQL(String sql) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * Sets this connection's auto-commit mode to the given state.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * If a connection is in auto-commit mode, then all its SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * statements will be executed and committed as individual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * transactions.  Otherwise, its SQL statements are grouped into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * transactions that are terminated by a call to either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * the method <code>commit</code> or the method <code>rollback</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * By default, new connections are in auto-commit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * The commit occurs when the statement completes. The time when the statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * completes depends on the type of SQL Statement:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * <li>For DML statements, such as Insert, Update or Delete, and DDL statements,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * the statement is complete as soon as it has finished executing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * <li>For Select statements, the statement is complete when the associated result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * set is closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * <li>For <code>CallableStatement</code> objects or for statements that return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * multiple results, the statement is complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * when all of the associated result sets have been closed, and all update
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * counts and output parameters have been retrieved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * <B>NOTE:</B>  If this method is called during a transaction and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * auto-commit mode is changed, the transaction is committed.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * <code>setAutoCommit</code> is called and the auto-commit mode is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * not changed, the call is a no-op.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @param autoCommit <code>true</code> to enable auto-commit mode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     *         <code>false</code> to disable it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *  setAutoCommit(true) is called while participating in a distributed transaction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @see #getAutoCommit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    void setAutoCommit(boolean autoCommit) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * Retrieves the current auto-commit mode for this <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * @return the current state of this <code>Connection</code> object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *         auto-commit mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @see #setAutoCommit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    boolean getAutoCommit() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * Makes all changes made since the previous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * commit/rollback permanent and releases any database locks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * currently held by this <code>Connection</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * This method should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * used only when auto-commit mode has been disabled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * this method is called while participating in a distributed transaction,
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
   246
     * if this method is called on a closed connection or this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     *            <code>Connection</code> object is in auto-commit mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @see #setAutoCommit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    void commit() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * Undoes all changes made in the current transaction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * and releases any database locks currently held
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * by this <code>Connection</code> object. This method should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * used only when auto-commit mode has been disabled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * this method is called while participating in a distributed transaction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * this method is called on a closed connection or this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     *            <code>Connection</code> object is in auto-commit mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * @see #setAutoCommit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    void rollback() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * Releases this <code>Connection</code> object's database and JDBC resources
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * immediately instead of waiting for them to be automatically released.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * Calling the method <code>close</code> on a <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * object that is already closed is a no-op.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * It is <b>strongly recommended</b> that an application explicitly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * commits or rolls back an active transaction prior to calling the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * <code>close</code> method.  If the <code>close</code> method is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * and there is an active transaction, the results are implementation-defined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     *
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 23590
diff changeset
   278
     * @exception SQLException if a database access error occurs
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    void close() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * Retrieves whether this <code>Connection</code> object has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * closed.  A connection is closed if the method <code>close</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * has been called on it or if certain fatal errors have occurred.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * This method is guaranteed to return <code>true</code> only when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * it is called after the method <code>Connection.close</code> has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * been called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * This method generally cannot be called to determine whether a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * connection to a database is valid or invalid.  A typical client
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * can determine that a connection is invalid by catching any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * exceptions that might be thrown when an operation is attempted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @return <code>true</code> if this <code>Connection</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     *         is closed; <code>false</code> if it is still open
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    boolean isClosed() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    //======================================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    // Advanced features:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * Retrieves a <code>DatabaseMetaData</code> object that contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * metadata about the database to which this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * <code>Connection</code> object represents a connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * The metadata includes information about the database's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * tables, its supported SQL grammar, its stored
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * procedures, the capabilities of this connection, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @return a <code>DatabaseMetaData</code> object for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     *         <code>Connection</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * @exception  SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    DatabaseMetaData getMetaData() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * Puts this connection in read-only mode as a hint to the driver to enable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * database optimizations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * <P><B>Note:</B> This method cannot be called during a transaction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @param readOnly <code>true</code> enables read-only mode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     *        <code>false</code> disables it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     *  method is called on a closed connection or this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *            method is called during a transaction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    void setReadOnly(boolean readOnly) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * Retrieves whether this <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * object is in read-only mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * @return <code>true</code> if this <code>Connection</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     *         is read-only; <code>false</code> otherwise
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 23590
diff changeset
   339
     * @exception SQLException if a database access error occurs
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    boolean isReadOnly() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * Sets the given catalog name in order to select
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * a subspace of this <code>Connection</code> object's database
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * in which to work.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * If the driver does not support catalogs, it will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * silently ignore this request.
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   351
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   352
     * Calling {@code setCatalog} has no effect on previously created or prepared
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   353
     * {@code Statement} objects. It is implementation defined whether a DBMS
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   354
     * prepare operation takes place immediately when the {@code Connection}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   355
     * method {@code prepareStatement} or {@code prepareCall} is invoked.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   356
     * For maximum portability, {@code setCatalog} should be called before a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   357
     * {@code Statement} is created or prepared.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @param catalog the name of a catalog (subspace in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     *        <code>Connection</code> object's database) in which to work
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @see #getCatalog
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    void setCatalog(String catalog) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * Retrieves this <code>Connection</code> object's current catalog name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * @return the current catalog name or <code>null</code> if there is none
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @see #setCatalog
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    String getCatalog() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * A constant indicating that transactions are not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    int TRANSACTION_NONE             = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * A constant indicating that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * dirty reads, non-repeatable reads and phantom reads can occur.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * This level allows a row changed by one transaction to be read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * by another transaction before any changes in that row have been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * committed (a "dirty read").  If any of the changes are rolled back,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * the second transaction will have retrieved an invalid row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    int TRANSACTION_READ_UNCOMMITTED = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * A constant indicating that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * dirty reads are prevented; non-repeatable reads and phantom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * reads can occur.  This level only prohibits a transaction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * from reading a row with uncommitted changes in it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    int TRANSACTION_READ_COMMITTED   = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * A constant indicating that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * dirty reads and non-repeatable reads are prevented; phantom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * reads can occur.  This level prohibits a transaction from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * reading a row with uncommitted changes in it, and it also
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * prohibits the situation where one transaction reads a row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * a second transaction alters the row, and the first transaction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * rereads the row, getting different values the second time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * (a "non-repeatable read").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    int TRANSACTION_REPEATABLE_READ  = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * A constant indicating that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * dirty reads, non-repeatable reads and phantom reads are prevented.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * This level includes the prohibitions in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * <code>TRANSACTION_REPEATABLE_READ</code> and further prohibits the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * situation where one transaction reads all rows that satisfy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * a <code>WHERE</code> condition, a second transaction inserts a row that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * satisfies that <code>WHERE</code> condition, and the first transaction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * rereads for the same condition, retrieving the additional
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * "phantom" row in the second read.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    int TRANSACTION_SERIALIZABLE     = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * Attempts to change the transaction isolation level for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * <code>Connection</code> object to the one given.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * The constants defined in the interface <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * are the possible transaction isolation levels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * <B>Note:</B> If this method is called during a transaction, the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * is implementation-defined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * @param level one of the following <code>Connection</code> constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     *        <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *        <code>Connection.TRANSACTION_READ_COMMITTED</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     *        <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     *        <code>Connection.TRANSACTION_SERIALIZABLE</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     *        (Note that <code>Connection.TRANSACTION_NONE</code> cannot be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     *        because it specifies that transactions are not supported.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     *            or the given parameter is not one of the <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *            constants
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @see DatabaseMetaData#supportsTransactionIsolationLevel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * @see #getTransactionIsolation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    void setTransactionIsolation(int level) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * Retrieves this <code>Connection</code> object's current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * transaction isolation level.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * @return the current transaction isolation level, which will be one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     *         of the following constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     *        <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     *        <code>Connection.TRANSACTION_READ_COMMITTED</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     *        <code>Connection.TRANSACTION_REPEATABLE_READ</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     *        <code>Connection.TRANSACTION_SERIALIZABLE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     *        <code>Connection.TRANSACTION_NONE</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @see #setTransactionIsolation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    int getTransactionIsolation() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * Retrieves the first warning reported by calls on this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * <code>Connection</code> object.  If there is more than one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * warning, subsequent warnings will be chained to the first one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * and can be retrieved by calling the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * <code>SQLWarning.getNextWarning</code> on the warning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * that was retrieved previously.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * This method may not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * called on a closed connection; doing so will cause an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * <code>SQLException</code> to be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * <P><B>Note:</B> Subsequent warnings will be chained to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * SQLWarning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * @return the first <code>SQLWarning</code> object or <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     *         if there are none
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     *            this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * @see SQLWarning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    SQLWarning getWarnings() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     * Clears all warnings reported for this <code>Connection</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     * After a call to this method, the method <code>getWarnings</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * returns <code>null</code> until a new warning is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * reported for this <code>Connection</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     *
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 23590
diff changeset
   496
     * @exception SQLException if a database access error occurs
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    void clearWarnings() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    //--------------------------JDBC 2.0-----------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * Creates a <code>Statement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * <code>ResultSet</code> objects with the given type and concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     * This method is the same as the <code>createStatement</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     * above, but it allows the default result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * type and concurrency to be overridden.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * @param resultSetType a result set type; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     *        <code>ResultSet.TYPE_FORWARD_ONLY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     *        <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     *        <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * @param resultSetConcurrency a concurrency type; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     *        <code>ResultSet.CONCUR_READ_ONLY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     *        <code>ResultSet.CONCUR_UPDATABLE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * @return a new <code>Statement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     *         <code>ResultSet</code> objects with the given type and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     *         concurrency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     *         or the given parameters are not <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     *         constants indicating type and concurrency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * this method or this method is not supported for the specified result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     * set type and result set concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    Statement createStatement(int resultSetType, int resultSetConcurrency)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * Creates a <code>PreparedStatement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * <code>ResultSet</code> objects with the given type and concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     * This method is the same as the <code>prepareStatement</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * above, but it allows the default result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * type and concurrency to be overridden.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * @param sql a <code>String</code> object that is the SQL statement to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     *            be sent to the database; may contain one or more '?' IN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     *            parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * @param resultSetType a result set type; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     * @param resultSetConcurrency a concurrency type; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     *         <code>ResultSet.CONCUR_READ_ONLY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     *         <code>ResultSet.CONCUR_UPDATABLE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     * @return a new PreparedStatement object containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * pre-compiled SQL statement that will produce <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * objects with the given type and concurrency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     *         or the given parameters are not <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     *         constants indicating type and concurrency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * this method or this method is not supported for the specified result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     * set type and result set concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    PreparedStatement prepareStatement(String sql, int resultSetType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
                                       int resultSetConcurrency)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     * Creates a <code>CallableStatement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * <code>ResultSet</code> objects with the given type and concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     * This method is the same as the <code>prepareCall</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     * above, but it allows the default result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * type and concurrency to be overridden.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * @param sql a <code>String</code> object that is the SQL statement to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     *            be sent to the database; may contain on or more '?' parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * @param resultSetType a result set type; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * @param resultSetConcurrency a concurrency type; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     *         <code>ResultSet.CONCUR_READ_ONLY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     *         <code>ResultSet.CONCUR_UPDATABLE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * @return a new <code>CallableStatement</code> object containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * pre-compiled SQL statement that will produce <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * objects with the given type and concurrency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * @exception SQLException if a database access error occurs, this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     *         or the given parameters are not <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     *         constants indicating type and concurrency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * this method or this method is not supported for the specified result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * set type and result set concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
    CallableStatement prepareCall(String sql, int resultSetType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
                                  int resultSetConcurrency) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     * Retrieves the <code>Map</code> object associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * <code>Connection</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * Unless the application has added an entry, the type map returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * will be empty.
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   609
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   610
     * You must invoke <code>setTypeMap</code> after making changes to the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   611
     * <code>Map</code> object returned from
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   612
     *  <code>getTypeMap</code> as a JDBC driver may create an internal
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   613
     * copy of the <code>Map</code> object passed to <code>setTypeMap</code>:
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 6540
diff changeset
   614
     *
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   615
     * <pre>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   616
     *      Map&lt;String,Class&lt;?&gt;&gt; myMap = con.getTypeMap();
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   617
     *      myMap.put("mySchemaName.ATHLETES", Athletes.class);
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   618
     *      con.setTypeMap(myMap);
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   619
     * </pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * @return the <code>java.util.Map</code> object associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     *         with this <code>Connection</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * @see #setTypeMap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    java.util.Map<String,Class<?>> getTypeMap() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     * Installs the given <code>TypeMap</code> object as the type map for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * this <code>Connection</code> object.  The type map will be used for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     * custom mapping of SQL structured types and distinct types.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
   635
     * <p>
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 23590
diff changeset
   636
     * You must set the values for the <code>TypeMap</code> prior to
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   637
     * callng <code>setMap</code> as a JDBC driver may create an internal copy
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   638
     * of the <code>TypeMap</code>:
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 6540
diff changeset
   639
     *
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   640
     * <pre>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   641
     *      Map myMap&lt;String,Class&lt;?&gt;&gt; = new HashMap&lt;String,Class&lt;?&gt;&gt;();
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   642
     *      myMap.put("mySchemaName.ATHLETES", Athletes.class);
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   643
     *      con.setTypeMap(myMap);
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   644
     * </pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     * @param map the <code>java.util.Map</code> object to install
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     *        as the replacement for this <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
     *        object's default type map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     * method is called on a closed connection or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     *        the given parameter is not a <code>java.util.Map</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     *        object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     * @see #getTypeMap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    void setTypeMap(java.util.Map<String,Class<?>> map) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
    //--------------------------JDBC 3.0-----------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     * Changes the default holdability of <code>ResultSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * created using this <code>Connection</code> object to the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * holdability.  The default holdability of <code>ResultSet</code> objects
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 23590
diff changeset
   666
     * can be determined by invoking
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * {@link DatabaseMetaData#getResultSetHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * @param holdability a <code>ResultSet</code> holdability constant; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     *        <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     *        <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * @throws SQLException if a database access occurs, this method is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * on a closed connection, or the given parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     *         is not a <code>ResultSet</code> constant indicating holdability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * @exception SQLFeatureNotSupportedException if the given holdability is not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * @see #getHoldability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * @see DatabaseMetaData#getResultSetHoldability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     * @see ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
    void setHoldability(int holdability) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * Retrieves the current holdability of <code>ResultSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * created using this <code>Connection</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * @return the holdability, one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     *        <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     *        <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     * @see #setHoldability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     * @see DatabaseMetaData#getResultSetHoldability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     * @see ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
    int getHoldability() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     * Creates an unnamed savepoint in the current transaction and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
     * returns the new <code>Savepoint</code> object that represents it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     *<p> if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     *savepoint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * @return the new <code>Savepoint</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * this method is called while participating in a distributed transaction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     *            or this <code>Connection</code> object is currently in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     *            auto-commit mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * @see Savepoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
    Savepoint setSavepoint() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     * Creates a savepoint with the given name in the current transaction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     * and returns the new <code>Savepoint</code> object that represents it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
     * <p> if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     *savepoint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     * @param name a <code>String</code> containing the name of the savepoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * @return the new <code>Savepoint</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
          * this method is called while participating in a distributed transaction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     * this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     *            or this <code>Connection</code> object is currently in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
     *            auto-commit mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     * @see Savepoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
    Savepoint setSavepoint(String name) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     * Undoes all changes made after the given <code>Savepoint</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * This method should be used only when auto-commit has been disabled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     * @param savepoint the <code>Savepoint</code> object to roll back to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     * this method is called while participating in a distributed transaction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * this method is called on a closed connection,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     *            the <code>Savepoint</code> object is no longer valid,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     *            or this <code>Connection</code> object is currently in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     *            auto-commit mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * @see Savepoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * @see #rollback
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
    void rollback(Savepoint savepoint) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     * Removes the specified <code>Savepoint</code>  and subsequent <code>Savepoint</code> objects from the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     * transaction. Any reference to the savepoint after it have been removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * will cause an <code>SQLException</code> to be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * @param savepoint the <code>Savepoint</code> object to be removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     *  method is called on a closed connection or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     *            the given <code>Savepoint</code> object is not a valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     *            savepoint in the current transaction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
    void releaseSavepoint(Savepoint savepoint) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * Creates a <code>Statement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * <code>ResultSet</code> objects with the given type, concurrency,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * and holdability.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * This method is the same as the <code>createStatement</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * above, but it allows the default result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * type, concurrency, and holdability to be overridden.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
     * @param resultSetType one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     * @param resultSetConcurrency one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     *         <code>ResultSet.CONCUR_READ_ONLY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     *         <code>ResultSet.CONCUR_UPDATABLE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     * @param resultSetHoldability one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     *         <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     *         <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * @return a new <code>Statement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     *         <code>ResultSet</code> objects with the given type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     *         concurrency, and holdability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     *            or the given parameters are not <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     *            constants indicating type, concurrency, and holdability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * this method or this method is not supported for the specified result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     * set type, result set holdability and result set concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     * @see ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
    Statement createStatement(int resultSetType, int resultSetConcurrency,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
                              int resultSetHoldability) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     * Creates a <code>PreparedStatement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     * <code>ResultSet</code> objects with the given type, concurrency,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * and holdability.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * This method is the same as the <code>prepareStatement</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * above, but it allows the default result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     * type, concurrency, and holdability to be overridden.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
     * @param sql a <code>String</code> object that is the SQL statement to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     *            be sent to the database; may contain one or more '?' IN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     *            parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     * @param resultSetType one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     * @param resultSetConcurrency one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     *         <code>ResultSet.CONCUR_READ_ONLY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     *         <code>ResultSet.CONCUR_UPDATABLE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * @param resultSetHoldability one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     *         <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     *         <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     * @return a new <code>PreparedStatement</code> object, containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     *         pre-compiled SQL statement, that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     *         <code>ResultSet</code> objects with the given type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     *         concurrency, and holdability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     *            or the given parameters are not <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     *            constants indicating type, concurrency, and holdability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     * this method or this method is not supported for the specified result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
     * set type, result set holdability and result set concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
     * @see ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
    PreparedStatement prepareStatement(String sql, int resultSetType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
                                       int resultSetConcurrency, int resultSetHoldability)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     * Creates a <code>CallableStatement</code> object that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     * <code>ResultSet</code> objects with the given type and concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     * This method is the same as the <code>prepareCall</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     * above, but it allows the default result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     * type, result set concurrency type and holdability to be overridden.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     * @param sql a <code>String</code> object that is the SQL statement to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     *            be sent to the database; may contain on or more '?' parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     * @param resultSetType one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     * @param resultSetConcurrency one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     *         <code>ResultSet.CONCUR_READ_ONLY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
     *         <code>ResultSet.CONCUR_UPDATABLE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     * @param resultSetHoldability one of the following <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
     *        constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
     *         <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
     *         <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     * @return a new <code>CallableStatement</code> object, containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
     *         pre-compiled SQL statement, that will generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
     *         <code>ResultSet</code> objects with the given type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
     *         concurrency, and holdability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
     * method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
     *            or the given parameters are not <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     *            constants indicating type, concurrency, and holdability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * this method or this method is not supported for the specified result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     * set type, result set holdability and result set concurrency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * @see ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
    CallableStatement prepareCall(String sql, int resultSetType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
                                  int resultSetConcurrency,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
                                  int resultSetHoldability) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * Creates a default <code>PreparedStatement</code> object that has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     * the capability to retrieve auto-generated keys. The given constant
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * tells the driver whether it should make auto-generated keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     * available for retrieval.  This parameter is ignored if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     * auto-generated keys (the list of such statements is vendor-specific).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
     * <B>Note:</B> This method is optimized for handling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
     * parametric SQL statements that benefit from precompilation. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     * the driver supports precompilation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     * the method <code>prepareStatement</code> will send
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     * the statement to the database for precompilation. Some drivers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     * may not support precompilation. In this case, the statement may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
     * not be sent to the database until the <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
     * object is executed.  This has no direct effect on users; however, it does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
     * affect which methods throw certain SQLExceptions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
     * Result sets created using the returned <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
     * object will by default be type <code>TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
     * @param sql an SQL statement that may contain one or more '?' IN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     *        parameter placeholders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * @param autoGeneratedKeys a flag indicating whether auto-generated keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     *        should be returned; one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     *        <code>Statement.RETURN_GENERATED_KEYS</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     *        <code>Statement.NO_GENERATED_KEYS</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
     * @return a new <code>PreparedStatement</code> object, containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
     *         pre-compiled SQL statement, that will have the capability of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
     *         returning auto-generated keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
     * @exception SQLException if a database access error occurs, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     *  method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     *         or the given parameter is not a <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
     *         constant indicating whether auto-generated keys should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     *         returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     * this method with a constant of Statement.RETURN_GENERATED_KEYS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
    PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
        throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     * Creates a default <code>PreparedStatement</code> object capable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * of returning the auto-generated keys designated by the given array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     * This array contains the indexes of the columns in the target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * table that contain the auto-generated keys that should be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     * available.  The driver will ignore the array if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     * auto-generated keys (the list of such statements is vendor-specific).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     * An SQL statement with or without IN parameters can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * pre-compiled and stored in a <code>PreparedStatement</code> object. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     * object can then be used to efficiently execute this statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     * multiple times.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
     * <B>Note:</B> This method is optimized for handling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
     * parametric SQL statements that benefit from precompilation. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
     * the driver supports precompilation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
     * the method <code>prepareStatement</code> will send
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
     * the statement to the database for precompilation. Some drivers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     * may not support precompilation. In this case, the statement may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
     * not be sent to the database until the <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
     * object is executed.  This has no direct effect on users; however, it does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
     * affect which methods throw certain SQLExceptions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
     * Result sets created using the returned <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
     * object will by default be type <code>TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * @param sql an SQL statement that may contain one or more '?' IN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     *        parameter placeholders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
     * @param columnIndexes an array of column indexes indicating the columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     *        that should be returned from the inserted row or rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     * @return a new <code>PreparedStatement</code> object, containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     *         pre-compiled statement, that is capable of returning the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     *         auto-generated keys designated by the given array of column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     *         indexes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
    PreparedStatement prepareStatement(String sql, int columnIndexes[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
        throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
     * Creates a default <code>PreparedStatement</code> object capable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     * of returning the auto-generated keys designated by the given array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * This array contains the names of the columns in the target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * table that contain the auto-generated keys that should be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * The driver will ignore the array if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * auto-generated keys (the list of such statements is vendor-specific).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     * An SQL statement with or without IN parameters can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
     * pre-compiled and stored in a <code>PreparedStatement</code> object. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     * object can then be used to efficiently execute this statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     * multiple times.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * <B>Note:</B> This method is optimized for handling
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     * parametric SQL statements that benefit from precompilation. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     * the driver supports precompilation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
     * the method <code>prepareStatement</code> will send
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
     * the statement to the database for precompilation. Some drivers
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
     * may not support precompilation. In this case, the statement may
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
     * not be sent to the database until the <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
     * object is executed.  This has no direct effect on users; however, it does
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
     * affect which methods throw certain SQLExceptions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
     * Result sets created using the returned <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
     * object will by default be type <code>TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     * The holdability of the created result sets can be determined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
     * calling {@link #getHoldability}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
     * @param sql an SQL statement that may contain one or more '?' IN
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     *        parameter placeholders
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * @param columnNames an array of column names indicating the columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     *        that should be returned from the inserted row or rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     * @return a new <code>PreparedStatement</code> object, containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
     *         pre-compiled statement, that is capable of returning the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
     *         auto-generated keys designated by the given array of column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
     *         names
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
     * or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
    PreparedStatement prepareStatement(String sql, String columnNames[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
        throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     * Constructs an object that implements the <code>Clob</code> interface. The object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     * returned initially contains no data.  The <code>setAsciiStream</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     * <code>setCharacterStream</code> and <code>setString</code> methods of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
     * the <code>Clob</code> interface may be used to add data to the <code>Clob</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
     * @return An object that implements the <code>Clob</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
     * @throws SQLException if an object that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
     * <code>Clob</code> interface can not be constructed, this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
     * called on a closed connection or a database access error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
     * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
    Clob createClob() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
     * Constructs an object that implements the <code>Blob</code> interface. The object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
     * returned initially contains no data.  The <code>setBinaryStream</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * <code>setBytes</code> methods of the <code>Blob</code> interface may be used to add data to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     * the <code>Blob</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     * @return  An object that implements the <code>Blob</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
     * @throws SQLException if an object that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
     * <code>Blob</code> interface can not be constructed, this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
     * called on a closed connection or a database access error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
     * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
    Blob createBlob() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
     * Constructs an object that implements the <code>NClob</code> interface. The object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
     * returned initially contains no data.  The <code>setAsciiStream</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
     * <code>setCharacterStream</code> and <code>setString</code> methods of the <code>NClob</code> interface may
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
     * be used to add data to the <code>NClob</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
     * @return An object that implements the <code>NClob</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
     * @throws SQLException if an object that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
     * <code>NClob</code> interface can not be constructed, this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
     * called on a closed connection or a database access error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
     * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
    NClob createNClob() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
     * Constructs an object that implements the <code>SQLXML</code> interface. The object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
     * returned initially contains no data. The <code>createXmlStreamWriter</code> object and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
     * <code>setString</code> method of the <code>SQLXML</code> interface may be used to add data to the <code>SQLXML</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
     * @return An object that implements the <code>SQLXML</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
     * @throws SQLException if an object that implements the <code>SQLXML</code> interface can not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
     * be constructed, this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
     * called on a closed connection or a database access error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
     * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
    SQLXML createSQLXML() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
         * Returns true if the connection has not been closed and is still valid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
         * The driver shall submit a query on the connection or use some other
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
         * mechanism that positively verifies the connection is still valid when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
         * this method is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
         * The query submitted by the driver to validate the connection shall be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
         * executed in the context of the current transaction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
         * @param timeout -             The time in seconds to wait for the database operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
         *                                              used to validate the connection to complete.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
         *                                              the timeout period expires before the operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
         *                                              completes, this method returns false.  A value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
         *                                              0 indicates a timeout is not applied to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
         *                                              database operation.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1117
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
         * @return true if the connection is valid, false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
         * @exception SQLException if the value supplied for <code>timeout</code>
27778
f3e0156f99d7 8066261: Typo in Connection.isValid
lancea
parents: 25991
diff changeset
  1120
         * is less than 0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
         * @since 1.6
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 6540
diff changeset
  1122
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
         * @see java.sql.DatabaseMetaData#getClientInfoProperties
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
         boolean isValid(int timeout) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
         * Sets the value of the client info property specified by name to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
         * value specified by value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
         * Applications may use the <code>DatabaseMetaData.getClientInfoProperties</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
         * method to determine the client info properties supported by the driver
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
         * and the maximum length that may be specified for each property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
         * The driver stores the value specified in a suitable location in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
         * database.  For example in a special register, session parameter, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
         * system table column.  For efficiency the driver may defer setting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
         * value in the database until the next time a statement is executed or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
         * prepared.  Other than storing the client information in the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
         * place in the database, these methods shall not alter the behavior of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
         * the connection in anyway.  The values supplied to these methods are
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
         * used for accounting, diagnostics and debugging purposes only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
         * The driver shall generate a warning if the client info name specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
         * is not recognized by the driver.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
         * If the value specified to this method is greater than the maximum
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
         * length for the property the driver may either truncate the value and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
         * generate a warning or generate a <code>SQLClientInfoException</code>.  If the driver
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
         * generates a <code>SQLClientInfoException</code>, the value specified was not set on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
         * connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
         * The following are standard client info properties.  Drivers are not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
         * required to support these properties however if the driver supports a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
         * client info property that can be described by one of the standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
         * properties, the standard property name should be used.
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 6540
diff changeset
  1157
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
         * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
         * <li>ApplicationName  -       The name of the application currently utilizing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
         *                                                      the connection</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
         * <li>ClientUser               -       The name of the user that the application using
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
         *                                                      the connection is performing work for.  This may
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
         *                                                      not be the same as the user name that was used
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
         *                                                      in establishing the connection.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
         * <li>ClientHostname   -       The hostname of the computer the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
         *                                                      using the connection is running on.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
         * </ul>
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1168
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
         * @param name          The name of the client info property to set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
         * @param value         The value to set the client info property to.  If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
         *                                      value is null, the current value of the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
         *                                      property is cleared.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1173
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
         * @throws      SQLClientInfoException if the database server returns an error while
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
         *                      setting the client info value on the database server or this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
         * is called on a closed connection
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1177
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
         void setClientInfo(String name, String value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
                throws SQLClientInfoException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
     * Sets the value of the connection's client info properties.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
     * <code>Properties</code> object contains the names and values of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
     * properties to be set.  The set of client info properties contained in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
     * the properties list replaces the current set of client info properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
     * on the connection.  If a property that is currently set on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
     * connection is not present in the properties list, that property is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
     * cleared.  Specifying an empty properties list will clear all of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
     * properties on the connection.  See <code>setClientInfo (String, String)</code> for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
     * more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
     * If an error occurs in setting any of the client info properties, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
     * <code>SQLClientInfoException</code> is thrown. The <code>SQLClientInfoException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
     * contains information indicating which client info properties were not set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
     * The state of the client information is unknown because
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
     * some databases do not allow multiple client info properties to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
     * atomically.  For those databases, one or more properties may have been
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
     * set before the error occurred.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1201
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
     * @param properties                the list of client info properties to set
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1204
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
     * @see java.sql.Connection#setClientInfo(String, String) setClientInfo(String, String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
     * @since 1.6
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1207
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
     * @throws SQLClientInfoException if the database server returns an error while
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
     *                  setting the clientInfo values on the database server or this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
     * is called on a closed connection
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 6540
diff changeset
  1211
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
         void setClientInfo(Properties properties)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
                throws SQLClientInfoException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
         * Returns the value of the client info property specified by name.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
         * method may return null if the specified client info property has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
         * been set and does not have a default value.  This method will also
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
         * return null if the specified client info property name is not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
         * by the driver.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
         * Applications may use the <code>DatabaseMetaData.getClientInfoProperties</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
         * method to determine the client info properties supported by the driver.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1225
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
         * @param name          The name of the client info property to retrieve
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1227
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
         * @return                      The value of the client info property specified
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1229
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
         * @throws SQLException         if the database server returns an error when
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1231
         *                              fetching the client info value from the database
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1232
         *                              or this method is called on a closed connection
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1233
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
         * @since 1.6
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 6540
diff changeset
  1235
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
         * @see java.sql.DatabaseMetaData#getClientInfoProperties
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
         String getClientInfo(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
                throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
         * Returns a list containing the name and current value of each client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
         * property supported by the driver.  The value of a client info property
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
         * may be null if the property has not been set and does not have a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
         * default value.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1246
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
         * @return      A <code>Properties</code> object that contains the name and current value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
         *                      each of the client info properties supported by the driver.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1249
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
         * @throws      SQLException if the database server returns an error when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
         *                      fetching the client info values from the database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
         * or this method is called on a closed connection
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1253
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
         Properties getClientInfo()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
                throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
  * Factory method for creating Array objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
  *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
  * <b>Note: </b>When <code>createArrayOf</code> is used to create an array object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
  * that maps to a primitive data type, then it is implementation-defined
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
  * whether the <code>Array</code> object is an array of that primitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
  * data type or an array of <code>Object</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
  * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
  * <b>Note: </b>The JDBC driver is responsible for mapping the elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
  * <code>Object</code> array to the default JDBC SQL type defined in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
  * java.sql.Types for the given class of <code>Object</code>. The default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
  * mapping is specified in Appendix B of the JDBC specification.  If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
  * resulting JDBC type is not the appropriate type for the given typeName then
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
  * it is implementation defined whether an <code>SQLException</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
  * thrown or the driver supports the resulting conversion.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
  * @param typeName the SQL name of the type the elements of the array map to. The typeName is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
  * database-specific name which may be the name of a built-in type, a user-defined type or a standard  SQL type supported by this database. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
  *  is the value returned by <code>Array.getBaseTypeName</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
  * @param elements the elements that populate the returned object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
  * @return an Array object whose elements map to the specified SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
  * @throws SQLException if a database error occurs, the JDBC type is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
  *  appropriate for the typeName and the conversion is not supported, the typeName is null or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
 Array createArrayOf(String typeName, Object[] elements) throws
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
  * Factory method for creating Struct objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
  * @param typeName the SQL type name of the SQL structured type that this <code>Struct</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
  * object maps to. The typeName is the name of  a user-defined type that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
  * has been defined for this database. It is the value returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
  * <code>Struct.getSQLTypeName</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
  * @param attributes the attributes that populate the returned object
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1297
  * @return a Struct object that maps to the given SQL type and is populated with the given attributes
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
  * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
 Struct createStruct(String typeName, Object[] attributes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
throws SQLException;
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1304
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1305
   //--------------------------JDBC 4.1 -----------------------------
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1306
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1307
   /**
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1308
    * Sets the given schema name to access.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1309
    * <P>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1310
    * If the driver does not support schemas, it will
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1311
    * silently ignore this request.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1312
    * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1313
    * Calling {@code setSchema} has no effect on previously created or prepared
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1314
    * {@code Statement} objects. It is implementation defined whether a DBMS
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1315
    * prepare operation takes place immediately when the {@code Connection}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1316
    * method {@code prepareStatement} or {@code prepareCall} is invoked.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1317
    * For maximum portability, {@code setSchema} should be called before a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1318
    * {@code Statement} is created or prepared.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1319
    *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1320
    * @param schema the name of a schema  in which to work
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1321
    * @exception SQLException if a database access error occurs
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1322
    * or this method is called on a closed connection
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1323
    * @see #getSchema
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1324
    * @since 1.7
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1325
    */
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1326
    void setSchema(String schema) throws SQLException;
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1327
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1328
    /**
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1329
     * Retrieves this <code>Connection</code> object's current schema name.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1330
     *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1331
     * @return the current schema name or <code>null</code> if there is none
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1332
     * @exception SQLException if a database access error occurs
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1333
     * or this method is called on a closed connection
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1334
     * @see #setSchema
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1335
     * @since 1.7
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1336
     */
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1337
    String getSchema() throws SQLException;
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1338
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1339
    /**
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1340
     * Terminates an open connection.  Calling <code>abort</code> results in:
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1341
     * <ul>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1342
     * <li>The connection marked as closed
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1343
     * <li>Closes any physical connection to the database
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1344
     * <li>Releases resources used by the connection
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1345
     * <li>Insures that any thread that is currently accessing the connection
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1346
     * will either progress to completion or throw an <code>SQLException</code>.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1347
     * </ul>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1348
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1349
     * Calling <code>abort</code> marks the connection closed and releases any
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1350
     * resources. Calling <code>abort</code> on a closed connection is a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1351
     * no-op.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1352
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1353
     * It is possible that the aborting and releasing of the resources that are
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1354
     * held by the connection can take an extended period of time.  When the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1355
     * <code>abort</code> method returns, the connection will have been marked as
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1356
     * closed and the <code>Executor</code> that was passed as a parameter to abort
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1357
     * may still be executing tasks to release resources.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1358
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1359
     * This method checks to see that there is an <code>SQLPermission</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1360
     * object before allowing the method to proceed.  If a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1361
     * <code>SecurityManager</code> exists and its
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1362
     * <code>checkPermission</code> method denies calling <code>abort</code>,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1363
     * this method throws a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1364
     * <code>java.lang.SecurityException</code>.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1365
     * @param executor  The <code>Executor</code>  implementation which will
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1366
     * be used by <code>abort</code>.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1367
     * @throws java.sql.SQLException if a database access error occurs or
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1368
     * the {@code executor} is {@code null},
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1369
     * @throws java.lang.SecurityException if a security manager exists and its
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1370
     *    <code>checkPermission</code> method denies calling <code>abort</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1371
     * @see SecurityManager#checkPermission
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1372
     * @see Executor
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1373
     * @since 1.7
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1374
     */
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1375
    void abort(Executor executor) throws SQLException;
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1376
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1377
    /**
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1378
     *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1379
     * Sets the maximum period a <code>Connection</code> or
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1380
     * objects created from the <code>Connection</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1381
     * will wait for the database to reply to any one request. If any
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1382
     *  request remains unanswered, the waiting method will
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1383
     * return with a <code>SQLException</code>, and the <code>Connection</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1384
     * or objects created from the <code>Connection</code>  will be marked as
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1385
     * closed. Any subsequent use of
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1386
     * the objects, with the exception of the <code>close</code>,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1387
     * <code>isClosed</code> or <code>Connection.isValid</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1388
     * methods, will result in  a <code>SQLException</code>.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1389
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1390
     * <b>Note</b>: This method is intended to address a rare but serious
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1391
     * condition where network partitions can cause threads issuing JDBC calls
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1392
     * to hang uninterruptedly in socket reads, until the OS TCP-TIMEOUT
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1393
     * (typically 10 minutes). This method is related to the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1394
     * {@link #abort abort() } method which provides an administrator
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1395
     * thread a means to free any such threads in cases where the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1396
     * JDBC connection is accessible to the administrator thread.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1397
     * The <code>setNetworkTimeout</code> method will cover cases where
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1398
     * there is no administrator thread, or it has no access to the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1399
     * connection. This method is severe in it's effects, and should be
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1400
     * given a high enough value so it is never triggered before any more
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1401
     * normal timeouts, such as transaction timeouts.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1402
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1403
     * JDBC driver implementations  may also choose to support the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1404
     * {@code setNetworkTimeout} method to impose a limit on database
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1405
     * response time, in environments where no network is present.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1406
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1407
     * Drivers may internally implement some or all of their API calls with
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1408
     * multiple internal driver-database transmissions, and it is left to the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1409
     * driver implementation to determine whether the limit will be
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1410
     * applied always to the response to the API call, or to any
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1411
     * single  request made during the API call.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1412
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1413
     *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1414
     * This method can be invoked more than once, such as to set a limit for an
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1415
     * area of JDBC code, and to reset to the default on exit from this area.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1416
     * Invocation of this method has no impact on already outstanding
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1417
     * requests.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1418
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1419
     * The {@code Statement.setQueryTimeout()} timeout value is independent of the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1420
     * timeout value specified in {@code setNetworkTimeout}. If the query timeout
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1421
     * expires  before the network timeout then the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1422
     * statement execution will be canceled. If the network is still
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1423
     * active the result will be that both the statement and connection
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1424
     * are still usable. However if the network timeout expires before
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1425
     * the query timeout or if the statement timeout fails due to network
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1426
     * problems, the connection will be marked as closed, any resources held by
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1427
     * the connection will be released and both the connection and
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1428
     * statement will be unusable.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 23010
diff changeset
  1429
     * <p>
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1430
     * When the driver determines that the {@code setNetworkTimeout} timeout
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1431
     * value has expired, the JDBC driver marks the connection
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1432
     * closed and releases any resources held by the connection.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1433
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1434
     *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1435
     * This method checks to see that there is an <code>SQLPermission</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1436
     * object before allowing the method to proceed.  If a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1437
     * <code>SecurityManager</code> exists and its
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1438
     * <code>checkPermission</code> method denies calling
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1439
     * <code>setNetworkTimeout</code>, this method throws a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1440
     * <code>java.lang.SecurityException</code>.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1441
     *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1442
     * @param executor  The <code>Executor</code>  implementation which will
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1443
     * be used by <code>setNetworkTimeout</code>.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1444
     * @param milliseconds The time in milliseconds to wait for the database
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1445
     * operation
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1446
     *  to complete.  If the JDBC driver does not support milliseconds, the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1447
     * JDBC driver will round the value up to the nearest second.  If the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1448
     * timeout period expires before the operation
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1449
     * completes, a SQLException will be thrown.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1450
     * A value of 0 indicates that there is not timeout for database operations.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1451
     * @throws java.sql.SQLException if a database access error occurs, this
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1452
     * method is called on a closed connection,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1453
     * the {@code executor} is {@code null},
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1454
     * or the value specified for <code>seconds</code> is less than 0.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1455
     * @throws java.lang.SecurityException if a security manager exists and its
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1456
     *    <code>checkPermission</code> method denies calling
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1457
     * <code>setNetworkTimeout</code>.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1458
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1459
     * this method
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1460
     * @see SecurityManager#checkPermission
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1461
     * @see Statement#setQueryTimeout
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1462
     * @see #getNetworkTimeout
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1463
     * @see #abort
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1464
     * @see Executor
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1465
     * @since 1.7
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1466
     */
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1467
    void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException;
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1468
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1469
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1470
    /**
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1471
     * Retrieves the number of milliseconds the driver will
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1472
     * wait for a database request to complete.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1473
     * If the limit is exceeded, a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1474
     * <code>SQLException</code> is thrown.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1475
     *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1476
     * @return the current timeout limit in milliseconds; zero means there is
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1477
     *         no limit
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1478
     * @throws SQLException if a database access error occurs or
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1479
     * this method is called on a closed <code>Connection</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1480
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1481
     * this method
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1482
     * @see #setNetworkTimeout
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1483
     * @since 1.7
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1484
     */
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1485
    int getNetworkTimeout() throws SQLException;
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1486
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1487
    // JDBC 4.3
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1488
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1489
     /**
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1490
     * Hints to the driver that a request, an independent unit of work, is beginning
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1491
     * on this connection. Each request is independent of all other requests
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1492
     * with regard to state local to the connection either on the client or the
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1493
     * server. Work done between {@code beginRequest}, {@code endRequest}
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1494
     * pairs does not depend on any other work done on the connection either as
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1495
     * part of another request or outside of any request. A request may include multiple
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1496
     * transactions. There may be dependencies on committed database state as
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1497
     * that is not local to the connection.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1498
     * <p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1499
     * Local state is defined as any state associated with a Connection that is
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1500
     * local to the current Connection either in the client or the database that
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1501
     * is not transparently reproducible.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1502
     * <p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1503
     * Calls to {@code beginRequest} and {@code endRequest}  are not nested.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1504
     * Multiple calls to {@code beginRequest} without an intervening call
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1505
     * to {@code endRequest} is not an error. The first {@code beginRequest} call
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1506
     * marks the start of the request and subsequent calls are treated as
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1507
     * a no-op
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1508
     * <p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1509
     * Use of {@code beginRequest} and {@code endRequest} is optional, vendor
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1510
     * specific and should largely be transparent. In particular
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1511
     * implementations may detect conditions that indicate dependence on
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1512
     * other work such as an open transaction. It is recommended though not
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1513
     * required that implementations throw a {@code SQLException} if there is an active
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1514
     * transaction and {@code beginRequest} is called.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1515
     * Using these methods may improve performance or provide other benefits.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1516
     * Consult your vendors documentation for additional information.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1517
     * <p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1518
     * It is recommended to
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1519
     * enclose each unit of work in {@code beginRequest}, {@code endRequest}
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1520
     * pairs such that there is no open transaction at the beginning or end of
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1521
     * the request and no dependency on local state that crosses request
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1522
     * boundaries. Committed database state is not local.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1523
     *
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1524
     * @implSpec
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1525
     * The default implementation is a no-op.
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 44550
diff changeset
  1526
     *
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1527
     * @apiNote
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1528
     * This method is to be used by Connection pooling managers.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1529
     * <p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1530
     * The pooling manager should call {@code beginRequest} on the underlying connection
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1531
     * prior to returning a connection to the caller.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1532
     * <p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1533
     * The pooling manager does not need to call {@code beginRequest} if:
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1534
     * <ul>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1535
     * <li>The connection pool caches {@code PooledConnection} objects</li>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1536
     * <li>Returns a logical connection handle when {@code getConnection} is
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1537
     * called by the application</li>
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1538
     * <li>The logical {@code Connection} is closed by calling
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1539
     * {@code Connection.close} prior to returning the {@code PooledConnection}
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1540
     * to the cache.</li>
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1541
     * </ul>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1542
     * @throws SQLException if an error occurs
35302
e4d2275861c3 8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents: 34338
diff changeset
  1543
     * @since 9
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1544
     * @see endRequest
33527
470a4770ccaf 8141546: Fix javadoc warnings in Connection due to 8136496
lancea
parents: 33524
diff changeset
  1545
     * @see javax.sql.PooledConnection
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1546
     */
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1547
    default void beginRequest() throws SQLException {
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1548
       // Default method takes no action
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1549
    }
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1550
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1551
    /**
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1552
     * Hints to the driver that a request, an independent unit of work,
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1553
     * has completed. Calls to {@code beginRequest}
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1554
     * and {@code endRequest} are not nested. Multiple
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1555
     * calls to {@code endRequest} without an intervening call to {@code beginRequest}
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1556
     * is not an error. The first {@code endRequest} call
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1557
     * marks the request completed and subsequent calls are treated as
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1558
     * a no-op. If {@code endRequest} is called without an initial call to
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1559
     * {@code beginRequest} is a no-op.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1560
     *<p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1561
     * The exact behavior of this method is vendor specific. In particular
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1562
     * implementations may detect conditions that indicate dependence on
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1563
     * other work such as an open transaction. It is recommended though not
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1564
     * required that implementations throw a {@code SQLException} if there is an active
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1565
     * transaction and {@code endRequest} is called.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1566
     *
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1567
     * @implSpec
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1568
     * The default implementation is a no-op.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1569
     * @apiNote
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1570
     *
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1571
     * This method is to be used by Connection pooling managers.
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1572
     * <p>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1573
     * The pooling manager should call {@code endRequest} on the underlying connection
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1574
     * when the applications returns the connection back to the connection pool.
33527
470a4770ccaf 8141546: Fix javadoc warnings in Connection due to 8136496
lancea
parents: 33524
diff changeset
  1575
     * <p>
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1576
     * The pooling manager does not need to call {@code endRequest} if:
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1577
     * <ul>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1578
     * <li>The connection pool caches {@code PooledConnection} objects</li>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1579
     * <li>Returns a logical connection handle when {@code getConnection} is
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1580
     * called by the application</li>
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1581
     * <li>The logical {@code Connection} is closed by calling
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1582
     * {@code Connection.close} prior to returning the {@code PooledConnection}
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1583
     * to the cache.</li>
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1584
     * </ul>
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1585
     * @throws SQLException if an error occurs
35302
e4d2275861c3 8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents: 34338
diff changeset
  1586
     * @since 9
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1587
     * @see beginRequest
33527
470a4770ccaf 8141546: Fix javadoc warnings in Connection due to 8136496
lancea
parents: 33524
diff changeset
  1588
     * @see javax.sql.PooledConnection
33524
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1589
     */
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1590
    default void endRequest() throws SQLException {
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1591
            // Default method takes no action
f42f1ed3be7f 8136496: Add Connection.begin/endRequest
lancea
parents: 27778
diff changeset
  1592
    }
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1593
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1594
    /**
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1595
     * Sets and validates the sharding keys for this connection. A {@code null}
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1596
     * value may be specified for the sharding Key. The validity
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1597
     * of a {@code null} sharding key is vendor-specific. Consult your vendor&#39;s
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1598
     * documentation for additional information.
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1599
     * @implSpec
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1600
     * The default implementation will throw a
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1601
     * {@code SQLFeatureNotSupportedException}.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1602
     *
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1603
     * @apiNote
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1604
     * This method validates that the sharding keys are valid for the
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1605
     * {@code Connection}. The timeout value indicates how long the driver
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1606
     * should wait for the {@code Connection} to verify that the sharding key
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1607
     * is valid before {@code setShardingKeyIfValid} returns false.
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1608
     * @param shardingKey the sharding key to be validated against this connection.
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1609
     * The sharding key may be {@code null}
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1610
     * @param superShardingKey the super sharding key to be validated against this
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1611
     * connection. The super sharding key may be {@code null}.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1612
     * @param timeout time in seconds before which the validation process is expected to
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1613
     * be completed, otherwise the validation process is aborted. A value of 0 indicates
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1614
     * the validation process will not time out.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1615
     * @return true if the connection is valid and the sharding keys are valid
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1616
     * and set on this connection; false if the sharding keys are not valid or
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1617
     * the timeout period expires before the operation completes.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1618
     * @throws SQLException if an error occurs while performing this validation;
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1619
     * a {@code superSharedingKey} is specified
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1620
     * without a {@code shardingKey};
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1621
     * this method is called on a closed {@code connection}; or
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1622
     * the {@code timeout} value is negative.
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1623
     * @throws SQLFeatureNotSupportedException if the driver does not support sharding
35302
e4d2275861c3 8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents: 34338
diff changeset
  1624
     * @since 9
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1625
     * @see ShardingKey
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1626
     * @see ShardingKeyBuilder
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1627
     */
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1628
    default boolean setShardingKeyIfValid(ShardingKey shardingKey,
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1629
            ShardingKey superShardingKey, int timeout)
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1630
            throws SQLException {
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1631
        throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented");
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1632
    }
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1633
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1634
    /**
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1635
     * Sets and validates the sharding key for this connection. A {@code null}
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1636
     * value may be specified for the sharding Key. The validity
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1637
     * of a {@code null} sharding key is vendor-specific. Consult your vendor&#39;s
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1638
     * documentation for additional information.
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1639
     * @implSpec
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1640
     * The default implementation will throw a
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1641
     * {@code SQLFeatureNotSupportedException}.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1642
     * @apiNote
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1643
     * This method validates  that the sharding key is valid for the
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1644
     * {@code Connection}. The timeout value indicates how long the driver
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1645
     * should wait for the {@code Connection} to verify that the sharding key
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1646
     * is valid before {@code setShardingKeyIfValid} returns false.
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1647
     * @param shardingKey the sharding key to be validated against this connection.
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1648
     * The sharding key may be {@code null}
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1649
     * @param timeout time in seconds before which the validation process is expected to
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1650
     * be completed,else the validation process is aborted. A value of 0 indicates
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1651
     * the validation process will not time out.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1652
     * @return true if the connection is valid and the sharding key is valid to be
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1653
     * set on this connection; false if the sharding key is not valid or
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1654
     * the timeout period expires before the operation completes.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1655
     * @throws SQLException if there is an error while performing this validation;
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1656
     * this method is called on a closed {@code connection};
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1657
     * or the {@code timeout} value is negative.
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1658
     * @throws SQLFeatureNotSupportedException if the driver does not support sharding
35302
e4d2275861c3 8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents: 34338
diff changeset
  1659
     * @since 9
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1660
     * @see ShardingKey
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1661
     * @see ShardingKeyBuilder
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1662
     */
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1663
    default boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout)
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1664
            throws SQLException {
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1665
        throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented");
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1666
    }
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1667
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1668
    /**
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1669
     * Specifies a shardingKey and superShardingKey to use with this Connection
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1670
     * @implSpec
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1671
     * The default implementation will throw a
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1672
     * {@code SQLFeatureNotSupportedException}.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1673
     * @apiNote
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1674
     * This method sets the specified sharding keys but does not require a
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1675
     * round trip to the database to validate that the sharding keys are valid
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1676
     * for the {@code Connection}.
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1677
     * @param shardingKey the sharding key to set on this connection. The sharding
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1678
     * key may be {@code null}
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1679
     * @param superShardingKey the super sharding key to set on this connection.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1680
     * The super sharding key may be {@code null}
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1681
     * @throws SQLException if an error  occurs setting the sharding keys;
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1682
     * this method is called on a closed {@code connection}; or
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1683
     * a {@code superSharedingKey} is specified without a {@code shardingKey}
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1684
     * @throws SQLFeatureNotSupportedException if the driver does not support sharding
35302
e4d2275861c3 8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents: 34338
diff changeset
  1685
     * @since 9
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1686
     * @see ShardingKey
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1687
     * @see ShardingKeyBuilder
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1688
     */
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1689
    default void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey)
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1690
            throws SQLException {
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1691
        throw new SQLFeatureNotSupportedException("setShardingKey not implemented");
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1692
    }
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1693
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1694
    /**
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1695
     * Specifies a shardingKey to use with this Connection
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1696
     * @implSpec
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1697
     * The default implementation will throw a
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1698
     * {@code SQLFeatureNotSupportedException}.
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1699
     * @apiNote
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1700
     * This method sets the specified sharding key but does not require a
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1701
     * round trip to the database to validate that the sharding key is valid
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1702
     * for the {@code Connection}.
44550
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1703
     * @param shardingKey the sharding key to set on this connection. The sharding
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1704
     * key may be {@code null}
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1705
     * @throws SQLException if an error occurs setting the sharding key; or
3cf6d3d8a12a 8178130: Minor update to the Connection javadocs
lancea
parents: 44256
diff changeset
  1706
     * this method is called on a closed {@code connection}
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1707
     * @throws SQLFeatureNotSupportedException if the driver does not support sharding
35302
e4d2275861c3 8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents: 34338
diff changeset
  1708
     * @since 9
34338
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1709
     * @see ShardingKey
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1710
     * @see ShardingKeyBuilder
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1711
     */
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1712
    default void setShardingKey(ShardingKey shardingKey)
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1713
            throws SQLException {
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1714
        throw new SQLFeatureNotSupportedException("setShardingKey not implemented");
67d0e5867568 8085984: Add JDBC Sharding API
lancea
parents: 33527
diff changeset
  1715
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
}