Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.sql

Interface PreparedStatement

java.lang.Object
|
+--java.sql.Statement
   |
   +--java.sql.PreparedStatement

All Implemented Interfaces:

Statement


public interface PreparedStatement

implements Statement

This interface provides a mechanism for executing pre-compiled statements. This provides greater efficiency when calling the same statement multiple times. Parameters are allowed in a statement, providings for maximum reusability.

Author:

Method Summary

voidaddBatch()

This method adds a set of parameters to the batch for JDBC 2.0.
voidclearParameters()

This method clears all of the input parameter that have been set on this statement.
booleanexecute()

This method executes a prepared SQL query.
java.sql.ResultSetexecuteQuery()

This method executes a prepared SQL query and returns its ResultSet.
intexecuteUpdate()

This method executes an SQL INSERT, UPDATE or DELETE statement.
java.sql.ResultSetMetaDatagetMetaData()

This method returns meta data for the result set from this statement.
java.sql.ParameterMetaDatagetParameterMetaData()

voidsetArray(int i, java.sql.Array x)

This method sets the specified parameter from the given Java Array value.
voidsetAsciiStream(int parameterIndex, java.io.InputStream x, int length)

This method sets the specified parameter from the given Java ASCII InputStream value.
voidsetBigDecimal(int parameterIndex, java.math.BigDecimal x)

This method sets the specified parameter from the given Java java.math.BigDecimal value.
voidsetBinaryStream(int parameterIndex, java.io.InputStream x, int length)

This method sets the specified parameter from the given Java binary InputStream value.
voidsetBlob(int i, java.sql.Blob x)

This method sets the specified parameter from the given Java Blob value.
voidsetBoolean(int parameterIndex, boolean x)

This method sets the specified parameter from the given Java boolean value.
voidsetByte(int parameterIndex, byte x)

This method sets the specified parameter from the given Java byte value.
voidsetBytes(int parameterIndex, byte[] x)

This method sets the specified parameter from the given Java byte array value.
voidsetCharacterStream(int parameterIndex, java.io.Reader reader, int length)

This method sets the specified parameter from the given Java character Reader value.
voidsetClob(int i, java.sql.Clob x)

This method sets the specified parameter from the given Java Clob value.
voidsetDate(int parameterIndex, java.sql.Date x)

This method sets the specified parameter from the given Java java.sql.Date value.
voidsetDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)

This method sets the specified parameter from the given Java java.sql.Date value.
voidsetDouble(int parameterIndex, double x)

This method sets the specified parameter from the given Java double value.
voidsetFloat(int parameterIndex, float x)

This method sets the specified parameter from the given Java float value.
voidsetInt(int parameterIndex, int x)

This method sets the specified parameter from the given Java int value.
voidsetLong(int parameterIndex, long x)

This method sets the specified parameter from the given Java long value.
voidsetNull(int parameterIndex, int sqlType)

This method populates the specified parameter with a SQL NULL value for the specified type.
voidsetNull(int paramIndex, int sqlType, java.lang.String typeName)

This method populates the specified parameter with a SQL NULL value for the specified type.
voidsetObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)

This method sets the specified parameter from the given Java Object value.
voidsetObject(int parameterIndex, java.lang.Object x, int targetSqlType)

This method sets the specified parameter from the given Java Object value.
voidsetObject(int parameterIndex, java.lang.Object x)

This method sets the specified parameter from the given Java Object value.
voidsetRef(int i, java.sql.Ref x)

This method sets the specified parameter from the given Java Ref value.
voidsetShort(int parameterIndex, short x)

This method sets the specified parameter from the given Java short value.
voidsetString(int parameterIndex, java.lang.String x)

This method sets the specified parameter from the given Java String value.
voidsetTime(int parameterIndex, java.sql.Time x)

This method sets the specified parameter from the given Java java.sql.Time value.
voidsetTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)

This method sets the specified parameter from the given Java java.sql.Time value.
voidsetTimestamp(int parameterIndex, java.sql.Timestamp x)

This method sets the specified parameter from the given Java java.sql.Timestamp value.
voidsetTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)

This method sets the specified parameter from the given Java java.sql.Timestamp value.
voidsetURL(int parameterIndex, java.net.URL x)

voidsetUnicodeStream(int parameterIndex, java.io.InputStream x, int length)

This method sets the specified parameter from the given Java Unicode UTF-8 InputStream value.

Method Details

addBatch

public void addBatch()

This method adds a set of parameters to the batch for JDBC 2.0.

Throws:


clearParameters

public void clearParameters()

This method clears all of the input parameter that have been set on this statement.

Throws:


execute

public boolean execute()

This method executes a prepared SQL query. Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate.

Returns:

Throws:


executeQuery

public ResultSet executeQuery()

This method executes a prepared SQL query and returns its ResultSet.

Returns:

Throws:


executeUpdate

public int executeUpdate()

This method executes an SQL INSERT, UPDATE or DELETE statement. SQL statements that return nothing such as SQL DDL statements can be executed.

Returns:

Throws:


getMetaData

public ResultSetMetaData getMetaData()

This method returns meta data for the result set from this statement.

Returns:

Throws:


getParameterMetaData

public ParameterMetaData getParameterMetaData()

Since:

setArray

public void setArray(int i, java.sql.Array x)

This method sets the specified parameter from the given Java Array value. The default object type to SQL type mapping will be used.

Parameters:

Throws:


setAsciiStream

public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length)

This method sets the specified parameter from the given Java ASCII InputStream value.

Parameters:

Throws:


setBigDecimal

public void setBigDecimal(int parameterIndex, java.math.BigDecimal x)

This method sets the specified parameter from the given Java java.math.BigDecimal value.

Parameters:

Throws:


setBinaryStream

public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length)

This method sets the specified parameter from the given Java binary InputStream value.

Parameters:

Throws:


setBlob

public void setBlob(int i, java.sql.Blob x)

This method sets the specified parameter from the given Java Blob value. The default object type to SQL type mapping will be used.

Parameters:

Throws:


setBoolean

public void setBoolean(int parameterIndex, boolean x)

This method sets the specified parameter from the given Java boolean value.

Parameters:

Throws:


setByte

public void setByte(int parameterIndex, byte x)

This method sets the specified parameter from the given Java byte value.

Parameters:

Throws:


setBytes

public void setBytes(int parameterIndex, byte[] x)

This method sets the specified parameter from the given Java byte array value.

Parameters:

Throws:


setCharacterStream

public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length)

This method sets the specified parameter from the given Java character Reader value.

Parameters:

Throws:


setClob

public void setClob(int i, java.sql.Clob x)

This method sets the specified parameter from the given Java Clob value. The default object type to SQL type mapping will be used.

Parameters:

Throws:


setDate

public void setDate(int parameterIndex, java.sql.Date x)

This method sets the specified parameter from the given Java java.sql.Date value.

Parameters:

Throws:


setDate

public void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)

This method sets the specified parameter from the given Java java.sql.Date value.

Parameters:

Throws:


setDouble

public void setDouble(int parameterIndex, double x)

This method sets the specified parameter from the given Java double value.

Parameters:

Throws:


setFloat

public void setFloat(int parameterIndex, float x)

This method sets the specified parameter from the given Java float value.

Parameters:

Throws:


setInt

public void setInt(int parameterIndex, int x)

This method sets the specified parameter from the given Java int value.

Parameters:

Throws:


setLong

public void setLong(int parameterIndex, long x)

This method sets the specified parameter from the given Java long value.

Parameters:

Throws:


setNull

public void setNull(int parameterIndex, int sqlType)

This method populates the specified parameter with a SQL NULL value for the specified type.

Parameters:

Throws:


setNull

public void setNull(int paramIndex, int sqlType, java.lang.String typeName)

This method populates the specified parameter with a SQL NULL value for the specified type.

Parameters:

Throws:


setObject

public void setObject(int parameterIndex, java.lang.Object x)

This method sets the specified parameter from the given Java Object value. The default object type to SQL type mapping will be used.

Parameters:

Throws:


setObject

public void setObject(int parameterIndex, java.lang.Object x, int targetSqlType)

This method sets the specified parameter from the given Java Object value. The specified SQL object type will be used.

Parameters:

Throws:

See Also:


setObject

public void setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)

This method sets the specified parameter from the given Java Object value. The specified SQL object type will be used.

Parameters:

Throws:

See Also:


setRef

public void setRef(int i, java.sql.Ref x)

This method sets the specified parameter from the given Java Ref value. The default object type to SQL type mapping will be used.

Parameters:

Throws:


setShort

public void setShort(int parameterIndex, short x)

This method sets the specified parameter from the given Java short value.

Parameters:

Throws:


setString

public void setString(int parameterIndex, java.lang.String x)

This method sets the specified parameter from the given Java String value.

Parameters:

Throws:


setTime

public void setTime(int parameterIndex, java.sql.Time x)

This method sets the specified parameter from the given Java java.sql.Time value.

Parameters:

Throws:


setTime

public void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)

This method sets the specified parameter from the given Java java.sql.Time value.

Parameters:

Throws:


setTimestamp

public void setTimestamp(int parameterIndex, java.sql.Timestamp x)

This method sets the specified parameter from the given Java java.sql.Timestamp value.

Parameters:

Throws:


setTimestamp

public void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)

This method sets the specified parameter from the given Java java.sql.Timestamp value.

Parameters:

Throws:


setURL

public void setURL(int parameterIndex, java.net.URL x)

Since:Parameters:


setUnicodeStream

public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length)

This method sets the specified parameter from the given Java Unicode UTF-8 InputStream value.

Parameters:

Throws: