Help Center > > Developer Guide> Tutorial: Development Using JDBC or ODBC> JDBC Interface Reference> java.sql.PreparedStatement

java.sql.PreparedStatement

Updated at: Jul 15, 2020 GMT+08:00

This section describes java.sql.PreparedStatement, the interface for preparing statements.

Table 1 Support status for java.sql.PreparedStatement

Method Name

Return Type

Support JDBC 4

clearParameters()

void

Yes

execute()

Boolean

Yes

executeQuery()

ResultSet

Yes

excuteUpdate()

int

Yes

getMetaData()

ResultSetMetaData

Yes

setBoolean(int parameterIndex, boolean x)

void

Yes

setBigDecimal(int parameterIndex, BigDecimal x)

void

Yes

setByte(int parameterIndex, byte x)

void

Yes

setBytes(int parameterIndex, byte[] x)

void

Yes

setDate(int parameterIndex, Date x)

void

Yes

setDouble(int parameterIndex, double x)

void

Yes

setFloat(int parameterIndex, float x)

void

Yes

setInt(int parameterIndex, int x)

void

Yes

setLong(int parameterIndex, long x)

void

Yes

setNString(int parameterIndex, String value)

void

Yes

setShort(int parameterIndex, short x)

void

Yes

setString(int parameterIndex, String x)

void

Yes

addBatch()

void

Yes

executeBatch()

int[]

Yes

clearBatch()

void

Yes

  • Execute addBatch() and execute() only after running clearBatch().
  • Batch is not cleared by calling executeBatch(). Clear batch by explicitly calling clearBatch().
  • After bounded variables of a batch are added, if you want to reuse these values (add a batch again), set*() is not necessary.
  • The following methods are inherited from java.sql.Statement: close, execute, executeQuery, executeUpdate, getConnection, getResultSet, getUpdateCount, isClosed, setMaxRows, and setFetchSize.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel