PreparedStatement.setObject

PreparedStatement.setObject

Interface Overview | Interface Members | This Package | All Packages

Syntax 1
public abstract void setObject( int parameterIndex, Object x, int targetSqlType, int scale ) throws SQLException
Parameters
parameterIndex
The first parameter is 1, the second is 2, ...
x
The object containing the input parameter value
targetSqlType
The SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.
scale
For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after the decimal. For all other types this value will be ignored,
Description

Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.

The given Java object will be converted to the targetSqlType before being sent to the database.

Note that this method may be used to pass datatabase- specific abstract data types. This is done by using a Driver- specific Java type and using a targetSqlType of java.sql.types.OTHER.

Exceptions
SQLException if a database-access error occurs.
See Also
Types



Syntax 2
public abstract void setObject( int parameterIndex, Object x, int targetSqlType ) throws SQLException
Description
This method is like setObject above, but assumes a scale of zero.

Exceptions
SQLException if a database-access error occurs.



Syntax 3
public abstract void setObject( int parameterIndex, Object x ) throws SQLException
Parameters
parameterIndex
The first parameter is 1, the second is 2, ...
x
The object containing the input parameter value
Description

Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.

The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.

Note that this method may be used to pass datatabase specific abstract data types, by using a Driver specific Java type.

Exceptions
SQLException if a database-access error occurs.