PreparedStatement (Java Platform SE 7 )

Methods

 

Modifier and Type
Method and Description

void
addBatch()

Adds a set of parameters to this PreparedStatement
object’s batch of commands.

void
clearParameters()

Clears the current parameter values immediately.

boolean
execute()

Executes the SQL statement in this PreparedStatement object,
which may be any kind of SQL statement.

ResultSet
executeQuery()

Executes the SQL query in this PreparedStatement object
and returns the ResultSet object generated by the query.

int
executeUpdate()

Executes the SQL statement in this PreparedStatement object,
which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.

ResultSetMetaData
getMetaData()

Retrieves a ResultSetMetaData object that contains
information about the columns of the ResultSet object
that will be returned when this PreparedStatement object
is executed.

ParameterMetaData
getParameterMetaData()

Retrieves the number, types and properties of this
PreparedStatement object’s parameters.

void
setArray(int parameterIndex,
Array x)

Sets the designated parameter to the given java.sql.Array object.

void
setAsciiStream(int parameterIndex,
InputStream x)

Sets the designated parameter to the given input stream.

void
setAsciiStream(int parameterIndex,
InputStream x,
int length)

Sets the designated parameter to the given input stream, which will have
the specified number of bytes.

void
setAsciiStream(int parameterIndex,
InputStream x,
long length)

Sets the designated parameter to the given input stream, which will have
the specified number of bytes.

void
setBigDecimal(int parameterIndex,
BigDecimal x)

Sets the designated parameter to the given java.math.BigDecimal value.

void
setBinaryStream(int parameterIndex,
InputStream x)

Sets the designated parameter to the given input stream.

void
setBinaryStream(int parameterIndex,
InputStream x,
int length)

Sets the designated parameter to the given input stream, which will have
the specified number of bytes.

void
setBinaryStream(int parameterIndex,
InputStream x,
long length)

Sets the designated parameter to the given input stream, which will have
the specified number of bytes.

void
setBlob(int parameterIndex,
Blob x)

Sets the designated parameter to the given java.sql.Blob object.

void
setBlob(int parameterIndex,
InputStream inputStream)

Sets the designated parameter to a InputStream object.

void
setBlob(int parameterIndex,
InputStream inputStream,
long length)

Sets the designated parameter to a InputStream object.

void
setBoolean(int parameterIndex,
boolean x)

Sets the designated parameter to the given Java boolean value.

void
setByte(int parameterIndex,
byte x)

Sets the designated parameter to the given Java byte value.

void
setBytes(int parameterIndex,
byte[] x)

Sets the designated parameter to the given Java array of bytes.

void
setCharacterStream(int parameterIndex,
Reader reader)

Sets the designated parameter to the given Reader
object.

void
setCharacterStream(int parameterIndex,
Reader reader,
int length)

Sets the designated parameter to the given Reader
object, which is the given number of characters long.

void
setCharacterStream(int parameterIndex,
Reader reader,
long length)

Sets the designated parameter to the given Reader
object, which is the given number of characters long.

void
setClob(int parameterIndex,
Clob x)

Sets the designated parameter to the given java.sql.Clob object.

void
setClob(int parameterIndex,
Reader reader)

Sets the designated parameter to a Reader object.

void
setClob(int parameterIndex,
Reader reader,
long length)

Sets the designated parameter to a Reader object.

void
setDate(int parameterIndex,
Date x)

Sets the designated parameter to the given java.sql.Date value
using the default time zone of the virtual machine that is running
the application.

void
setDate(int parameterIndex,
Date x,
Calendar cal)

Sets the designated parameter to the given java.sql.Date value,
using the given Calendar object.

void
setDouble(int parameterIndex,
double x)

Sets the designated parameter to the given Java double value.

void
setFloat(int parameterIndex,
float x)

Sets the designated parameter to the given Java float value.

void
setInt(int parameterIndex,
int x)

Sets the designated parameter to the given Java int value.

void
setLong(int parameterIndex,
long x)

Sets the designated parameter to the given Java long value.

void
setNCharacterStream(int parameterIndex,
Reader value)

Sets the designated parameter to a Reader object.

void
setNCharacterStream(int parameterIndex,
Reader value,
long length)

Sets the designated parameter to a Reader object.

void
setNClob(int parameterIndex,
NClob value)

Sets the designated parameter to a java.sql.NClob object.

void
setNClob(int parameterIndex,
Reader reader)

Sets the designated parameter to a Reader object.

void
setNClob(int parameterIndex,
Reader reader,
long length)

Sets the designated parameter to a Reader object.

void
setNString(int parameterIndex,
String value)

Sets the designated paramter to the given String object.

void
setNull(int parameterIndex,
int sqlType)

Sets the designated parameter to SQL NULL.

void
setNull(int parameterIndex,
int sqlType,
String typeName)

Sets the designated parameter to SQL NULL.

void
setObject(int parameterIndex,
Object x)

Sets the value of the designated parameter using the given object.

void
setObject(int parameterIndex,
Object x,
int targetSqlType)

Sets the value of the designated parameter with the given object.

void
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength)

Sets the value of the designated parameter with the given object.

void
setRef(int parameterIndex,
Ref x)

Sets the designated parameter to the given
REF(<structured-type>) value.

void
setRowId(int parameterIndex,
RowId x)

Sets the designated parameter to the given java.sql.RowId object.

void
setShort(int parameterIndex,
short x)

Sets the designated parameter to the given Java short value.

void
setSQLXML(int parameterIndex,
SQLXML xmlObject)

Sets the designated parameter to the given java.sql.SQLXML object.

void
setString(int parameterIndex,
String x)

Sets the designated parameter to the given Java String value.

void
setTime(int parameterIndex,
Time x)

Sets the designated parameter to the given java.sql.Time value.

void
setTime(int parameterIndex,
Time x,
Calendar cal)

Sets the designated parameter to the given java.sql.Time value,
using the given Calendar object.

void
setTimestamp(int parameterIndex,
Timestamp x)

Sets the designated parameter to the given java.sql.Timestamp value.

void
setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal)

Sets the designated parameter to the given java.sql.Timestamp value,
using the given Calendar object.

void
setUnicodeStream(int parameterIndex,
InputStream x,
int length)

Deprecated.  

void
setURL(int parameterIndex,
URL x)

Sets the designated parameter to the given java.net.URL value.