The com.ibm.db2.jcc.DB2PreparedStatement interface extends the com.ibm.db2.jcc.DB2Statement and java.sql.PreparedStatement interfaces.
The following constants are defined only for the IBM® Data Server Driver for JDBC and SQLJ.
The following methods are defined only for the IBM Data Server Driver for JDBC and SQLJ.
public void executeDB2QueryBatch()
throws java.sql.SQLException
Executes a statement batch that contains queries with parameters.
This method is not supported for connections to IBM Informix® data sources.
public java.sql.ResultSet[] getDBGeneratedKeys()
throws java.sql.SQLException
Retrieves automatically generated keys that were created when INSERT statements were executed in a batch. Each ResultSet object that is returned contains the automatically generated keys for a single statement in the batch.
getDBGeneratedKeys returns an array of length 0 under the following conditions:
Connection.prepareStatement(String sql, int[] autoGeneratedKeys)
Connection.prepareStatement(String sql, String[] autoGeneratedColumnNames)
Connection.prepareStatement(String sql, Statement.RETURN_GENERATED_KEYS)
If getDBGeneratedKeys is called against a PreparedStatement that was created using one of the previously listed methods, and the PreparedStatement is not in a batch, a single ResultSet is returned.
public int getEstimateCost()
throws java.sql.SQLException
Returns the estimated cost of an SQL statement from the data server after the data server dynamically prepares the statement successfully. This value is the same as the fourth element in the sqlerrd array of the SQLCA.
If the deferPrepares property is set to true, calling getEstimateCost causes the data server to execute a dynamic prepare operation.
If the SQL statement cannot be prepared, or the data server does not return estimated cost information at prepare time, getEstimateCost returns -1.
public int getEstimateRowCount()
throws java.sql.SQLException
Returns the estimated row count for an SQL statement from the data server after the data server dynamically prepares the statement successfully. This value is the same as the third element in the sqlerrd array of the SQLCA.
If the deferPrepares property is set to true, calling getEstimateRowCount causes the data server to execute a dynamic prepare operation.
If the SQL statement cannot be prepared, or the data server does not return estimated row count information at prepare time, getEstimateRowCount returns -1.
public void setDBTimestamp(int parameterIndex,
DBTimestamp timestamp)
throws java.sql.SQLException
Assigns a DBTimestamp value to a parameter.
This method is not supported for connections to IBM Informix data sources.
public void setJccArrayAtName(String parameterMarkerName,
java.sql.Array x)
throws java.sql.SQLException
Assigns a java.sql.Array value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
Supported by the IBM Data Server Driver for JDBC and SQLJ version 3.57 and later:
public void setJccAsciiStreamAtName(String parameterMarkerName,
java.io.InputStream x, int length)
throws java.sql.SQLException
Supported by the IBM Data Server Driver for JDBC and SQLJ version 4.7 and later:
public void setJccAsciiStreamAtName(String parameterMarkerName,
java.io.InputStream x)
throws java.sql.SQLException
public void setJccAsciiStreamAtName(String parameterMarkerName,
java.io.InputStream x, long length)
throws java.sql.SQLException
Assigns an ASCII value in a java.io.InputStream to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccBigDecimalAtName(String parameterMarkerName,
java.math.BigDecimal x)
throws java.sql.SQLException
Assigns a java.math.BigDecimal value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
Supported by the IBM Data Server Driver for JDBC and SQLJ version 3.57 and later:
public void setJccBinaryStreamAtName(String parameterMarkerName,
java.io.InputStream x, int length)
throws java.sql.SQLException
Supported by the IBM Data Server Driver for JDBC and SQLJ version 4.7 and later:
public void setJccBinaryStreamAtName(String parameterMarkerName,
java.io.InputStream x)
throws java.sql.SQLException
public void setJccBinaryStreamAtName(String parameterMarkerName,
java.io.InputStream x, long length)
throws java.sql.SQLException
Assigns a binary value in a java.io.InputStream to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
Supported by the IBM Data Server Driver for JDBC and SQLJ version 3.57 and later:
public void setJccBlobAtName(String parameterMarkerName,
java.sql.Blob x)
throws java.sql.SQLException
Supported by the IBM Data Server Driver for JDBC and SQLJ version 4.7 and later:
public void setJccBlobAtName(String parameterMarkerName,
java.io.InputStream x)
throws java.sql.SQLException
public void setJccBlobAtName(String parameterMarkerName,
java.io.InputStream x, long length)
throws java.sql.SQLException
Assigns a BLOB value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccBooleanAtName(String parameterMarkerName,
boolean x)
throws java.sql.SQLException
Assigns a boolean value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccByteAtName(String parameterMarkerName,
byte x)
throws java.sql.SQLException
Assigns a byte value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccBytesAtName(String parameterMarkerName,
byte[] x)
throws java.sql.SQLException
Assigns an array of byte values to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
Supported by the IBM Data Server Driver for JDBC and SQLJ version 3.57 and later:
public void setJccCharacterStreamAtName(String parameterMarkerName,
java.io.Reader x, int length)
throws java.sql.SQLException
Supported by the IBM Data Server Driver for JDBC and SQLJ version 4.7 and later:
public void setJccCharacterStreamAtName(String parameterMarkerName,
java.io.Reader x)
throws java.sql.SQLException
public void setJccCharacterStreamAtName(String parameterMarkerName,
java.io.Reader x, long length)
throws java.sql.SQLException
Assigns a Unicode value in a java.io.Reader to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
Supported by the IBM Data Server Driver for JDBC and SQLJ version 3.57 and later:
public void setJccClobAtName(String parameterMarkerName,
java.sql.Clob x)
throws java.sql.SQLException
Supported by the IBM Data Server Driver for JDBC and SQLJ version 4.7 and later:
public void setJccClobAtName(String parameterMarkerName,
java.io.Reader x)
throws java.sql.SQLException
public void setJccClobAtName(String parameterMarkerName,
java.io.Reader x, long length)
throws java.sql.SQLException
Assigns a CLOB value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccDateAtName(String parameterMarkerName,
java.sql.Date x)
throws java.sql.SQLException
public void setJccDateAtName(String parameterMarkerName,
java.sql.Date x,
java.util.Calendar cal)
throws java.sql.SQLException
Assigns a java.sql.Date value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccDBTimestampAtName(String parameterMarkerName,
DBTimestamp timestamp)
throws java.sql.SQLException
Assigns a DBTimestamp value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
This method is not supported for connections to IBM Informix data sources.
public void setJccDBDefaultAtName(String parameterMarkerName)
throws SQLException
Assigns the default value to a named parameter marker. Execution of setJccDBDefaultAtName produces the same results as using the literal DEFAULT in the SQL string, instead of the parameter marker name.
This method is not supported for connections to IBM Informix data sources.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccDBUnassignedAtName(String parameterMarkerName)
throws SQLException
Does not assign a value to the specified named parameter. Execution of setJccDBUnassignedAtName produces the same result as if the specified parameter marker name had not appeared in the SQL string.
This method is not supported for connections to IBM Informix data sources.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccDoubleAtName(String parameterMarkerName,
double x)
throws java.sql.SQLException
Assigns a value of type double to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccFloatAtName(String parameterMarkerName,
float x)
throws java.sql.SQLException
Assigns a value of type float to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccIntAtName(String parameterMarkerName,
int x)
throws java.sql.SQLException
Assigns a value of type int to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccLongAtName(String parameterMarkerName,
long x)
throws java.sql.SQLException
Assigns a value of type long to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccNullAtName(String parameterMarkerName,
int jdbcType)
throws java.sql.SQLException
public void setJccNullAtName(String parameterMarkerName,
int jdbcType,
String typeName)
throws java.sql.SQLException
Assigns the SQL NULL value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccObjectAtName(String parameterMarkerName,
java.sql.Object x)
throws java.sql.SQLException
public void setJccObjectAtName(String parameterMarkerName,
java.sql.Object x,
int targetJdbcType)
throws java.sql.SQLException
public void setJccObjectAtName(String parameterMarkerName,
java.sql.Object x,
int targetJdbcType,
int scale)
throws java.sql.SQLException
Assigns a value with type java.lang.Object to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccShortAtName(String parameterMarkerName,
short x)
throws java.sql.SQLException
Assigns a value of type short to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccSQLXMLAtName(String parameterMarkerName,
java.sql.SQLXML x)
throws java.sql.SQLException
Assigns a value of type java.sql.SQLXML to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
This method is supported only for connections to DB2® for Linux, UNIX, and Windows Version 9.1 or later or DB2 for z/OS® Version 9 or later.
public void setJccStringAtName(String parameterMarkerName,
String x)
throws java.sql.SQLException
Assigns a value of type String to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccTimeAtName(String parameterMarkerName,
java.sql.Time x)
throws java.sql.SQLException
public void setJccTimeAtName(String parameterMarkerName,
java.sql.Time x,
java.util.Calendar cal)
throws java.sql.SQLException
Assigns a java.sql.Time value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccTimestampAtName(String parameterMarkerName,
java.sql.Timestamp x)
throws java.sql.SQLException
public void setJccTimestampAtName(String parameterMarkerName,
java.sql.Timestamp x,
java.util.Calendar cal)
throws java.sql.SQLException
Assigns a java.sql.Timestamp value to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setJccUnicodeStreamAtName(String parameterMarkerName,
java.io.InputStream x, int length)
throws java.sql.SQLException
Assigns a Unicode value in a java.io.InputStream to a named parameter marker.
This method can be called only if the enableNamedParameterMarkers property is set to DB2BaseDataSource.YES (1).
public void setDBDefault(int parameterIndex)
throws SQLException
Assigns the default value to the specified parameter. Execution of setDBDefault produces the same results as using the literal DEFAULT in the SQL string, instead of the parameter.
This method is not supported for connections to IBM Informix data sources.
public void setDBUnassigned(int parameterIndex)
throws SQLException
Does not assign a value to the specified parameter. Execution of setDBUnassigned produces the same result as if the specified parameter had not appeared in the SQL string.
This method is not supported for connections to IBM Informix data sources.