Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/sql/PreparedStatement.java
38829 views
/*1* Copyright (c) 1996, 2013, 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</code> 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>, <code>setString</code>,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</code>, then the method <code>setInt</code> should be used.43*44* <p>If arbitrary parameter type conversions are required, the method45* <code>setObject</code> should be used with a target SQL type.46* <P>47* In the following example of setting a parameter, <code>con</code> represents48* an active connection:49* <PRE>50* PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES51* SET SALARY = ? WHERE ID = ?");52* pstmt.setBigDecimal(1, 153833.00)53* pstmt.setInt(2, 110592)54* </PRE>55*56* @see Connection#prepareStatement57* @see ResultSet58*/5960public interface PreparedStatement extends Statement {6162/**63* Executes the SQL query in this <code>PreparedStatement</code> object64* and returns the <code>ResultSet</code> object generated by the query.65*66* @return a <code>ResultSet</code> object that contains the data produced by the67* query; never <code>null</code>68* @exception SQLException if a database access error occurs;69* this method is called on a closed <code>PreparedStatement</code> or the SQL70* statement does not return a <code>ResultSet</code> object71* @throws SQLTimeoutException when the driver has determined that the72* timeout value that was specified by the {@code setQueryTimeout}73* method has been exceeded and has at least attempted to cancel74* the currently running {@code Statement}75*/76ResultSet executeQuery() throws SQLException;7778/**79* Executes the SQL statement in this <code>PreparedStatement</code> object,80* which must be an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or81* <code>DELETE</code>; or an SQL statement that returns nothing,82* such as a DDL statement.83*84* @return either (1) the row count for SQL Data Manipulation Language (DML) statements85* or (2) 0 for SQL statements that return nothing86* @exception SQLException if a database access error occurs;87* this method is called on a closed <code>PreparedStatement</code>88* or the SQL statement returns a <code>ResultSet</code> object89* @throws SQLTimeoutException when the driver has determined that the90* timeout value that was specified by the {@code setQueryTimeout}91* method has been exceeded and has at least attempted to cancel92* the currently running {@code Statement}93*/94int executeUpdate() throws SQLException;9596/**97* Sets the designated parameter to SQL <code>NULL</code>.98*99* <P><B>Note:</B> You must specify the parameter's SQL type.100*101* @param parameterIndex the first parameter is 1, the second is 2, ...102* @param sqlType the SQL type code defined in <code>java.sql.Types</code>103* @exception SQLException if parameterIndex does not correspond to a parameter104* marker in the SQL statement; if a database access error occurs or105* this method is called on a closed <code>PreparedStatement</code>106* @exception SQLFeatureNotSupportedException if <code>sqlType</code> is107* a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,108* <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,109* <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,110* <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>111* or <code>STRUCT</code> data type and the JDBC driver does not support112* this data type113*/114void setNull(int parameterIndex, int sqlType) throws SQLException;115116/**117* Sets the designated parameter to the given Java <code>boolean</code> value.118* The driver converts this119* to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database.120*121* @param parameterIndex the first parameter is 1, the second is 2, ...122* @param x the parameter value123* @exception SQLException if parameterIndex does not correspond to a parameter124* marker in the SQL statement;125* if a database access error occurs or126* this method is called on a closed <code>PreparedStatement</code>127*/128void setBoolean(int parameterIndex, boolean x) throws SQLException;129130/**131* Sets the designated parameter to the given Java <code>byte</code> value.132* The driver converts this133* to an SQL <code>TINYINT</code> value when it sends it to the database.134*135* @param parameterIndex the first parameter is 1, the second is 2, ...136* @param x the parameter value137* @exception SQLException if parameterIndex does not correspond to a parameter138* marker in the SQL statement; if a database access error occurs or139* this method is called on a closed <code>PreparedStatement</code>140*/141void setByte(int parameterIndex, byte x) throws SQLException;142143/**144* Sets the designated parameter to the given Java <code>short</code> value.145* The driver converts this146* to an SQL <code>SMALLINT</code> value when it sends it to the database.147*148* @param parameterIndex the first parameter is 1, the second is 2, ...149* @param x the parameter value150* @exception SQLException if parameterIndex does not correspond to a parameter151* marker in the SQL statement; if a database access error occurs or152* this method is called on a closed <code>PreparedStatement</code>153*/154void setShort(int parameterIndex, short x) throws SQLException;155156/**157* Sets the designated parameter to the given Java <code>int</code> value.158* The driver converts this159* to an SQL <code>INTEGER</code> value when it sends it to the database.160*161* @param parameterIndex the first parameter is 1, the second is 2, ...162* @param x the parameter value163* @exception SQLException if parameterIndex does not correspond to a parameter164* marker in the SQL statement; if a database access error occurs or165* this method is called on a closed <code>PreparedStatement</code>166*/167void setInt(int parameterIndex, int x) throws SQLException;168169/**170* Sets the designated parameter to the given Java <code>long</code> value.171* The driver converts this172* to an SQL <code>BIGINT</code> value when it sends it to the database.173*174* @param parameterIndex the first parameter is 1, the second is 2, ...175* @param x the parameter value176* @exception SQLException if parameterIndex does not correspond to a parameter177* marker in the SQL statement; if a database access error occurs or178* this method is called on a closed <code>PreparedStatement</code>179*/180void setLong(int parameterIndex, long x) throws SQLException;181182/**183* Sets the designated parameter to the given Java <code>float</code> value.184* The driver converts this185* to an SQL <code>REAL</code> value when it sends it to the database.186*187* @param parameterIndex the first parameter is 1, the second is 2, ...188* @param x the parameter value189* @exception SQLException if parameterIndex does not correspond to a parameter190* marker in the SQL statement; if a database access error occurs or191* this method is called on a closed <code>PreparedStatement</code>192*/193void setFloat(int parameterIndex, float x) throws SQLException;194195/**196* Sets the designated parameter to the given Java <code>double</code> value.197* The driver converts this198* to an SQL <code>DOUBLE</code> value when it sends it to the database.199*200* @param parameterIndex the first parameter is 1, the second is 2, ...201* @param x the parameter value202* @exception SQLException if parameterIndex does not correspond to a parameter203* marker in the SQL statement; if a database access error occurs or204* this method is called on a closed <code>PreparedStatement</code>205*/206void setDouble(int parameterIndex, double x) throws SQLException;207208/**209* Sets the designated parameter to the given <code>java.math.BigDecimal</code> value.210* The driver converts this to an SQL <code>NUMERIC</code> value when211* it sends it to the database.212*213* @param parameterIndex the first parameter is 1, the second is 2, ...214* @param x the parameter value215* @exception SQLException if parameterIndex does not correspond to a parameter216* marker in the SQL statement; if a database access error occurs or217* this method is called on a closed <code>PreparedStatement</code>218*/219void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;220221/**222* Sets the designated parameter to the given Java <code>String</code> value.223* The driver converts this224* to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value225* (depending on the argument's226* size relative to the driver's limits on <code>VARCHAR</code> values)227* when it sends it to the database.228*229* @param parameterIndex the first parameter is 1, the second is 2, ...230* @param x the parameter value231* @exception SQLException if parameterIndex does not correspond to a parameter232* marker in the SQL statement; if a database access error occurs or233* this method is called on a closed <code>PreparedStatement</code>234*/235void setString(int parameterIndex, String x) throws SQLException;236237/**238* Sets the designated parameter to the given Java array of bytes. The driver converts239* this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code>240* (depending on the argument's size relative to the driver's limits on241* <code>VARBINARY</code> values) when it sends it to the database.242*243* @param parameterIndex the first parameter is 1, the second is 2, ...244* @param x the parameter value245* @exception SQLException if parameterIndex does not correspond to a parameter246* marker in the SQL statement; if a database access error occurs or247* this method is called on a closed <code>PreparedStatement</code>248*/249void setBytes(int parameterIndex, byte x[]) throws SQLException;250251/**252* Sets the designated parameter to the given <code>java.sql.Date</code> value253* using the default time zone of the virtual machine that is running254* the application.255* The driver converts this256* to an SQL <code>DATE</code> value when it sends it to the database.257*258* @param parameterIndex the first parameter is 1, the second is 2, ...259* @param x the parameter value260* @exception SQLException if parameterIndex does not correspond to a parameter261* marker in the SQL statement; if a database access error occurs or262* this method is called on a closed <code>PreparedStatement</code>263*/264void setDate(int parameterIndex, java.sql.Date x)265throws SQLException;266267/**268* Sets the designated parameter to the given <code>java.sql.Time</code> value.269* The driver converts this270* to an SQL <code>TIME</code> value when it sends it to the database.271*272* @param parameterIndex the first parameter is 1, the second is 2, ...273* @param x the parameter value274* @exception SQLException if parameterIndex does not correspond to a parameter275* marker in the SQL statement; if a database access error occurs or276* this method is called on a closed <code>PreparedStatement</code>277*/278void setTime(int parameterIndex, java.sql.Time x)279throws SQLException;280281/**282* Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.283* The driver284* converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the285* database.286*287* @param parameterIndex the first parameter is 1, the second is 2, ...288* @param x the parameter value289* @exception SQLException if parameterIndex does not correspond to a parameter290* marker in the SQL statement; if a database access error occurs or291* this method is called on a closed <code>PreparedStatement</code> */292void setTimestamp(int parameterIndex, java.sql.Timestamp x)293throws SQLException;294295/**296* Sets the designated parameter to the given input stream, which will have297* the specified number of bytes.298* When a very large ASCII value is input to a <code>LONGVARCHAR</code>299* parameter, it may be more practical to send it via a300* <code>java.io.InputStream</code>. Data will be read from the stream301* as needed until end-of-file is reached. The JDBC driver will302* do any necessary conversion from ASCII to the database char format.303*304* <P><B>Note:</B> This stream object can either be a standard305* Java stream object or your own subclass that implements the306* standard interface.307*308* @param parameterIndex the first parameter is 1, the second is 2, ...309* @param x the Java input stream that contains the ASCII parameter value310* @param length the number of bytes in the stream311* @exception SQLException if parameterIndex does not correspond to a parameter312* marker in the SQL statement; if a database access error occurs or313* this method is called on a closed <code>PreparedStatement</code>314*/315void setAsciiStream(int parameterIndex, java.io.InputStream x, int length)316throws SQLException;317318/**319* Sets the designated parameter to the given input stream, which320* will have the specified number of bytes.321*322* When a very large Unicode value is input to a <code>LONGVARCHAR</code>323* parameter, it may be more practical to send it via a324* <code>java.io.InputStream</code> object. The data will be read from the325* stream as needed until end-of-file is reached. The JDBC driver will326* do any necessary conversion from Unicode to the database char format.327*328*The byte format of the Unicode stream must be a Java UTF-8, as defined in the329*Java Virtual Machine Specification.330*331* <P><B>Note:</B> This stream object can either be a standard332* Java stream object or your own subclass that implements the333* standard interface.334*335* @param parameterIndex the first parameter is 1, the second is 2, ...336* @param x a <code>java.io.InputStream</code> object that contains the337* Unicode parameter value338* @param length the number of bytes in the stream339* @exception SQLException if parameterIndex does not correspond to a parameter340* marker in the SQL statement; if a database access error occurs or341* this method is called on a closed <code>PreparedStatement</code>342* @exception SQLFeatureNotSupportedException if the JDBC driver does not support343* this method344* @deprecated Use {@code setCharacterStream}345*/346@Deprecated347void setUnicodeStream(int parameterIndex, java.io.InputStream x,348int length) throws SQLException;349350/**351* Sets the designated parameter to the given input stream, which will have352* the specified number of bytes.353* When a very large binary value is input to a <code>LONGVARBINARY</code>354* parameter, it may be more practical to send it via a355* <code>java.io.InputStream</code> object. The data will be read from the356* stream as needed until end-of-file is reached.357*358* <P><B>Note:</B> This stream object can either be a standard359* Java stream object or your own subclass that implements the360* standard interface.361*362* @param parameterIndex the first parameter is 1, the second is 2, ...363* @param x the java input stream which contains the binary parameter value364* @param length the number of bytes in the stream365* @exception SQLException if parameterIndex does not correspond to a parameter366* marker in the SQL statement; if a database access error occurs or367* this method is called on a closed <code>PreparedStatement</code>368*/369void setBinaryStream(int parameterIndex, java.io.InputStream x,370int length) throws SQLException;371372/**373* Clears the current parameter values immediately.374* <P>In general, parameter values remain in force for repeated use of a375* statement. Setting a parameter value automatically clears its376* previous value. However, in some cases it is useful to immediately377* release the resources used by the current parameter values; this can378* be done by calling the method <code>clearParameters</code>.379*380* @exception SQLException if a database access error occurs or381* this method is called on a closed <code>PreparedStatement</code>382*/383void clearParameters() throws SQLException;384385//----------------------------------------------------------------------386// Advanced features:387388/**389* Sets the value of the designated parameter with the given object.390*391* This method is similar to {@link #setObject(int parameterIndex,392* Object x, int targetSqlType, int scaleOrLength)},393* except that it assumes a scale of zero.394*395* @param parameterIndex the first parameter is 1, the second is 2, ...396* @param x the object containing the input parameter value397* @param targetSqlType the SQL type (as defined in java.sql.Types) to be398* sent to the database399* @exception SQLException if parameterIndex does not correspond to a parameter400* marker in the SQL statement; if a database access error occurs or this401* method is called on a closed PreparedStatement402* @exception SQLFeatureNotSupportedException if403* the JDBC driver does not support the specified targetSqlType404* @see Types405*/406void setObject(int parameterIndex, Object x, int targetSqlType)407throws SQLException;408409/**410* <p>Sets the value of the designated parameter using the given object.411*412* <p>The JDBC specification specifies a standard mapping from413* Java <code>Object</code> types to SQL types. The given argument414* will be converted to the corresponding SQL type before being415* sent to the database.416*417* <p>Note that this method may be used to pass datatabase-418* specific abstract data types, by using a driver-specific Java419* type.420*421* If the object is of a class implementing the interface <code>SQLData</code>,422* the JDBC driver should call the method <code>SQLData.writeSQL</code>423* to write it to the SQL data stream.424* If, on the other hand, the object is of a class implementing425* <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,426* <code>Struct</code>, <code>java.net.URL</code>, <code>RowId</code>, <code>SQLXML</code>427* or <code>Array</code>, the driver should pass it to the database as a428* value of the corresponding SQL type.429* <P>430*<b>Note:</b> Not all databases allow for a non-typed Null to be sent to431* the backend. For maximum portability, the <code>setNull</code> or the432* <code>setObject(int parameterIndex, Object x, int sqlType)</code>433* method should be used434* instead of <code>setObject(int parameterIndex, Object x)</code>.435*<p>436* <b>Note:</b> This method throws an exception if there is an ambiguity, for example, if the437* object is of a class implementing more than one of the interfaces named above.438*439* @param parameterIndex the first parameter is 1, the second is 2, ...440* @param x the object containing the input parameter value441* @exception SQLException if parameterIndex does not correspond to a parameter442* marker in the SQL statement; if a database access error occurs;443* this method is called on a closed <code>PreparedStatement</code>444* or the type of the given object is ambiguous445*/446void setObject(int parameterIndex, Object x) throws SQLException;447448/**449* Executes the SQL statement in this <code>PreparedStatement</code> object,450* which may be any kind of SQL statement.451* Some prepared statements return multiple results; the <code>execute</code>452* method handles these complex statements as well as the simpler453* form of statements handled by the methods <code>executeQuery</code>454* and <code>executeUpdate</code>.455* <P>456* The <code>execute</code> method returns a <code>boolean</code> to457* indicate the form of the first result. You must call either the method458* <code>getResultSet</code> or <code>getUpdateCount</code>459* to retrieve the result; you must call <code>getMoreResults</code> to460* move to any subsequent result(s).461*462* @return <code>true</code> if the first result is a <code>ResultSet</code>463* object; <code>false</code> if the first result is an update464* count or there is no result465* @exception SQLException if a database access error occurs;466* this method is called on a closed <code>PreparedStatement</code>467* or an argument is supplied to this method468* @throws SQLTimeoutException when the driver has determined that the469* timeout value that was specified by the {@code setQueryTimeout}470* method has been exceeded and has at least attempted to cancel471* the currently running {@code Statement}472* @see Statement#execute473* @see Statement#getResultSet474* @see Statement#getUpdateCount475* @see Statement#getMoreResults476477*/478boolean execute() throws SQLException;479480//--------------------------JDBC 2.0-----------------------------481482/**483* Adds a set of parameters to this <code>PreparedStatement</code>484* object's batch of commands.485*486* @exception SQLException if a database access error occurs or487* this method is called on a closed <code>PreparedStatement</code>488* @see Statement#addBatch489* @since 1.2490*/491void addBatch() throws SQLException;492493/**494* Sets the designated parameter to the given <code>Reader</code>495* object, which is the given number of characters long.496* When a very large UNICODE value is input to a <code>LONGVARCHAR</code>497* parameter, it may be more practical to send it via a498* <code>java.io.Reader</code> object. The data will be read from the stream499* as needed until end-of-file is reached. The JDBC driver will500* do any necessary conversion from UNICODE to the database char format.501*502* <P><B>Note:</B> This stream object can either be a standard503* Java stream object or your own subclass that implements the504* standard interface.505*506* @param parameterIndex the first parameter is 1, the second is 2, ...507* @param reader the <code>java.io.Reader</code> object that contains the508* Unicode data509* @param length the number of characters in the stream510* @exception SQLException if parameterIndex does not correspond to a parameter511* marker in the SQL statement; if a database access error occurs or512* this method is called on a closed <code>PreparedStatement</code>513* @since 1.2514*/515void setCharacterStream(int parameterIndex,516java.io.Reader reader,517int length) throws SQLException;518519/**520* Sets the designated parameter to the given521* <code>REF(<structured-type>)</code> value.522* The driver converts this to an SQL <code>REF</code> value when it523* sends it to the database.524*525* @param parameterIndex the first parameter is 1, the second is 2, ...526* @param x an SQL <code>REF</code> value527* @exception SQLException if parameterIndex does not correspond to a parameter528* marker in the SQL statement; if a database access error occurs or529* this method is called on a closed <code>PreparedStatement</code>530* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method531* @since 1.2532*/533void setRef (int parameterIndex, Ref x) throws SQLException;534535/**536* Sets the designated parameter to the given <code>java.sql.Blob</code> object.537* The driver converts this to an SQL <code>BLOB</code> value when it538* sends it to the database.539*540* @param parameterIndex the first parameter is 1, the second is 2, ...541* @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value542* @exception SQLException if parameterIndex does not correspond to a parameter543* marker in the SQL statement; if a database access error occurs or544* this method is called on a closed <code>PreparedStatement</code>545* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method546* @since 1.2547*/548void setBlob (int parameterIndex, Blob x) throws SQLException;549550/**551* Sets the designated parameter to the given <code>java.sql.Clob</code> object.552* The driver converts this to an SQL <code>CLOB</code> value when it553* sends it to the database.554*555* @param parameterIndex the first parameter is 1, the second is 2, ...556* @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value557* @exception SQLException if parameterIndex does not correspond to a parameter558* marker in the SQL statement; if a database access error occurs or559* this method is called on a closed <code>PreparedStatement</code>560* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method561* @since 1.2562*/563void setClob (int parameterIndex, Clob x) throws SQLException;564565/**566* Sets the designated parameter to the given <code>java.sql.Array</code> object.567* The driver converts this to an SQL <code>ARRAY</code> value when it568* sends it to the database.569*570* @param parameterIndex the first parameter is 1, the second is 2, ...571* @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value572* @exception SQLException if parameterIndex does not correspond to a parameter573* marker in the SQL statement; if a database access error occurs or574* this method is called on a closed <code>PreparedStatement</code>575* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method576* @since 1.2577*/578void setArray (int parameterIndex, Array x) throws SQLException;579580/**581* Retrieves a <code>ResultSetMetaData</code> object that contains582* information about the columns of the <code>ResultSet</code> object583* that will be returned when this <code>PreparedStatement</code> object584* is executed.585* <P>586* Because a <code>PreparedStatement</code> object is precompiled, it is587* possible to know about the <code>ResultSet</code> object that it will588* return without having to execute it. Consequently, it is possible589* to invoke the method <code>getMetaData</code> on a590* <code>PreparedStatement</code> object rather than waiting to execute591* it and then invoking the <code>ResultSet.getMetaData</code> method592* on the <code>ResultSet</code> object that is returned.593* <P>594* <B>NOTE:</B> Using this method may be expensive for some drivers due595* to the lack of underlying DBMS support.596*597* @return the description of a <code>ResultSet</code> object's columns or598* <code>null</code> if the driver cannot return a599* <code>ResultSetMetaData</code> object600* @exception SQLException if a database access error occurs or601* this method is called on a closed <code>PreparedStatement</code>602* @exception SQLFeatureNotSupportedException if the JDBC driver does not support603* this method604* @since 1.2605*/606ResultSetMetaData getMetaData() throws SQLException;607608/**609* Sets the designated parameter to the given <code>java.sql.Date</code> value,610* using the given <code>Calendar</code> object. The driver uses611* the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,612* which the driver then sends to the database. With613* a <code>Calendar</code> object, the driver can calculate the date614* taking into account a custom timezone. If no615* <code>Calendar</code> object is specified, the driver uses the default616* timezone, which is that of the virtual machine running the application.617*618* @param parameterIndex the first parameter is 1, the second is 2, ...619* @param x the parameter value620* @param cal the <code>Calendar</code> object the driver will use621* to construct the date622* @exception SQLException if parameterIndex does not correspond to a parameter623* marker in the SQL statement; if a database access error occurs or624* this method is called on a closed <code>PreparedStatement</code>625* @since 1.2626*/627void setDate(int parameterIndex, java.sql.Date x, Calendar cal)628throws SQLException;629630/**631* Sets the designated parameter to the given <code>java.sql.Time</code> value,632* using the given <code>Calendar</code> object. The driver uses633* the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,634* which the driver then sends to the database. With635* a <code>Calendar</code> object, the driver can calculate the time636* taking into account a custom timezone. If no637* <code>Calendar</code> object is specified, the driver uses the default638* timezone, which is that of the virtual machine running the application.639*640* @param parameterIndex the first parameter is 1, the second is 2, ...641* @param x the parameter value642* @param cal the <code>Calendar</code> object the driver will use643* to construct the time644* @exception SQLException if parameterIndex does not correspond to a parameter645* marker in the SQL statement; if a database access error occurs or646* this method is called on a closed <code>PreparedStatement</code>647* @since 1.2648*/649void setTime(int parameterIndex, java.sql.Time x, Calendar cal)650throws SQLException;651652/**653* Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,654* using the given <code>Calendar</code> object. The driver uses655* the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,656* which the driver then sends to the database. With a657* <code>Calendar</code> object, the driver can calculate the timestamp658* taking into account a custom timezone. If no659* <code>Calendar</code> object is specified, the driver uses the default660* timezone, which is that of the virtual machine running the application.661*662* @param parameterIndex the first parameter is 1, the second is 2, ...663* @param x the parameter value664* @param cal the <code>Calendar</code> object the driver will use665* to construct the timestamp666* @exception SQLException if parameterIndex does not correspond to a parameter667* marker in the SQL statement; if a database access error occurs or668* this method is called on a closed <code>PreparedStatement</code>669* @since 1.2670*/671void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal)672throws SQLException;673674/**675* Sets the designated parameter to SQL <code>NULL</code>.676* This version of the method <code>setNull</code> should677* be used for user-defined types and REF type parameters. Examples678* of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and679* named array types.680*681* <P><B>Note:</B> To be portable, applications must give the682* SQL type code and the fully-qualified SQL type name when specifying683* a NULL user-defined or REF parameter. In the case of a user-defined type684* the name is the type name of the parameter itself. For a REF685* parameter, the name is the type name of the referenced type. If686* a JDBC driver does not need the type code or type name information,687* it may ignore it.688*689* Although it is intended for user-defined and Ref parameters,690* this method may be used to set a null parameter of any JDBC type.691* If the parameter does not have a user-defined or REF type, the given692* typeName is ignored.693*694*695* @param parameterIndex the first parameter is 1, the second is 2, ...696* @param sqlType a value from <code>java.sql.Types</code>697* @param typeName the fully-qualified name of an SQL user-defined type;698* ignored if the parameter is not a user-defined type or REF699* @exception SQLException if parameterIndex does not correspond to a parameter700* marker in the SQL statement; if a database access error occurs or701* this method is called on a closed <code>PreparedStatement</code>702* @exception SQLFeatureNotSupportedException if <code>sqlType</code> is703* a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,704* <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,705* <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,706* <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>707* or <code>STRUCT</code> data type and the JDBC driver does not support708* this data type or if the JDBC driver does not support this method709* @since 1.2710*/711void setNull (int parameterIndex, int sqlType, String typeName)712throws SQLException;713714//------------------------- JDBC 3.0 -----------------------------------715716/**717* Sets the designated parameter to the given <code>java.net.URL</code> value.718* The driver converts this to an SQL <code>DATALINK</code> value719* when it sends it to the database.720*721* @param parameterIndex the first parameter is 1, the second is 2, ...722* @param x the <code>java.net.URL</code> object to be set723* @exception SQLException if parameterIndex does not correspond to a parameter724* marker in the SQL statement; if a database access error occurs or725* this method is called on a closed <code>PreparedStatement</code>726* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method727* @since 1.4728*/729void setURL(int parameterIndex, java.net.URL x) throws SQLException;730731/**732* Retrieves the number, types and properties of this733* <code>PreparedStatement</code> object's parameters.734*735* @return a <code>ParameterMetaData</code> object that contains information736* about the number, types and properties for each737* parameter marker of this <code>PreparedStatement</code> object738* @exception SQLException if a database access error occurs or739* this method is called on a closed <code>PreparedStatement</code>740* @see ParameterMetaData741* @since 1.4742*/743ParameterMetaData getParameterMetaData() throws SQLException;744745//------------------------- JDBC 4.0 -----------------------------------746747/**748* Sets the designated parameter to the given <code>java.sql.RowId</code> object. The749* driver converts this to a SQL <code>ROWID</code> value when it sends it750* to the database751*752* @param parameterIndex the first parameter is 1, the second is 2, ...753* @param x the parameter value754* @throws SQLException if parameterIndex does not correspond to a parameter755* marker in the SQL statement; if a database access error occurs or756* this method is called on a closed <code>PreparedStatement</code>757* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method758*759* @since 1.6760*/761void setRowId(int parameterIndex, RowId x) throws SQLException;762763764/**765* Sets the designated parameter to the given <code>String</code> object.766* The driver converts this to a SQL <code>NCHAR</code> or767* <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value768* (depending on the argument's769* size relative to the driver's limits on <code>NVARCHAR</code> values)770* when it sends it to the database.771*772* @param parameterIndex of the first parameter is 1, the second is 2, ...773* @param value the parameter value774* @throws SQLException if parameterIndex does not correspond to a parameter775* marker in the SQL statement; if the driver does not support national776* character sets; if the driver can detect that a data conversion777* error could occur; if a database access error occurs; or778* this method is called on a closed <code>PreparedStatement</code>779* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method780* @since 1.6781*/782void setNString(int parameterIndex, String value) throws SQLException;783784/**785* Sets the designated parameter to a <code>Reader</code> object. The786* <code>Reader</code> reads the data till end-of-file is reached. The787* driver does the necessary conversion from Java character format to788* the national character set in the database.789* @param parameterIndex of the first parameter is 1, the second is 2, ...790* @param value the parameter value791* @param length the number of characters in the parameter data.792* @throws SQLException if parameterIndex does not correspond to a parameter793* marker in the SQL statement; if the driver does not support national794* character sets; if the driver can detect that a data conversion795* error could occur; if a database access error occurs; or796* this method is called on a closed <code>PreparedStatement</code>797* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method798* @since 1.6799*/800void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException;801802/**803* Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this to a804* SQL <code>NCLOB</code> value when it sends it to the database.805* @param parameterIndex of the first parameter is 1, the second is 2, ...806* @param value the parameter value807* @throws SQLException if parameterIndex does not correspond to a parameter808* marker in the SQL statement; if the driver does not support national809* character sets; if the driver can detect that a data conversion810* error could occur; if a database access error occurs; or811* this method is called on a closed <code>PreparedStatement</code>812* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method813* @since 1.6814*/815void setNClob(int parameterIndex, NClob value) throws SQLException;816817/**818* Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number819* of characters specified by length otherwise a <code>SQLException</code> will be820* generated when the <code>PreparedStatement</code> is executed.821*This method differs from the <code>setCharacterStream (int, Reader, int)</code> method822* because it informs the driver that the parameter value should be sent to823* the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the824* driver may have to do extra work to determine whether the parameter825* data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>826* @param parameterIndex index of the first parameter is 1, the second is 2, ...827* @param reader An object that contains the data to set the parameter value to.828* @param length the number of characters in the parameter data.829* @throws SQLException if parameterIndex does not correspond to a parameter830* marker in the SQL statement; if a database access error occurs; this method is called on831* a closed <code>PreparedStatement</code> or if the length specified is less than zero.832*833* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method834* @since 1.6835*/836void setClob(int parameterIndex, Reader reader, long length)837throws SQLException;838839/**840* Sets the designated parameter to a <code>InputStream</code> object. The inputstream must contain the number841* of characters specified by length otherwise a <code>SQLException</code> will be842* generated when the <code>PreparedStatement</code> is executed.843* This method differs from the <code>setBinaryStream (int, InputStream, int)</code>844* method because it informs the driver that the parameter value should be845* sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,846* the driver may have to do extra work to determine whether the parameter847* data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>848* @param parameterIndex index of the first parameter is 1,849* the second is 2, ...850* @param inputStream An object that contains the data to set the parameter851* value to.852* @param length the number of bytes in the parameter data.853* @throws SQLException if parameterIndex does not correspond to a parameter854* marker in the SQL statement; if a database access error occurs;855* this method is called on a closed <code>PreparedStatement</code>;856* if the length specified857* is less than zero or if the number of bytes in the inputstream does not match858* the specified length.859* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method860*861* @since 1.6862*/863void setBlob(int parameterIndex, InputStream inputStream, long length)864throws SQLException;865/**866* Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number867* of characters specified by length otherwise a <code>SQLException</code> will be868* generated when the <code>PreparedStatement</code> is executed.869* This method differs from the <code>setCharacterStream (int, Reader, int)</code> method870* because it informs the driver that the parameter value should be sent to871* the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the872* driver may have to do extra work to determine whether the parameter873* data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>874* @param parameterIndex index of the first parameter is 1, the second is 2, ...875* @param reader An object that contains the data to set the parameter value to.876* @param length the number of characters in the parameter data.877* @throws SQLException if parameterIndex does not correspond to a parameter878* marker in the SQL statement; if the length specified is less than zero;879* if the driver does not support national character sets;880* if the driver can detect that a data conversion881* error could occur; if a database access error occurs or882* this method is called on a closed <code>PreparedStatement</code>883* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method884*885* @since 1.6886*/887void setNClob(int parameterIndex, Reader reader, long length)888throws SQLException;889890/**891* Sets the designated parameter to the given <code>java.sql.SQLXML</code> object.892* The driver converts this to an893* SQL <code>XML</code> value when it sends it to the database.894* <p>895*896* @param parameterIndex index of the first parameter is 1, the second is 2, ...897* @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value898* @throws SQLException if parameterIndex does not correspond to a parameter899* marker in the SQL statement; if a database access error occurs;900* this method is called on a closed <code>PreparedStatement</code>901* or the <code>java.xml.transform.Result</code>,902* <code>Writer</code> or <code>OutputStream</code> has not been closed for903* the <code>SQLXML</code> object904* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method905*906* @since 1.6907*/908void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException;909910/**911* <p>Sets the value of the designated parameter with the given object.912*913* If the second argument is an <code>InputStream</code> then the stream must contain914* the number of bytes specified by scaleOrLength. If the second argument is a915* <code>Reader</code> then the reader must contain the number of characters specified916* by scaleOrLength. If these conditions are not true the driver will generate a917* <code>SQLException</code> when the prepared statement is executed.918*919* <p>The given Java object will be converted to the given targetSqlType920* before being sent to the database.921*922* If the object has a custom mapping (is of a class implementing the923* interface <code>SQLData</code>),924* the JDBC driver should call the method <code>SQLData.writeSQL</code> to925* write it to the SQL data stream.926* If, on the other hand, the object is of a class implementing927* <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,928* <code>Struct</code>, <code>java.net.URL</code>,929* or <code>Array</code>, the driver should pass it to the database as a930* value of the corresponding SQL type.931*932* <p>Note that this method may be used to pass database-specific933* abstract data types.934*935* @param parameterIndex the first parameter is 1, the second is 2, ...936* @param x the object containing the input parameter value937* @param targetSqlType the SQL type (as defined in java.sql.Types) to be938* sent to the database. The scale argument may further qualify this type.939* @param scaleOrLength for <code>java.sql.Types.DECIMAL</code>940* or <code>java.sql.Types.NUMERIC types</code>,941* this is the number of digits after the decimal point. For942* Java Object types <code>InputStream</code> and <code>Reader</code>,943* this is the length944* of the data in the stream or reader. For all other types,945* this value will be ignored.946* @exception SQLException if parameterIndex does not correspond to a parameter947* marker in the SQL statement; if a database access error occurs;948* this method is called on a closed <code>PreparedStatement</code> or949* if the Java Object specified by x is an InputStream950* or Reader object and the value of the scale parameter is less951* than zero952* @exception SQLFeatureNotSupportedException if953* the JDBC driver does not support the specified targetSqlType954* @see Types955*956*/957void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)958throws SQLException;959/**960* Sets the designated parameter to the given input stream, which will have961* the specified number of bytes.962* When a very large ASCII value is input to a <code>LONGVARCHAR</code>963* parameter, it may be more practical to send it via a964* <code>java.io.InputStream</code>. Data will be read from the stream965* as needed until end-of-file is reached. The JDBC driver will966* do any necessary conversion from ASCII to the database char format.967*968* <P><B>Note:</B> This stream object can either be a standard969* Java stream object or your own subclass that implements the970* standard interface.971*972* @param parameterIndex the first parameter is 1, the second is 2, ...973* @param x the Java input stream that contains the ASCII parameter value974* @param length the number of bytes in the stream975* @exception SQLException if parameterIndex does not correspond to a parameter976* marker in the SQL statement; if a database access error occurs or977* this method is called on a closed <code>PreparedStatement</code>978* @since 1.6979*/980void setAsciiStream(int parameterIndex, java.io.InputStream x, long length)981throws SQLException;982/**983* Sets the designated parameter to the given input stream, which will have984* the specified number of bytes.985* When a very large binary value is input to a <code>LONGVARBINARY</code>986* parameter, it may be more practical to send it via a987* <code>java.io.InputStream</code> object. The data will be read from the988* stream as needed until end-of-file is reached.989*990* <P><B>Note:</B> This stream object can either be a standard991* Java stream object or your own subclass that implements the992* standard interface.993*994* @param parameterIndex the first parameter is 1, the second is 2, ...995* @param x the java input stream which contains the binary parameter value996* @param length the number of bytes in the stream997* @exception SQLException if parameterIndex does not correspond to a parameter998* marker in the SQL statement; if a database access error occurs or999* this method is called on a closed <code>PreparedStatement</code>1000* @since 1.61001*/1002void setBinaryStream(int parameterIndex, java.io.InputStream x,1003long length) throws SQLException;1004/**1005* Sets the designated parameter to the given <code>Reader</code>1006* object, which is the given number of characters long.1007* When a very large UNICODE value is input to a <code>LONGVARCHAR</code>1008* parameter, it may be more practical to send it via a1009* <code>java.io.Reader</code> object. The data will be read from the stream1010* as needed until end-of-file is reached. The JDBC driver will1011* do any necessary conversion from UNICODE to the database char format.1012*1013* <P><B>Note:</B> This stream object can either be a standard1014* Java stream object or your own subclass that implements the1015* standard interface.1016*1017* @param parameterIndex the first parameter is 1, the second is 2, ...1018* @param reader the <code>java.io.Reader</code> object that contains the1019* Unicode data1020* @param length the number of characters in the stream1021* @exception SQLException if parameterIndex does not correspond to a parameter1022* marker in the SQL statement; if a database access error occurs or1023* this method is called on a closed <code>PreparedStatement</code>1024* @since 1.61025*/1026void setCharacterStream(int parameterIndex,1027java.io.Reader reader,1028long length) throws SQLException;1029//-----1030/**1031* Sets the designated parameter to the given input stream.1032* When a very large ASCII value is input to a <code>LONGVARCHAR</code>1033* parameter, it may be more practical to send it via a1034* <code>java.io.InputStream</code>. Data will be read from the stream1035* as needed until end-of-file is reached. The JDBC driver will1036* do any necessary conversion from ASCII to the database char format.1037*1038* <P><B>Note:</B> This stream object can either be a standard1039* Java stream object or your own subclass that implements the1040* standard interface.1041* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1042* it might be more efficient to use a version of1043* <code>setAsciiStream</code> which takes a length parameter.1044*1045* @param parameterIndex the first parameter is 1, the second is 2, ...1046* @param x the Java input stream that contains the ASCII parameter value1047* @exception SQLException if parameterIndex does not correspond to a parameter1048* marker in the SQL statement; if a database access error occurs or1049* this method is called on a closed <code>PreparedStatement</code>1050* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1051* @since 1.61052*/1053void setAsciiStream(int parameterIndex, java.io.InputStream x)1054throws SQLException;1055/**1056* Sets the designated parameter to the given input stream.1057* When a very large binary value is input to a <code>LONGVARBINARY</code>1058* parameter, it may be more practical to send it via a1059* <code>java.io.InputStream</code> object. The data will be read from the1060* stream as needed until end-of-file is reached.1061*1062* <P><B>Note:</B> This stream object can either be a standard1063* Java stream object or your own subclass that implements the1064* standard interface.1065* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1066* it might be more efficient to use a version of1067* <code>setBinaryStream</code> which takes a length parameter.1068*1069* @param parameterIndex the first parameter is 1, the second is 2, ...1070* @param x the java input stream which contains the binary parameter value1071* @exception SQLException if parameterIndex does not correspond to a parameter1072* marker in the SQL statement; if a database access error occurs or1073* this method is called on a closed <code>PreparedStatement</code>1074* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1075* @since 1.61076*/1077void setBinaryStream(int parameterIndex, java.io.InputStream x)1078throws SQLException;1079/**1080* Sets the designated parameter to the given <code>Reader</code>1081* object.1082* When a very large UNICODE value is input to a <code>LONGVARCHAR</code>1083* parameter, it may be more practical to send it via a1084* <code>java.io.Reader</code> object. The data will be read from the stream1085* as needed until end-of-file is reached. The JDBC driver will1086* do any necessary conversion from UNICODE to the database char format.1087*1088* <P><B>Note:</B> This stream object can either be a standard1089* Java stream object or your own subclass that implements the1090* standard interface.1091* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1092* it might be more efficient to use a version of1093* <code>setCharacterStream</code> which takes a length parameter.1094*1095* @param parameterIndex the first parameter is 1, the second is 2, ...1096* @param reader the <code>java.io.Reader</code> object that contains the1097* Unicode data1098* @exception SQLException if parameterIndex does not correspond to a parameter1099* marker in the SQL statement; if a database access error occurs or1100* this method is called on a closed <code>PreparedStatement</code>1101* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1102* @since 1.61103*/1104void setCharacterStream(int parameterIndex,1105java.io.Reader reader) throws SQLException;1106/**1107* Sets the designated parameter to a <code>Reader</code> object. The1108* <code>Reader</code> reads the data till end-of-file is reached. The1109* driver does the necessary conversion from Java character format to1110* the national character set in the database.11111112* <P><B>Note:</B> This stream object can either be a standard1113* Java stream object or your own subclass that implements the1114* standard interface.1115* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1116* it might be more efficient to use a version of1117* <code>setNCharacterStream</code> which takes a length parameter.1118*1119* @param parameterIndex of the first parameter is 1, the second is 2, ...1120* @param value the parameter value1121* @throws SQLException if parameterIndex does not correspond to a parameter1122* marker in the SQL statement; if the driver does not support national1123* character sets; if the driver can detect that a data conversion1124* error could occur; if a database access error occurs; or1125* this method is called on a closed <code>PreparedStatement</code>1126* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1127* @since 1.61128*/1129void setNCharacterStream(int parameterIndex, Reader value) throws SQLException;11301131/**1132* Sets the designated parameter to a <code>Reader</code> object.1133* This method differs from the <code>setCharacterStream (int, Reader)</code> method1134* because it informs the driver that the parameter value should be sent to1135* the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the1136* driver may have to do extra work to determine whether the parameter1137* data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>1138*1139* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1140* it might be more efficient to use a version of1141* <code>setClob</code> which takes a length parameter.1142*1143* @param parameterIndex index of the first parameter is 1, the second is 2, ...1144* @param reader An object that contains the data to set the parameter value to.1145* @throws SQLException if parameterIndex does not correspond to a parameter1146* marker in the SQL statement; if a database access error occurs; this method is called on1147* a closed <code>PreparedStatement</code>or if parameterIndex does not correspond to a parameter1148* marker in the SQL statement1149*1150* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1151* @since 1.61152*/1153void setClob(int parameterIndex, Reader reader)1154throws SQLException;11551156/**1157* Sets the designated parameter to a <code>InputStream</code> object.1158* This method differs from the <code>setBinaryStream (int, InputStream)</code>1159* method because it informs the driver that the parameter value should be1160* sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,1161* the driver may have to do extra work to determine whether the parameter1162* data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>1163*1164* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1165* it might be more efficient to use a version of1166* <code>setBlob</code> which takes a length parameter.1167*1168* @param parameterIndex index of the first parameter is 1,1169* the second is 2, ...1170* @param inputStream An object that contains the data to set the parameter1171* value to.1172* @throws SQLException if parameterIndex does not correspond to a parameter1173* marker in the SQL statement; if a database access error occurs;1174* this method is called on a closed <code>PreparedStatement</code> or1175* if parameterIndex does not correspond1176* to a parameter marker in the SQL statement,1177* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1178*1179* @since 1.61180*/1181void setBlob(int parameterIndex, InputStream inputStream)1182throws SQLException;1183/**1184* Sets the designated parameter to a <code>Reader</code> object.1185* This method differs from the <code>setCharacterStream (int, Reader)</code> method1186* because it informs the driver that the parameter value should be sent to1187* the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the1188* driver may have to do extra work to determine whether the parameter1189* data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>1190* <P><B>Note:</B> Consult your JDBC driver documentation to determine if1191* it might be more efficient to use a version of1192* <code>setNClob</code> which takes a length parameter.1193*1194* @param parameterIndex index of the first parameter is 1, the second is 2, ...1195* @param reader An object that contains the data to set the parameter value to.1196* @throws SQLException if parameterIndex does not correspond to a parameter1197* marker in the SQL statement;1198* if the driver does not support national character sets;1199* if the driver can detect that a data conversion1200* error could occur; if a database access error occurs or1201* this method is called on a closed <code>PreparedStatement</code>1202* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method1203*1204* @since 1.61205*/1206void setNClob(int parameterIndex, Reader reader)1207throws SQLException;12081209//------------------------- JDBC 4.2 -----------------------------------12101211/**1212* <p>Sets the value of the designated parameter with the given object.1213*1214* If the second argument is an {@code InputStream} then the stream1215* must contain the number of bytes specified by scaleOrLength.1216* If the second argument is a {@code Reader} then the reader must1217* contain the number of characters specified by scaleOrLength. If these1218* conditions are not true the driver will generate a1219* {@code SQLException} when the prepared statement is executed.1220*1221* <p>The given Java object will be converted to the given targetSqlType1222* before being sent to the database.1223*1224* If the object has a custom mapping (is of a class implementing the1225* interface {@code SQLData}),1226* the JDBC driver should call the method {@code SQLData.writeSQL} to1227* write it to the SQL data stream.1228* If, on the other hand, the object is of a class implementing1229* {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},1230* {@code Struct}, {@code java.net.URL},1231* or {@code Array}, the driver should pass it to the database as a1232* value of the corresponding SQL type.1233*1234* <p>Note that this method may be used to pass database-specific1235* abstract data types.1236*<P>1237* The default implementation will throw {@code SQLFeatureNotSupportedException}1238*1239* @param parameterIndex the first parameter is 1, the second is 2, ...1240* @param x the object containing the input parameter value1241* @param targetSqlType the SQL type to be sent to the database. The1242* scale argument may further qualify this type.1243* @param scaleOrLength for {@code java.sql.JDBCType.DECIMAL}1244* or {@code java.sql.JDBCType.NUMERIC types},1245* this is the number of digits after the decimal point. For1246* Java Object types {@code InputStream} and {@code Reader},1247* this is the length1248* of the data in the stream or reader. For all other types,1249* this value will be ignored.1250* @exception SQLException if parameterIndex does not correspond to a1251* parameter marker in the SQL statement; if a database access error occurs1252* or this method is called on a closed {@code PreparedStatement} or1253* if the Java Object specified by x is an InputStream1254* or Reader object and the value of the scale parameter is less1255* than zero1256* @exception SQLFeatureNotSupportedException if1257* the JDBC driver does not support the specified targetSqlType1258* @see JDBCType1259* @see SQLType1260* @since 1.81261*/1262default void setObject(int parameterIndex, Object x, SQLType targetSqlType,1263int scaleOrLength) throws SQLException {1264throw new SQLFeatureNotSupportedException("setObject not implemented");1265}12661267/**1268* Sets the value of the designated parameter with the given object.1269*1270* This method is similar to {@link #setObject(int parameterIndex,1271* Object x, SQLType targetSqlType, int scaleOrLength)},1272* except that it assumes a scale of zero.1273*<P>1274* The default implementation will throw {@code SQLFeatureNotSupportedException}1275*1276* @param parameterIndex the first parameter is 1, the second is 2, ...1277* @param x the object containing the input parameter value1278* @param targetSqlType the SQL type to be sent to the database1279* @exception SQLException if parameterIndex does not correspond to a1280* parameter marker in the SQL statement; if a database access error occurs1281* or this method is called on a closed {@code PreparedStatement}1282* @exception SQLFeatureNotSupportedException if1283* the JDBC driver does not support the specified targetSqlType1284* @see JDBCType1285* @see SQLType1286* @since 1.81287*/1288default void setObject(int parameterIndex, Object x, SQLType targetSqlType)1289throws SQLException {1290throw new SQLFeatureNotSupportedException("setObject not implemented");1291}12921293/**1294* Executes the SQL statement in this <code>PreparedStatement</code> object,1295* which must be an SQL Data Manipulation Language (DML) statement,1296* such as <code>INSERT</code>, <code>UPDATE</code> or1297* <code>DELETE</code>; or an SQL statement that returns nothing,1298* such as a DDL statement.1299* <p>1300* This method should be used when the returned row count may exceed1301* {@link Integer#MAX_VALUE}.1302* <p>1303* The default implementation will throw {@code UnsupportedOperationException}1304*1305* @return either (1) the row count for SQL Data Manipulation Language1306* (DML) statements or (2) 0 for SQL statements that return nothing1307* @exception SQLException if a database access error occurs;1308* this method is called on a closed <code>PreparedStatement</code>1309* or the SQL statement returns a <code>ResultSet</code> object1310* @throws SQLTimeoutException when the driver has determined that the1311* timeout value that was specified by the {@code setQueryTimeout}1312* method has been exceeded and has at least attempted to cancel1313* the currently running {@code Statement}1314* @since 1.81315*/1316default long executeLargeUpdate() throws SQLException {1317throw new UnsupportedOperationException("executeLargeUpdate not implemented");1318}1319}132013211322