Sets the designated parameter to an Object in the Java
programming language. The second parameter must be an
Object
type. For integral values, the java.lang equivalent
objects should be used. For example, use the class Integer
for an int.
The JDBC specification defines a standard mapping from
Java Object types to SQL types. The driver will
use this standard mapping to convert the given object
to its corresponding SQL type before sending it to the database.
If the object has a custom mapping (is of a class implementing
SQLData), the driver should call the method
SQLData.writeSQL to write the object to the SQL
data stream.
If, on the other hand, the object is of a class
implementing Ref, Blob, Clob,
Struct, or Array,
the driver should pass it to the database as a value of the
corresponding SQL type.
This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one interface.
Note that this method may be used to pass database-specific abstract data types.
The parameter value set by this method is stored internally and
will be supplied as the appropriate parameter in this RowSet
object's command when the method execute is called.
Methods such as execute and populate must be
provided in any class that extends this class and implements one or
more of the standard JSR-114 RowSet interfaces.
NOTE: JdbcRowSet does not require the populate method
as it is undefined in this class.
After this method has been called, a call to the
method getParams
will return an object array of the current command parameters, which will
include the Object set for placeholder parameter number
parameterIndex.
Note that because the numbering of elements in an array starts at zero,
the array element that corresponds to placeholder parameter number
parameterIndex is element number parameterIndex -1.
parameterIndex | the ordinal number of the placeholder parameter
in this RowSet object's command that is to be set.
The first parameter is 1, the second is 2, and so on; must be
1 or greater | |
x | the object containing the input parameter value |
SQLException | if an error occurs the parameter index is out of bounds, or there is ambiguity in the implementation of the object being set |
getParams
Diagram: RowSet Support