java.sql.PreparedStatement is a prepared statement interface.
Description
An SQL statement is precompiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.
Note that the setter methods such as setShort and setString for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For example, if the SQL type of the IN parameter is INTEGER, the method setInt should be used. To support conversions of arbitrary parameter types, the setObject method must be used with a target SQL type.
Methods
| Method | Return type | Supported in Oracle mode? | Supported in MySQL mode? |
|---|---|---|---|
| executeQuery() | ResultSet | Yes | Yes |
| executeUpdate() | int | Yes | Yes |
| setNull(int parameterIndex, int sqlType) | void | Yes | Yes |
| setBoolean(int parameterIndex, boolean x) | void | Yes | Yes |
| setByte(int parameterIndex, byte x) | void | Yes | Yes |
| setShort(int parameterIndex, short x) | void | Yes | Yes |
| setString(int parameterIndex, short x) | void | Yes | Yes |
| setInt(int parameterIndex, int x) | void | Yes | Yes |
| setLong(int parameterIndex, long x) | void | Yes | Yes |
| setFloat(int parameterIndex, float x) | void | Yes | Yes |
| setDouble(int parameterIndex, double x) | void | Yes | Yes |
| setBigDecimal(int parameterIndex,BigDecimal x) | void | Yes | Yes |
| setBytes(int parameterIndex, bytex[]) | void | Yes | Yes |
| setDate(int parameterIndex,java.sql.Date x) | void | Yes | Yes |
| setTime(int parameterIndex,java.sql.Time x) | void | Yes | Yes |
| setTimestamp(int parameterIndex,java.sql.Timestamp x) | void | Yes | Yes |
| setAsciiStream(int parameterIndex,java.io.InputStream x, int length) | void | Yes | Yes |
| setUnicodeStream(int parameterIndex,java.io.InputStream x,int length) | void | Yes | Yes |
| setBinaryStream(int parameterIndex,java.io.InputStream x,int length) | void | Yes | Yes |
| clearParameters() | void | Yes | Yes |
| setObject(int parameterIndex,Object x, int targetSqlType) | void | Yes | Yes |
| setObject(int parameterIndex,Object x) | void | Yes | Yes |
| execute() | Boolean | Yes | Yes |
| executeBatch() | int[] | Yes | Yes |
| addBatch() | void | Yes | Yes |
| setCharacterStream(int parameterIndex,java.io.Reader reader, int length) | void | Yes | Yes |
| setRef(int parameterIndex,Ref x) | void | No | No |
| setBlob(int parameterIndex,Blob x) | void | Yes | Yes |
| setClob(int parameterIndex,Clob x) | void | Yes | Yes |
| setArray(int parameterIndex,Array x) | void | Yes | Yes |
| getMetaData() | ResultSetMetaData | Yes | Yes |
| setDate(int parameterIndex,java.sql.Date x,Calendar cal) | void | Yes | Yes |
| setURL(int parameterIndex,java.net.URL x) | void | Yes | Yes |
| getParameterMetaData() | ParameterMetaData | Yes | Yes |
| setRowId(int parameterIndex,RowId x) | void | No | No |
| setNString(int parameterIndex,String value) | void | Yes | Yes |
| setNCharacterStream(int parameterIndex,Reader value, long length) | void | Yes | Yes |
| setNClob(int parameterIndex,NClob value) | void | Yes | Yes |
| setSQLXML(int parameterIndex,SQLXML xmlObject) | void | No | No |
| setObject(int parameterIndex,Object x, int targetSqlType, int scaleOrLength) | void | Yes | Yes |
| setObject(int parameterIndex,Object x,SQLType targetSqlType) | void | Yes | Yes |
| setObject(int parameterIndex,Object x,SQLType targetSqlType, intscaleOrLength) | void | Yes | Yes |
| setCharacterStream(int parameterIndex,java.io.Reader reader) | void | Yes | Yes |
| setCharacterStream(int parameterIndex,java.io.Reader reader, long length) | void | Yes | Yes |
| executeLargeUpdate() | long | Yes | Yes |