The PreparedStatement interface creates an object that represents a precompiled SQL statement.
A SQL statement is pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.
java.sql package
public interface PreparedStatement
extends Statement
ǥ 101 lists the methods in the PreparedStatement
interface that are supported by DB2 Everyplace.
ǥ 101. PreparedStatement interface methods
Method return value type | Method |
---|---|
void | clearParameters() Clears the current parameter values immediately. |
boolean | execute() Executes any kind of SQL statement. |
ResultSet | executeQuery() Executes the SQL query in this PreparedStatement object and returns the result set generated by the query. |
int | executeUpdate() Executes the SQL INSERT, UPDATE or DELETE statement in this PreparedStatement object. |
void | setBigDecimal (int parameterIndex, BigDecimal x) Sets the designated parameter to a java.lang.BigDecimal value. This method is not available in the DB2 Everyplace JDBC driver for Palm OS. |
void | setBoolean (int parameterIndex, boolean x) Sets the designated parameter to a Java boolean value. The DB2 Everyplace JDBC driver converts this to an SQL SMALLINT value when it sends it to the database. |
void | setBlob(int i, Blob x) JDBC 2.0 Sets a BLOB parameter. |
void | setBytes(int parameterIndex, byte[ ]x) Sets the designated parameter to a Java array of bytes. |
void | setDate(int parameterIndex, Date x) Sets the designated parameter to a java.sql.Date value. |
void | setDouble(int parameterIndex, double x) Sets the designated parameter to a Java double value. The DB2 Everyplace JDBC driver converts this to an SQL DECIMAL value when it sends it to the database. |
void | setFloat(int parameterIndex, float x) Sets the designated
parameter to a Java float value.
When a BigDecimal is converted to float, if the BigDecimal is too large to represent as a float, it will be converted to FLOAT.NEGATIVE_INFINITY or FLOAT.POSITIVE_INFINITY as appropriate. |
void | setInt (int parameterIndex, int x) Sets the designated parameter to a Java int value. |
void | setLong(int parameterIndex, long x) Sets the designated parameter to a Java long value. |
void | setNull (int parameterIndex, int sqlType) Sets the designated parameter to SQL NULL. |
void | setObject(int parameterIndex, Object x, int targetSqlType) Sets the value of the designated parameter with the given object.
DB2 Everyplace restrictions:
|
void | setShort (int parameterIndex, short x) Sets the designated parameter to a Java short value. |
void | setString (int parameterIndex, String x) Sets the designated parameter to a Java String value. |
void | setTime (int parameterIndex, Time x) Sets the designated parameter to a java.sql.Time value. |
void | setTimestamp (int parameterIndex, Timestamp x) Sets the designated parameter to a java.sql.Timestamp value. |
Related tasks
Related reference