Path: blob/master/src/java.sql/share/classes/java/sql/PreparedStatement.java
41153 views
/*1* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.sql;2627import java.math.BigDecimal;28import java.util.Calendar;29import java.io.Reader;30import java.io.InputStream;3132/**33* An object that represents a precompiled SQL statement.34* <P>A SQL statement is precompiled and stored in a35* {@code PreparedStatement} object. This object can then be used to36* efficiently execute this statement multiple times.37*38* <P><B>Note:</B> The setter methods ({@code setShort}, {@code setString},39* and so on) for setting IN parameter values40* must specify types that are compatible with the defined SQL type of41* the input parameter. For instance, if the IN parameter has SQL type42* {@code INTEGER}, then the method {@code setInt} should be used.43*44* <p>If arbitrary parameter type conversions are required, the method45* {@code setObject} should be used with a target SQL type.46* <P>47* In the following example of setting a parameter, {@code con} represents48* an active connection:49* <pre>{@code50* BigDecimal sal = new BigDecimal("153833.00");51* PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES52* SET SALARY = ? WHERE ID = ?");53* pstmt.setBigDecimal(1, sal);54* pstmt.setInt(2, 110592);55* }</pre>56*57* @see Connection#prepareStatement58* @see ResultSet59* @since 1.160*/6162public interface PreparedStatement extends Statement {6364/**65* Executes the SQL query in this {@code PreparedStatement} object66* and returns the {@code ResultSet} object generated by the query.67*68* @return a {@code ResultSet} object that contains the data produced by the69* query; never {@code null}70* @throws SQLException if a database access error occurs;71* this method is called on a closed {@code PreparedStatement} or the SQL72* statement does not return a {@code ResultSet} object73* @throws SQLTimeoutException when the driver has determined that the74* timeout value that was specified by the {@code setQueryTimeout}75* method has been exceeded and has at least attempted to cancel76* the currently running {@code Statement}77*/78ResultSet executeQuery() throws SQLException;7980/**81* Executes the SQL statement in this {@code PreparedStatement} object,82* which must be an SQL Data Manipulation Language (DML) statement, such as {@code INSERT}, {@code UPDATE} or83* {@code DELETE}; or an SQL statement that returns nothing,84* such as a DDL statement.85*86* @return either (1) the row count for SQL Data Manipulation Language (DML) statements87* or (2) 0 for SQL statements that return nothing88* @throws SQLException if a database access error occurs;89* this method is called on a closed {@code PreparedStatement}90* or the SQL statement returns a {@code ResultSet} object91* @throws SQLTimeoutException when the driver has determined that the92* timeout value that was specified by the {@code setQueryTimeout}93* method has been exceeded and has at least attempted to cancel94* the currently running {@code Statement}95*/96int executeUpdate() throws SQLException;9798/**99* Sets the designated parameter to SQL {@code NULL}.100*101* <P><B>Note:</B> You must specify the parameter's SQL type.102*103* @param parameterIndex the first parameter is 1, the second is 2, ...104* @param sqlType the SQL type code defined in {@code java.sql.Types}105* @throws SQLException if parameterIndex does not correspond to a parameter106* marker in the SQL statement; if a database access error occurs or107* this method is called on a closed {@code PreparedStatement}108* @throws SQLFeatureNotSupportedException if {@code sqlType} is109* a {@code ARRAY}, {@code BLOB}, {@code CLOB},110* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},111* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},112* {@code REF}, {@code ROWID}, {@code SQLXML}113* or {@code STRUCT} data type and the JDBC driver does not support114* this data type115*/116void setNull(int parameterIndex, int sqlType) throws SQLException;117118/**119* Sets the designated parameter to the given Java {@code boolean} value.120* The driver converts this121* to an SQL {@code BIT} or {@code BOOLEAN} value when it sends it to the database.122*123* @param parameterIndex the first parameter is 1, the second is 2, ...124* @param x the parameter value125* @throws SQLException if parameterIndex does not correspond to a parameter126* marker in the SQL statement;127* if a database access error occurs or128* this method is called on a closed {@code PreparedStatement}129*/130void setBoolean(int parameterIndex, boolean x) throws SQLException;131132/**133* Sets the designated parameter to the given Java {@code byte} value.134* The driver converts this135* to an SQL {@code TINYINT} value when it sends it to the database.136*137* @param parameterIndex the first parameter is 1, the second is 2, ...138* @param x the parameter value139* @throws SQLException if parameterIndex does not correspond to a parameter140* marker in the SQL statement; if a database access error occurs or141* this method is called on a closed {@code PreparedStatement}142*/143void setByte(int parameterIndex, byte x) throws SQLException;144145/**146* Sets the designated parameter to the given Java {@code short} value.147* The driver converts this148* to an SQL {@code SMALLINT} value when it sends it to the database.149*150* @param parameterIndex the first parameter is 1, the second is 2, ...151* @param x the parameter value152* @throws SQLException if parameterIndex does not correspond to a parameter153* marker in the SQL statement; if a database access error occurs or154* this method is called on a closed {@code PreparedStatement}155*/156void setShort(int parameterIndex, short x) throws SQLException;157158/**159* Sets the designated parameter to the given Java {@code int} value.160* The driver converts this161* to an SQL {@code INTEGER} value when it sends it to the database.162*163* @param parameterIndex the first parameter is 1, the second is 2, ...164* @param x the parameter value165* @throws SQLException if parameterIndex does not correspond to a parameter166* marker in the SQL statement; if a database access error occurs or167* this method is called on a closed {@code PreparedStatement}168*/169void setInt(int parameterIndex, int x) throws SQLException;170171/**172* Sets the designated parameter to the given Java {@code long} value.173* The driver converts this174* to an SQL {@code BIGINT} value when it sends it to the database.175*176* @param parameterIndex the first parameter is 1, the second is 2, ...177* @param x the parameter value178* @throws SQLException if parameterIndex does not correspond to a parameter179* marker in the SQL statement; if a database access error occurs or180* this method is called on a closed {@code PreparedStatement}181*/182void setLong(int parameterIndex, long x) throws SQLException;183184/**185* Sets the designated parameter to the given Java {@code float} value.186* The driver converts this187* to an SQL {@code REAL} value when it sends it to the database.188*189* @param parameterIndex the first parameter is 1, the second is 2, ...190* @param x the parameter value191* @throws SQLException if parameterIndex does not correspond to a parameter192* marker in the SQL statement; if a database access error occurs or193* this method is called on a closed {@code PreparedStatement}194*/195void setFloat(int parameterIndex, float x) throws SQLException;196197/**198* Sets the designated parameter to the given Java {@code double} value.199* The driver converts this200* to an SQL {@code DOUBLE} value when it sends it to the database.201*202* @param parameterIndex the first parameter is 1, the second is 2, ...203* @param x the parameter value204* @throws SQLException if parameterIndex does not correspond to a parameter205* marker in the SQL statement; if a database access error occurs or206* this method is called on a closed {@code PreparedStatement}207*/208void setDouble(int parameterIndex, double x) throws SQLException;209210/**211* Sets the designated parameter to the given {@code java.math.BigDecimal} value.212* The driver converts this to an SQL {@code NUMERIC} value when213* it sends it to the database.214*215* @param parameterIndex the first parameter is 1, the second is 2, ...216* @param x the parameter value217* @throws SQLException if parameterIndex does not correspond to a parameter218* marker in the SQL statement; if a database access error occurs or219* this method is called on a closed {@code PreparedStatement}220*/221void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;222223/**224* Sets the designated parameter to the given Java {@code String} value.225* The driver converts this226* to an SQL {@code VARCHAR} or {@code LONGVARCHAR} value227* (depending on the argument's228* size relative to the driver's limits on {@code VARCHAR} values)229* when it sends it to the database.230*231* @param parameterIndex the first parameter is 1, the second is 2, ...232* @param x the parameter value233* @throws SQLException if parameterIndex does not correspond to a parameter234* marker in the SQL statement; if a database access error occurs or235* this method is called on a closed {@code PreparedStatement}236*/237void setString(int parameterIndex, String x) throws SQLException;238239/**240* Sets the designated parameter to the given Java array of bytes. The driver converts241* this to an SQL {@code VARBINARY} or {@code LONGVARBINARY}242* (depending on the argument's size relative to the driver's limits on243* {@code VARBINARY} values) when it sends it to the database.244*245* @param parameterIndex the first parameter is 1, the second is 2, ...246* @param x the parameter value247* @throws SQLException if parameterIndex does not correspond to a parameter248* marker in the SQL statement; if a database access error occurs or249* this method is called on a closed {@code PreparedStatement}250*/251void setBytes(int parameterIndex, byte x[]) throws SQLException;252253/**254* Sets the designated parameter to the given {@code java.sql.Date} value255* using the default time zone of the virtual machine that is running256* the application.257* The driver converts this258* to an SQL {@code DATE} value when it sends it to the database.259*260* @param parameterIndex the first parameter is 1, the second is 2, ...261* @param x the parameter value262* @throws SQLException if parameterIndex does not correspond to a parameter263* marker in the SQL statement; if a database access error occurs or264* this method is called on a closed {@code PreparedStatement}265*/266void setDate(int parameterIndex, java.sql.Date x)267throws SQLException;268269/**270* Sets the designated parameter to the given {@code java.sql.Time} value.271* The driver converts this272* to an SQL {@code TIME} value when it sends it to the database.273*274* @param parameterIndex the first parameter is 1, the second is 2, ...275* @param x the parameter value276* @throws SQLException if parameterIndex does not correspond to a parameter277* marker in the SQL statement; if a database access error occurs or278* this method is called on a closed {@code PreparedStatement}279*/280void setTime(int parameterIndex, java.sql.Time x)281throws SQLException;282283/**284* Sets the designated parameter to the given {@code java.sql.Timestamp} value.285* The driver286* converts this to an SQL {@code TIMESTAMP} value when it sends it to the287* database.288*289* @param parameterIndex the first parameter is 1, the second is 2, ...290* @param x the parameter value291* @throws SQLException if parameterIndex does not correspond to a parameter292* marker in the SQL statement; if a database access error occurs or293* this method is called on a closed {@code PreparedStatement} */294void setTimestamp(int parameterIndex, java.sql.Timestamp x)295throws SQLException;296297/**298* Sets the designated parameter to the given input stream, which will have299* the specified number of bytes.300* When a very large ASCII value is input to a {@code LONGVARCHAR}301* parameter, it may be more practical to send it via a302* {@code java.io.InputStream}. Data will be read from the stream303* as needed until end-of-file is reached. The JDBC driver will304* do any necessary conversion from ASCII to the database char format.305*306* <P><B>Note:</B> This stream object can either be a standard307* Java stream object or your own subclass that implements the308* standard interface.309*310* @param parameterIndex the first parameter is 1, the second is 2, ...311* @param x the Java input stream that contains the ASCII parameter value312* @param length the number of bytes in the stream313* @throws SQLException if parameterIndex does not correspond to a parameter314* marker in the SQL statement; if a database access error occurs or315* this method is called on a closed {@code PreparedStatement}316*/317void setAsciiStream(int parameterIndex, java.io.InputStream x, int length)318throws SQLException;319320/**321* Sets the designated parameter to the given input stream, which322* will have the specified number of bytes.323*324* When a very large Unicode value is input to a {@code LONGVARCHAR}325* parameter, it may be more practical to send it via a326* {@code java.io.InputStream} object. The data will be read from the327* stream as needed until end-of-file is reached. The JDBC driver will328* do any necessary conversion from Unicode to the database char format.329*330*The byte format of the Unicode stream must be a Java UTF-8, as defined in the331*Java Virtual Machine Specification.332*333* <P><B>Note:</B> This stream object can either be a standard334* Java stream object or your own subclass that implements the335* standard interface.336*337* @param parameterIndex the first parameter is 1, the second is 2, ...338* @param x a {@code java.io.InputStream} object that contains the339* Unicode parameter value340* @param length the number of bytes in the stream341* @throws SQLException if parameterIndex does not correspond to a parameter342* marker in the SQL statement; if a database access error occurs or343* this method is called on a closed {@code PreparedStatement}344* @throws SQLFeatureNotSupportedException if the JDBC driver does not support345* this method346* @deprecated Use {@code setCharacterStream}347*/348@Deprecated(since="1.2")349void setUnicodeStream(int parameterIndex, java.io.InputStream x,350int length) throws SQLException;351352/**353* Sets the designated parameter to the given input stream, which will have354* the specified number of bytes.355* When a very large binary value is input to a {@code LONGVARBINARY}356* parameter, it may be more practical to send it via a357* {@code java.io.InputStream} object. The data will be read from the358* stream as needed until end-of-file is reached.359*360* <P><B>Note:</B> This stream object can either be a standard361* Java stream object or your own subclass that implements the362* standard interface.363*364* @param parameterIndex the first parameter is 1, the second is 2, ...365* @param x the java input stream which contains the binary parameter value366* @param length the number of bytes in the stream367* @throws SQLException if parameterIndex does not correspond to a parameter368* marker in the SQL statement; if a database access error occurs or369* this method is called on a closed {@code PreparedStatement}370*/371void setBinaryStream(int parameterIndex, java.io.InputStream x,372int length) throws SQLException;373374/**375* Clears the current parameter values immediately.376* <P>In general, parameter values remain in force for repeated use of a377* statement. Setting a parameter value automatically clears its378* previous value. However, in some cases it is useful to immediately379* release the resources used by the current parameter values; this can380* be done by calling the method {@code clearParameters}.381*382* @throws SQLException if a database access error occurs or383* this method is called on a closed {@code PreparedStatement}384*/385void clearParameters() throws SQLException;386387//----------------------------------------------------------------------388// Advanced features:389390/**391* Sets the value of the designated parameter with the given object.392*393* This method is similar to {@link #setObject(int parameterIndex,394* Object x, int targetSqlType, int scaleOrLength)},395* except that it assumes a scale of zero.396*397* @param parameterIndex the first parameter is 1, the second is 2, ...398* @param x the object containing the input parameter value399* @param targetSqlType the SQL type (as defined in java.sql.Types) to be400* sent to the database401* @throws SQLException if parameterIndex does not correspond to a parameter402* marker in the SQL statement; if a database access error occurs or this403* method is called on a closed PreparedStatement404* @throws SQLFeatureNotSupportedException if405* the JDBC driver does not support the specified targetSqlType406* @see Types407*/408void setObject(int parameterIndex, Object x, int targetSqlType)409throws SQLException;410411/**412* <p>Sets the value of the designated parameter using the given object.413*414* <p>The JDBC specification specifies a standard mapping from415* Java {@code Object} types to SQL types. The given argument416* will be converted to the corresponding SQL type before being417* sent to the database.418*419* <p>Note that this method may be used to pass database-420* specific abstract data types, by using a driver-specific Java421* type.422*423* If the object is of a class implementing the interface {@code SQLData},424* the JDBC driver should call the method {@code SQLData.writeSQL}425* to write it to the SQL data stream.426* If, on the other hand, the object is of a class implementing427* {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},428* {@code Struct}, {@code java.net.URL}, {@code RowId}, {@code SQLXML}429* or {@code Array}, the driver should pass it to the database as a430* value of the corresponding SQL type.431* <P>432*<b>Note:</b> Not all databases allow for a non-typed Null to be sent to433* the backend. For maximum portability, the {@code setNull} or the434* {@code setObject(int parameterIndex, Object x, int sqlType)}435* method should be used436* instead of {@code setObject(int parameterIndex, Object x)}.437*<p>438* <b>Note:</b> This method throws an exception if there is an ambiguity, for example, if the439* object is of a class implementing more than one of the interfaces named above.440*441* @param parameterIndex the first parameter is 1, the second is 2, ...442* @param x the object containing the input parameter value443* @throws SQLException if parameterIndex does not correspond to a parameter444* marker in the SQL statement; if a database access error occurs;445* this method is called on a closed {@code PreparedStatement}446* or the type of the given object is ambiguous447*/448void setObject(int parameterIndex, Object x) throws SQLException;449450/**451* Executes the SQL statement in this {@code PreparedStatement} object,452* which may be any kind of SQL statement.453* Some prepared statements return multiple results; the {@code execute}454* method handles these complex statements as well as the simpler455* form of statements handled by the methods {@code executeQuery}456* and {@code executeUpdate}.457* <P>458* The {@code execute} method returns a {@code boolean} to459* indicate the form of the first result. You must call either the method460* {@code getResultSet} or {@code getUpdateCount}461* to retrieve the result; you must call {@code getMoreResults} to462* move to any subsequent result(s).463*464* @return {@code true} if the first result is a {@code ResultSet}465* object; {@code false} if the first result is an update466* count or there is no result467* @throws SQLException if a database access error occurs;468* this method is called on a closed {@code PreparedStatement}469* or an argument is supplied to this method470* @throws SQLTimeoutException when the driver has determined that the471* timeout value that was specified by the {@code setQueryTimeout}472* method has been exceeded and has at least attempted to cancel473* the currently running {@code Statement}474* @see Statement#execute475* @see Statement#getResultSet476* @see Statement#getUpdateCount477* @see Statement#getMoreResults478479*/480boolean execute() throws SQLException;481482//--------------------------JDBC 2.0-----------------------------483484/**485* Adds a set of parameters to this {@code PreparedStatement}486* object's batch of commands.487*488* @throws SQLException if a database access error occurs or489* this method is called on a closed {@code PreparedStatement}490* @see Statement#addBatch491* @since 1.2492*/493void addBatch() throws SQLException;494495/**496* Sets the designated parameter to the given {@code Reader}497* object, which is the given number of characters long.498* When a very large UNICODE value is input to a {@code LONGVARCHAR}499* parameter, it may be more practical to send it via a500* {@code java.io.Reader} object. The data will be read from the stream501* as needed until end-of-file is reached. The JDBC driver will502* do any necessary conversion from UNICODE to the database char format.503*504* <P><B>Note:</B> This stream object can either be a standard505* Java stream object or your own subclass that implements the506* standard interface.507*508* @param parameterIndex the first parameter is 1, the second is 2, ...509* @param reader the {@code java.io.Reader} object that contains the510* Unicode data511* @param length the number of characters in the stream512* @throws SQLException if parameterIndex does not correspond to a parameter513* marker in the SQL statement; if a database access error occurs or514* this method is called on a closed {@code PreparedStatement}515* @since 1.2516*/517void setCharacterStream(int parameterIndex,518java.io.Reader reader,519int length) throws SQLException;520521/**522* Sets the designated parameter to the given523* {@code REF(<structured-type>)} value.524* The driver converts this to an SQL {@code REF} value when it525* sends it to the database.526*527* @param parameterIndex the first parameter is 1, the second is 2, ...528* @param x an SQL {@code REF} value529* @throws SQLException if parameterIndex does not correspond to a parameter530* marker in the SQL statement; if a database access error occurs or531* this method is called on a closed {@code PreparedStatement}532* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method533* @since 1.2534*/535void setRef (int parameterIndex, Ref x) throws SQLException;536537/**538* Sets the designated parameter to the given {@code java.sql.Blob} object.539* The driver converts this to an SQL {@code BLOB} value when it540* sends it to the database.541*542* @param parameterIndex the first parameter is 1, the second is 2, ...543* @param x a {@code Blob} object that maps an SQL {@code BLOB} value544* @throws SQLException if parameterIndex does not correspond to a parameter545* marker in the SQL statement; if a database access error occurs or546* this method is called on a closed {@code PreparedStatement}547* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method548* @since 1.2549*/550void setBlob (int parameterIndex, Blob x) throws SQLException;551552/**553* Sets the designated parameter to the given {@code java.sql.Clob} object.554* The driver converts this to an SQL {@code CLOB} value when it555* sends it to the database.556*557* @param parameterIndex the first parameter is 1, the second is 2, ...558* @param x a {@code Clob} object that maps an SQL {@code CLOB} value559* @throws SQLException if parameterIndex does not correspond to a parameter560* marker in the SQL statement; if a database access error occurs or561* this method is called on a closed {@code PreparedStatement}562* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method563* @since 1.2564*/565void setClob (int parameterIndex, Clob x) throws SQLException;566567/**568* Sets the designated parameter to the given {@code java.sql.Array} object.569* The driver converts this to an SQL {@code ARRAY} value when it570* sends it to the database.571*572* @param parameterIndex the first parameter is 1, the second is 2, ...573* @param x an {@code Array} object that maps an SQL {@code ARRAY} value574* @throws SQLException if parameterIndex does not correspond to a parameter575* marker in the SQL statement; if a database access error occurs or576* this method is called on a closed {@code PreparedStatement}577* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method578* @since 1.2579*/580void setArray (int parameterIndex, Array x) throws SQLException;581582/**583* Retrieves a {@code ResultSetMetaData} object that contains584* information about the columns of the {@code ResultSet} object585* that will be returned when this {@code PreparedStatement} object586* is executed.587* <P>588* Because a {@code PreparedStatement} object is precompiled, it is589* possible to know about the {@code ResultSet} object that it will590* return without having to execute it. Consequently, it is possible591* to invoke the method {@code getMetaData} on a592* {@code PreparedStatement} object rather than waiting to execute593* it and then invoking the {@code ResultSet.getMetaData} method594* on the {@code ResultSet} object that is returned.595* <P>596* <B>NOTE:</B> Using this method may be expensive for some drivers due597* to the lack of underlying DBMS support.598*599* @return the description of a {@code ResultSet} object's columns or600* {@code null} if the driver cannot return a601* {@code ResultSetMetaData} object602* @throws SQLException if a database access error occurs or603* this method is called on a closed {@code PreparedStatement}604* @throws SQLFeatureNotSupportedException if the JDBC driver does not support605* this method606* @since 1.2607*/608ResultSetMetaData getMetaData() throws SQLException;609610/**611* Sets the designated parameter to the given {@code java.sql.Date} value,612* using the given {@code Calendar} object. The driver uses613* the {@code Calendar} object to construct an SQL {@code DATE} value,614* which the driver then sends to the database. With615* a {@code Calendar} object, the driver can calculate the date616* taking into account a custom timezone. If no617* {@code Calendar} object is specified, the driver uses the default618* timezone, which is that of the virtual machine running the application.619*620* @param parameterIndex the first parameter is 1, the second is 2, ...621* @param x the parameter value622* @param cal the {@code Calendar} object the driver will use623* to construct the date624* @throws SQLException if parameterIndex does not correspond to a parameter625* marker in the SQL statement; if a database access error occurs or626* this method is called on a closed {@code PreparedStatement}627* @since 1.2628*/629void setDate(int parameterIndex, java.sql.Date x, Calendar cal)630throws SQLException;631632/**633* Sets the designated parameter to the given {@code java.sql.Time} value,634* using the given {@code Calendar} object. The driver uses635* the {@code Calendar} object to construct an SQL {@code TIME} value,636* which the driver then sends to the database. With637* a {@code Calendar} object, the driver can calculate the time638* taking into account a custom timezone. If no639* {@code Calendar} object is specified, the driver uses the default640* timezone, which is that of the virtual machine running the application.641*642* @param parameterIndex the first parameter is 1, the second is 2, ...643* @param x the parameter value644* @param cal the {@code Calendar} object the driver will use645* to construct the time646* @throws SQLException if parameterIndex does not correspond to a parameter647* marker in the SQL statement; if a database access error occurs or648* this method is called on a closed {@code PreparedStatement}649* @since 1.2650*/651void setTime(int parameterIndex, java.sql.Time x, Calendar cal)652throws SQLException;653654/**655* Sets the designated parameter to the given {@code java.sql.Timestamp} value,656* using the given {@code Calendar} object. The driver uses657* the {@code Calendar} object to construct an SQL {@code TIMESTAMP} value,658* which the driver then sends to the database. With a659* {@code Calendar} object, the driver can calculate the timestamp660* taking into account a custom timezone. If no661* {@code Calendar} object is specified, the driver uses the default662* timezone, which is that of the virtual machine running the application.663*664* @param parameterIndex the first parameter is 1, the second is 2, ...665* @param x the parameter value666* @param cal the {@code Calendar} object the driver will use667* to construct the timestamp668* @throws SQLException if parameterIndex does not correspond to a parameter669* marker in the SQL statement; if a database access error occurs or670* this method is called on a closed {@code PreparedStatement}671* @since 1.2672*/673void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal)674throws SQLException;675676/**677* Sets the designated parameter to SQL {@code NULL}.678* This version of the method {@code setNull} should679* be used for user-defined types and REF type parameters. Examples680* of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and681* named array types.682*683* <P><B>Note:</B> To be portable, applications must give the684* SQL type code and the fully-qualified SQL type name when specifying685* a NULL user-defined or REF parameter. In the case of a user-defined type686* the name is the type name of the parameter itself. For a REF687* parameter, the name is the type name of the referenced type. If688* a JDBC driver does not need the type code or type name information,689* it may ignore it.690*691* Although it is intended for user-defined and Ref parameters,692* this method may be used to set a null parameter of any JDBC type.693* If the parameter does not have a user-defined or REF type, the given694* typeName is ignored.695*696*697* @param parameterIndex the first parameter is 1, the second is 2, ...698* @param sqlType a value from {@code java.sql.Types}699* @param typeName the fully-qualified name of an SQL user-defined type;700* ignored if the parameter is not a user-defined type or REF701* @throws SQLException if parameterIndex does not correspond to a parameter702* marker in the SQL statement; if a database access error occurs or703* this method is called on a closed {@code PreparedStatement}704* @throws SQLFeatureNotSupportedException if {@code sqlType} is705* a {@code ARRAY}, {@code BLOB}, {@code CLOB},706* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},707* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},708* {@code REF}, {@code ROWID}, {@code SQLXML}709* or {@code STRUCT} data type and the JDBC driver does not support710* this data type or if the JDBC driver does not support this method711* @since 1.2712*/713void setNull (int parameterIndex, int sqlType, String typeName)714throws SQLException;715716//------------------------- JDBC 3.0 -----------------------------------717718/**719* Sets the designated parameter to the given {@code java.net.URL} value.720* The driver converts this to an SQL {@code DATALINK} value721* when it sends it to the database.722*723* @param parameterIndex the first parameter is 1, the second is 2, ...724* @param x the {@code java.net.URL} object to be set725* @throws SQLException if parameterIndex does not correspond to a parameter726* marker in the SQL statement; if a database access error occurs or727* this method is called on a closed {@code PreparedStatement}728* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method729* @since 1.4730*/731void setURL(int parameterIndex, java.net.URL x) throws SQLException;732733/**734* Retrieves the number, types and properties of this735* {@code PreparedStatement} object's parameters.736*737* @return a {@code ParameterMetaData} object that contains information738* about the number, types and properties for each739* parameter marker of this {@code PreparedStatement} object740* @throws SQLException if a database access error occurs or741* this method is called on a closed {@code PreparedStatement}742* @see ParameterMetaData743* @since 1.4744*/745ParameterMetaData getParameterMetaData() throws SQLException;746747//------------------------- JDBC 4.0 -----------------------------------748749/**750* Sets the designated parameter to the given {@code java.sql.RowId} object. The751* driver converts this to a SQL {@code ROWID} value when it sends it752* to the database753*754* @param parameterIndex the first parameter is 1, the second is 2, ...755* @param x the parameter value756* @throws SQLException if parameterIndex does not correspond to a parameter757* marker in the SQL statement; if a database access error occurs or758* this method is called on a closed {@code PreparedStatement}759* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method760*761* @since 1.6762*/763void setRowId(int parameterIndex, RowId x) throws SQLException;764765766/**767* Sets the designated parameter to the given {@code String} object.768* The driver converts this to a SQL {@code NCHAR} or769* {@code NVARCHAR} or {@code LONGNVARCHAR} value770* (depending on the argument's771* size relative to the driver's limits on {@code NVARCHAR} values)772* when it sends it to the database.773*774* @param parameterIndex of the first parameter is 1, the second is 2, ...775* @param value the parameter value776* @throws SQLException if parameterIndex does not correspond to a parameter777* marker in the SQL statement; if the driver does not support national778* character sets; if the driver can detect that a data conversion779* error could occur; if a database access error occurs; or780* this method is called on a closed {@code PreparedStatement}781* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method782* @since 1.6783*/784void setNString(int parameterIndex, String value) throws SQLException;785786/**787* Sets the designated parameter to a {@code Reader} object. The788* {@code Reader} reads the data till end-of-file is reached. The789* driver does the necessary conversion from Java character format to790* the national character set in the database.791* @param parameterIndex of the first parameter is 1, the second is 2, ...792* @param value the parameter value793* @param length the number of characters in the parameter data.794* @throws SQLException if parameterIndex does not correspond to a parameter795* marker in the SQL statement; if the driver does not support national796* character sets; if the driver can detect that a data conversion797* error could occur; if a database access error occurs; or798* this method is called on a closed {@code PreparedStatement}799* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method800* @since 1.6801*/802void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException;803804/**805* Sets the designated parameter to a {@code java.sql.NClob} object. The driver converts this to a806* SQL {@code NCLOB} value when it sends it to the database.807* @param parameterIndex of the first parameter is 1, the second is 2, ...808* @param value the parameter value809* @throws SQLException if parameterIndex does not correspond to a parameter810* marker in the SQL statement; if the driver does not support national811* character sets; if the driver can detect that a data conversion812* error could occur; if a database access error occurs; or813* this method is called on a closed {@code PreparedStatement}814* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method815* @since 1.6816*/817void setNClob(int parameterIndex, NClob value) throws SQLException;818819/**820* Sets the designated parameter to a {@code Reader} object. The reader must contain the number821* of characters specified by length otherwise a {@code SQLException} will be822* generated when the {@code PreparedStatement} is executed.823*This method differs from the {@code setCharacterStream (int, Reader, int)} method824* because it informs the driver that the parameter value should be sent to825* the server as a {@code CLOB}. When the {@code setCharacterStream} method is used, the826* driver may have to do extra work to determine whether the parameter827* data should be sent to the server as a {@code LONGVARCHAR} or a {@code CLOB}828* @param parameterIndex index of the first parameter is 1, the second is 2, ...829* @param reader An object that contains the data to set the parameter value to.830* @param length the number of characters in the parameter data.831* @throws SQLException if parameterIndex does not correspond to a parameter832* marker in the SQL statement; if a database access error occurs; this method is called on833* a closed {@code PreparedStatement} or if the length specified is less than zero.834*835* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method836* @since 1.6837*/838void setClob(int parameterIndex, Reader reader, long length)839throws SQLException;840841/**842* Sets the designated parameter to a {@code InputStream} object.843* The {@code Inputstream} must contain the number844* of characters specified by length otherwise a {@code SQLException} will be845* generated when the {@code PreparedStatement} is executed.846* This method differs from the {@code setBinaryStream (int, InputStream, int)}847* method because it informs the driver that the parameter value should be848* sent to the server as a {@code BLOB}. When the {@code setBinaryStream} method is used,849* the driver may have to do extra work to determine whether the parameter850* data should be sent to the server as a {@code LONGVARBINARY} or a {@code BLOB}851* @param parameterIndex index of the first parameter is 1,852* the second is 2, ...853* @param inputStream An object that contains the data to set the parameter854* value to.855* @param length the number of bytes in the parameter data.856* @throws SQLException if parameterIndex does not correspond to a parameter857* marker in the SQL statement; if a database access error occurs;858* this method is called on a closed {@code PreparedStatement};859* if the length specified860* is less than zero or if the number of bytes in the {@code InputStream} does not match861* the specified length.862* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method863*864* @since 1.6865*/866void setBlob(int parameterIndex, InputStream inputStream, long length)867throws SQLException;868/**869* Sets the designated parameter to a {@code Reader} object. The reader must contain the number870* of characters specified by length otherwise a {@code SQLException} will be871* generated when the {@code PreparedStatement} is executed.872* This method differs from the {@code setCharacterStream (int, Reader, int)} method873* because it informs the driver that the parameter value should be sent to874* the server as a {@code NCLOB}. When the {@code setCharacterStream} method is used, the875* driver may have to do extra work to determine whether the parameter876* data should be sent to the server as a {@code LONGNVARCHAR} or a {@code NCLOB}877* @param parameterIndex index of the first parameter is 1, the second is 2, ...878* @param reader An object that contains the data to set the parameter value to.879* @param length the number of characters in the parameter data.880* @throws SQLException if parameterIndex does not correspond to a parameter881* marker in the SQL statement; if the length specified is less than zero;882* if the driver does not support national character sets;883* if the driver can detect that a data conversion884* error could occur; if a database access error occurs or885* this method is called on a closed {@code PreparedStatement}886* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method887*888* @since 1.6889*/890void setNClob(int parameterIndex, Reader reader, long length)891throws SQLException;892893/**894* Sets the designated parameter to the given {@code java.sql.SQLXML} object.895* The driver converts this to an896* SQL {@code XML} value when it sends it to the database.897*898* @param parameterIndex index of the first parameter is 1, the second is 2, ...899* @param xmlObject a {@code SQLXML} object that maps an SQL {@code XML} value900* @throws SQLException if parameterIndex does not correspond to a parameter901* marker in the SQL statement; if a database access error occurs;902* this method is called on a closed {@code PreparedStatement}903* or the {@code java.xml.transform.Result},904* {@code Writer} or {@code OutputStream} has not been closed for905* the {@code SQLXML} object906* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method907*908* @since 1.6909*/910void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException;911912/**913* <p>Sets the value of the designated parameter with the given object.914*915* If the second argument is an {@code InputStream} then the stream must contain916* the number of bytes specified by scaleOrLength. If the second argument is a917* {@code Reader} then the reader must contain the number of characters specified918* by scaleOrLength. If these conditions are not true the driver will generate a919* {@code SQLException} when the prepared statement is executed.920*921* <p>The given Java object will be converted to the given targetSqlType922* before being sent to the database.923*924* If the object has a custom mapping (is of a class implementing the925* interface {@code SQLData}),926* the JDBC driver should call the method {@code SQLData.writeSQL} to927* write it to the SQL data stream.928* If, on the other hand, the object is of a class implementing929* {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},930* {@code Struct}, {@code java.net.URL},931* or {@code Array}, the driver should pass it to the database as a932* value of the corresponding SQL type.933*934* <p>Note that this method may be used to pass database-specific935* abstract data types.936*937* @param parameterIndex the first parameter is 1, the second is 2, ...938* @param x the object containing the input parameter value939* @param targetSqlType the SQL type (as defined in java.sql.Types) to be940* sent to the database. The scale argument may further qualify this type.941* @param scaleOrLength for {@code java.sql.Types.DECIMAL}942* or {@code java.sql.Types.NUMERIC types},943* this is the number of digits after the decimal point. For944* Java Object types {@code InputStream} and {@code Reader},945* this is the length946* of the data in the stream or reader. For all other types,947* this value will be ignored.948* @throws SQLException if parameterIndex does not correspond to a parameter949* marker in the SQL statement; if a database access error occurs;950* this method is called on a closed {@code PreparedStatement} or951* if the Java Object specified by x is an InputStream952* or Reader object and the value of the scale parameter is less953* than zero954* @throws SQLFeatureNotSupportedException if955* the JDBC driver does not support the specified targetSqlType956* @see Types957*958*/959void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)960throws SQLException;961/**962* Sets the designated parameter to the given input stream, which will have963* the specified number of bytes.964* When a very large ASCII value is input to a {@code LONGVARCHAR}965* parameter, it may be more practical to send it via a966* {@code java.io.InputStream}. Data will be read from the stream967* as needed until end-of-file is reached. The JDBC driver will968* do any necessary conversion from ASCII to the database char format.969*970* <P><B>Note:</B> This stream object can either be a standard971* Java stream object or your own subclass that implements the972* standard interface.973*974* @param parameterIndex the first parameter is 1, the second is 2, ...975* @param x the Java input stream that contains the ASCII parameter value976* @param length the number of bytes in the stream977* @throws SQLException if parameterIndex does not correspond to a parameter978* marker in the SQL statement; if a database access error occurs or979* this method is called on a closed {@code PreparedStatement}980* @since 1.6981*/982void setAsciiStream(int parameterIndex, java.io.InputStream x, long length)983throws SQLException;984/**985* Sets the designated parameter to the given input stream, which will have986* the specified number of bytes.987* When a very large binary value is input to a {@code LONGVARBINARY}988* parameter, it may be more practical to send it via a989* {@code java.io.InputStream} object. The data will be read from the990* stream as needed until end-of-file is reached.991*992* <P><B>Note:</B> This stream object can either be a standard993* Java stream object or your own subclass that implements the994* standard interface.995*996* @param parameterIndex the first parameter is 1, the second is 2, ...997* @param x the java input stream which contains the binary parameter value998* @param length the number of bytes in the stream999* @throws SQLException if parameterIndex does not correspond to a parameter1000* marker in the SQL statement; if a database access error occurs or1001* this method is called on a closed {@code PreparedStatement}1002* @since 1.61003*/1004void setBinaryStream(int parameterIndex, java.io.InputStream x,1005long length) throws SQLException;1006/**1007* Sets the designated parameter to the given {@code Reader}1008* object, which is the given number of characters long.1009* When a very large UNICODE value is input to a {@code LONGVARCHAR}1010* parameter, it may be more practical to send it via a1011* {@code java.io.Reader} object. The data will be read from the stream1012* as needed until end-of-file is reached. The JDBC driver will1013* do any necessary conversion from UNICODE to the database char format.1014*1015* <P><B>Note:</B> This stream object can either be a standard1016* Java stream object or your own subclass that implements the1017* standard interface.1018*1019* @param parameterIndex the first parameter is 1, the second is 2, ...1020* @param reader the {@code java.io.Reader} object that contains the1021* Unicode data1022* @param length the number of characters in the stream1023* @throws SQLException if parameterIndex does not correspond to a parameter1024* marker in the SQL statement; if a database access error occurs or1025* this method is called on a closed {@code PreparedStatement}1026* @since 1.61027*/1028void setCharacterStream(int parameterIndex,1029java.io.Reader reader,1030long length) throws SQLException;1031//-----1032/**1033* Sets the designated parameter to the given input stream.1034* When a very large ASCII value is input to a {@code LONGVARCHAR}1035* parameter, it may be more practical to send it via a1036* {@code java.io.InputStream}. Data will be read from the stream1037* as needed until end-of-file is reached. The JDBC driver will1038* do any necessary conversion from ASCII to the database char format.1039*1040* <P><B>Note:</B> This stream object can either be a standard1041* Java stream object or your own subclass that implements the1042* standard interface.1043* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1044* it might be more efficient to use a version of1045* {@code setAsciiStream} which takes a length parameter.1046*1047* @param parameterIndex the first parameter is 1, the second is 2, ...1048* @param x the Java input stream that contains the ASCII parameter value1049* @throws SQLException if parameterIndex does not correspond to a parameter1050* marker in the SQL statement; if a database access error occurs or1051* this method is called on a closed {@code PreparedStatement}1052* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1053* @since 1.61054*/1055void setAsciiStream(int parameterIndex, java.io.InputStream x)1056throws SQLException;1057/**1058* Sets the designated parameter to the given input stream.1059* When a very large binary value is input to a {@code LONGVARBINARY}1060* parameter, it may be more practical to send it via a1061* {@code java.io.InputStream} object. The data will be read from the1062* stream as needed until end-of-file is reached.1063*1064* <P><B>Note:</B> This stream object can either be a standard1065* Java stream object or your own subclass that implements the1066* standard interface.1067* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1068* it might be more efficient to use a version of1069* {@code setBinaryStream} which takes a length parameter.1070*1071* @param parameterIndex the first parameter is 1, the second is 2, ...1072* @param x the java input stream which contains the binary parameter value1073* @throws SQLException if parameterIndex does not correspond to a parameter1074* marker in the SQL statement; if a database access error occurs or1075* this method is called on a closed {@code PreparedStatement}1076* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1077* @since 1.61078*/1079void setBinaryStream(int parameterIndex, java.io.InputStream x)1080throws SQLException;1081/**1082* Sets the designated parameter to the given {@code Reader}1083* object.1084* When a very large UNICODE value is input to a {@code LONGVARCHAR}1085* parameter, it may be more practical to send it via a1086* {@code java.io.Reader} object. The data will be read from the stream1087* as needed until end-of-file is reached. The JDBC driver will1088* do any necessary conversion from UNICODE to the database char format.1089*1090* <P><B>Note:</B> This stream object can either be a standard1091* Java stream object or your own subclass that implements the1092* standard interface.1093* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1094* it might be more efficient to use a version of1095* {@code setCharacterStream} which takes a length parameter.1096*1097* @param parameterIndex the first parameter is 1, the second is 2, ...1098* @param reader the {@code java.io.Reader} object that contains the1099* Unicode data1100* @throws SQLException if parameterIndex does not correspond to a parameter1101* marker in the SQL statement; if a database access error occurs or1102* this method is called on a closed {@code PreparedStatement}1103* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1104* @since 1.61105*/1106void setCharacterStream(int parameterIndex,1107java.io.Reader reader) throws SQLException;1108/**1109* Sets the designated parameter to a {@code Reader} object. The1110* {@code Reader} reads the data till end-of-file is reached. The1111* driver does the necessary conversion from Java character format to1112* the national character set in the database.11131114* <P><B>Note:</B> This stream object can either be a standard1115* Java stream object or your own subclass that implements the1116* standard interface.1117* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1118* it might be more efficient to use a version of1119* {@code setNCharacterStream} which takes a length parameter.1120*1121* @param parameterIndex of the first parameter is 1, the second is 2, ...1122* @param value the parameter value1123* @throws SQLException if parameterIndex does not correspond to a parameter1124* marker in the SQL statement; if the driver does not support national1125* character sets; if the driver can detect that a data conversion1126* error could occur; if a database access error occurs; or1127* this method is called on a closed {@code PreparedStatement}1128* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1129* @since 1.61130*/1131void setNCharacterStream(int parameterIndex, Reader value) throws SQLException;11321133/**1134* Sets the designated parameter to a {@code Reader} object.1135* This method differs from the {@code setCharacterStream (int, Reader)} method1136* because it informs the driver that the parameter value should be sent to1137* the server as a {@code CLOB}. When the {@code setCharacterStream} method is used, the1138* driver may have to do extra work to determine whether the parameter1139* data should be sent to the server as a {@code LONGVARCHAR} or a {@code CLOB}1140*1141* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1142* it might be more efficient to use a version of1143* {@code setClob} which takes a length parameter.1144*1145* @param parameterIndex index of the first parameter is 1, the second is 2, ...1146* @param reader An object that contains the data to set the parameter value to.1147* @throws SQLException if parameterIndex does not correspond to a parameter1148* marker in the SQL statement; if a database access error occurs; this method is called on1149* a closed {@code PreparedStatement}or if parameterIndex does not correspond to a parameter1150* marker in the SQL statement1151*1152* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1153* @since 1.61154*/1155void setClob(int parameterIndex, Reader reader)1156throws SQLException;11571158/**1159* Sets the designated parameter to a {@code InputStream} object.1160* This method differs from the {@code setBinaryStream (int, InputStream)}1161* method because it informs the driver that the parameter value should be1162* sent to the server as a {@code BLOB}. When the {@code setBinaryStream} method is used,1163* the driver may have to do extra work to determine whether the parameter1164* data should be sent to the server as a {@code LONGVARBINARY} or a {@code BLOB}1165*1166* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1167* it might be more efficient to use a version of1168* {@code setBlob} which takes a length parameter.1169*1170* @param parameterIndex index of the first parameter is 1,1171* the second is 2, ...1172* @param inputStream An object that contains the data to set the parameter1173* value to.1174* @throws SQLException if parameterIndex does not correspond to a parameter1175* marker in the SQL statement; if a database access error occurs;1176* this method is called on a closed {@code PreparedStatement} or1177* if parameterIndex does not correspond1178* to a parameter marker in the SQL statement,1179* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1180*1181* @since 1.61182*/1183void setBlob(int parameterIndex, InputStream inputStream)1184throws SQLException;1185/**1186* Sets the designated parameter to a {@code Reader} object.1187* This method differs from the {@code setCharacterStream (int, Reader)} method1188* because it informs the driver that the parameter value should be sent to1189* the server as a {@code NCLOB}. When the {@code setCharacterStream} method is used, the1190* driver may have to do extra work to determine whether the parameter1191* data should be sent to the server as a {@code LONGNVARCHAR} or a {@code NCLOB}1192* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1193* it might be more efficient to use a version of1194* {@code setNClob} which takes a length parameter.1195*1196* @param parameterIndex index of the first parameter is 1, the second is 2, ...1197* @param reader An object that contains the data to set the parameter value to.1198* @throws SQLException if parameterIndex does not correspond to a parameter1199* marker in the SQL statement;1200* if the driver does not support national character sets;1201* if the driver can detect that a data conversion1202* error could occur; if a database access error occurs or1203* this method is called on a closed {@code PreparedStatement}1204* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1205*1206* @since 1.61207*/1208void setNClob(int parameterIndex, Reader reader)1209throws SQLException;12101211//------------------------- JDBC 4.2 -----------------------------------12121213/**1214* <p>Sets the value of the designated parameter with the given object.1215*1216* If the second argument is an {@code InputStream} then the stream1217* must contain the number of bytes specified by scaleOrLength.1218* If the second argument is a {@code Reader} then the reader must1219* contain the number of characters specified by scaleOrLength. If these1220* conditions are not true the driver will generate a1221* {@code SQLException} when the prepared statement is executed.1222*1223* <p>The given Java object will be converted to the given targetSqlType1224* before being sent to the database.1225*1226* If the object has a custom mapping (is of a class implementing the1227* interface {@code SQLData}),1228* the JDBC driver should call the method {@code SQLData.writeSQL} to1229* write it to the SQL data stream.1230* If, on the other hand, the object is of a class implementing1231* {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},1232* {@code Struct}, {@code java.net.URL},1233* or {@code Array}, the driver should pass it to the database as a1234* value of the corresponding SQL type.1235*1236* <p>Note that this method may be used to pass database-specific1237* abstract data types.1238*<P>1239* The default implementation will throw {@code SQLFeatureNotSupportedException}1240*1241* @param parameterIndex the first parameter is 1, the second is 2, ...1242* @param x the object containing the input parameter value1243* @param targetSqlType the SQL type to be sent to the database. The1244* scale argument may further qualify this type.1245* @param scaleOrLength for {@code java.sql.JDBCType.DECIMAL}1246* or {@code java.sql.JDBCType.NUMERIC types},1247* this is the number of digits after the decimal point. For1248* Java Object types {@code InputStream} and {@code Reader},1249* this is the length1250* of the data in the stream or reader. For all other types,1251* this value will be ignored.1252* @throws SQLException if parameterIndex does not correspond to a1253* parameter marker in the SQL statement; if a database access error occurs1254* or this method is called on a closed {@code PreparedStatement} or1255* if the Java Object specified by x is an InputStream1256* or Reader object and the value of the scale parameter is less1257* than zero1258* @throws SQLFeatureNotSupportedException if1259* the JDBC driver does not support the specified targetSqlType1260* @see JDBCType1261* @see SQLType1262* @since 1.81263*/1264default void setObject(int parameterIndex, Object x, SQLType targetSqlType,1265int scaleOrLength) throws SQLException {1266throw new SQLFeatureNotSupportedException("setObject not implemented");1267}12681269/**1270* Sets the value of the designated parameter with the given object.1271*1272* This method is similar to {@link #setObject(int parameterIndex,1273* Object x, SQLType targetSqlType, int scaleOrLength)},1274* except that it assumes a scale of zero.1275*<P>1276* The default implementation will throw {@code SQLFeatureNotSupportedException}1277*1278* @param parameterIndex the first parameter is 1, the second is 2, ...1279* @param x the object containing the input parameter value1280* @param targetSqlType the SQL type to be sent to the database1281* @throws SQLException if parameterIndex does not correspond to a1282* parameter marker in the SQL statement; if a database access error occurs1283* or this method is called on a closed {@code PreparedStatement}1284* @throws SQLFeatureNotSupportedException if1285* the JDBC driver does not support the specified targetSqlType1286* @see JDBCType1287* @see SQLType1288* @since 1.81289*/1290default void setObject(int parameterIndex, Object x, SQLType targetSqlType)1291throws SQLException {1292throw new SQLFeatureNotSupportedException("setObject not implemented");1293}12941295/**1296* Executes the SQL statement in this {@code PreparedStatement} object,1297* which must be an SQL Data Manipulation Language (DML) statement,1298* such as {@code INSERT}, {@code UPDATE} or1299* {@code DELETE}; or an SQL statement that returns nothing,1300* such as a DDL statement.1301* <p>1302* This method should be used when the returned row count may exceed1303* {@link Integer#MAX_VALUE}.1304* <p>1305* The default implementation will throw {@code UnsupportedOperationException}1306*1307* @return either (1) the row count for SQL Data Manipulation Language1308* (DML) statements or (2) 0 for SQL statements that return nothing1309* @throws SQLException if a database access error occurs;1310* this method is called on a closed {@code PreparedStatement}1311* or the SQL statement returns a {@code ResultSet} object1312* @throws SQLTimeoutException when the driver has determined that the1313* timeout value that was specified by the {@code setQueryTimeout}1314* method has been exceeded and has at least attempted to cancel1315* the currently running {@code Statement}1316* @since 1.81317*/1318default long executeLargeUpdate() throws SQLException {1319throw new UnsupportedOperationException("executeLargeUpdate not implemented");1320}1321}132213231324