-
setObject
void setObject(java.lang.String parameterName,
java.lang.Object x,
int targetSqlType,
int scale)
throws SQLException
Sets the value of the designated parameter with the given object. The second argument must be an object type; for integral values, the java.lang equivalent objects should be used.Thegiven Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the interface SQLData ), the JDBC driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref , Blob , Clob , NClob , Struct , java.net.URL , or Array , the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass datatabase- specific abstract data types.
-
Parameters:
-
parameterName - the name of the parameter
-
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 point. For all other types, this value will be ignored.
-
Throws:
-
SQLException - if parameterName does not correspond to a named parameter; if a database access error occurs or this method is called on a closed CallableStatement
-
SQLFeatureNotSupportedException - if targetSqlType is a ARRAY , BLOB , CLOB , DATALINK , JAVA_OBJECT , NCHAR , NCLOB , NVARCHAR , LONGNVARCHAR , REF , ROWID , SQLXML or STRUCT data type andthe JDBC driver does not support this data type
-
Since:
- 1.4
-
See Also:
-
Types , getObject(int)
|
-
setObject
void setObject(java.lang.String parameterName,
java.lang.Object x,
int targetSqlType,
int scale)
throws SQLException
Sets the value of the designated parameter with the given object. The second argument must be an object type; for integral values, the java.lang equivalent objects should be used. The given Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the interface SQLData ), the JDBC driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref , Blob , Clob , NClob , Struct , java.net.URL , or Array , the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass datatabase- specific abstract data types.
-
Parameters:
-
parameterName - the name of the parameter
-
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 point. For all other types, this value will be ignored.
-
Throws:
-
SQLException - if parameterName does not correspond to a named parameter; if a database access error occurs or this method is called on a closed CallableStatement
-
SQLFeatureNotSupportedException - if targetSqlType is a ARRAY , BLOB , CLOB , DATALINK , JAVA_OBJECT , NCHAR , NCLOB , NVARCHAR , LONGNVARCHAR , REF , ROWID , SQLXML or STRUCT data type and the JDBC driver does not support this data type
-
Since:
- 1.4
-
See Also:
-
Types , getObject(int)
|
-
setObject
void setObject(java.lang.String parameterName,
java.lang.Object x,
int targetSqlType,
int scale)
throws SQLException
Sets the value of the designated parameter with the given object. The given Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the interface SQLData ), the JDBC driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref , Blob , Clob , NClob , Struct , java.net.URL , or Array , the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass datatabase- specific abstract data types.
-
Parameters:
-
parameterName - the name of the parameter
-
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 point. For all other types, this value will be ignored.
-
Throws:
-
SQLException - if parameterName does not correspond to a named parameter; if a database access error occurs or this method is called on a closed CallableStatement
-
SQLFeatureNotSupportedException - if the JDBC driver does not support this data type
-
Since:
- 1.4
-
See Also:
-
Types , getObject(int)
|
|