All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.AS400JDBCCallableStatement

java.lang.Object
   |
   +----com.ibm.as400.access.AS400JDBCStatement
           |
           +----com.ibm.as400.access.AS400JDBCPreparedStatement
                   |
                   +----com.ibm.as400.access.AS400JDBCCallableStatement

public class AS400JDBCCallableStatement
extends AS400JDBCPreparedStatement
implements CallableStatement

The AS400JDBCCallableStatement class runs a stored procedure. Use Connection.prepareCall() to create new CallableStatement objects.

JDBC provides a stored procedure escape syntax that allows stored procedures to be called in a standard way for all database systems. This escape syntax has one form that includes a result parameter and one form that does not. DB2 for OS/400 does not support the form with the result parameter.

Parameters are indexed sequentially, by number, starting at 1. The caller must register output parameters before executing the stored procedure.


Method Index

 o clearParameters()
Releases the resources used by the current input parameter values and registered output parameters.
 o getArray(int)
Returns the value of an SQL ARRAY output parameter as an Array value.
 o getBigDecimal(int)
Returns the value of an SQL NUMERIC or DECIMAL output parameter as a BigDecimal object.
 o getBigDecimal(int, int)
Returns the value of an SQL NUMERIC or DECIMAL output parameter as a BigDecimal object. Deprecated.
 o getBlob(int)
Returns the value of an SQL BLOB output parameter as a Blob value.
 o getBoolean(int)
Returns the value of an SQL SMALLINT output parameter as a Java boolean.
 o getByte(int)
Returns the value of an SQL SMALLINT output parameter as a Java byte.
 o getBytes(int)
Returns the value of an SQL BINARY or VARBINARY output parameter as a Java byte array.
 o getClob(int)
Returns the value of an SQL CLOB output parameter as a Clob value.
 o getDate(int)
Returns the value of an SQL DATE output parameter as a java.sql.Date object using the default calendar.
 o getDate(int, Calendar)
Returns the value of an SQL DATE output parameter as a java.sql.Date object using a calendar other than the default.
 o getDouble(int)
Returns the value of an SQL DOUBLE or FLOAT output parameter as a Java double.
 o getFloat(int)
Returns the value of an SQL REAL or FLOAT output parameter as a Java float.
 o getInt(int)
Returns the value of an SQL INTEGER output parameter as a Java int.
 o getLong(int)
If the connected AS/400 supports SQL BIGINT data, this returns the value of an SQL BIGINT output parameter as a Java long.
 o getObject(int)
Returns the value of an output parameter as a Java Object.
 o getObject(int, Map)
Returns the value of an output parameter as a Java Object.
 o getRef(int)
Returns the value of an SQL REF output parameter as a Ref value.
 o getShort(int)
Returns the value of an SQL SMALLINT output parameter as a Java short value.
 o getString(int)
Returns the value of an SQL CHAR or VARCHAR output parameter as a Java String object.
 o getTime(int)
Returns the value of an SQL TIME output parameter as a java.sql.Time object using the default calendar.
 o getTime(int, Calendar)
Returns the value of an SQL TIME output parameter as a java.sql.Time object using a calendar other than the default.
 o getTimestamp(int)
Returns the value of an SQL TIMESTAMP output parameter as a java.sql.Timestamp object using the default calendar.
 o getTimestamp(int, Calendar)
Returns the value of an SQL TIMESTAMP output parameter as a java.sql.Timestamp object using a calendar other than the default.
 o registerOutParameter(int, int)
Registers the type for an output parameter.
 o registerOutParameter(int, int, int)
Registers the type for an output parameter.
 o registerOutParameter(int, int, String)
Registers the type for an output parameter.
 o wasNull()
Indicates if the last parameter read has the value of SQL NULL.

Methods

 o clearParameters
 public void clearParameters() throws SQLException
Releases the resources used by the current input parameter values and registered output parameters. In general, input parameter values and registered output parameters remain in effect for repeated executions of the callable statement. Setting an input parameter value automatically clears its previous value.

Throws: SQLException
If the statement is not open.
Overrides:
clearParameters in class AS400JDBCPreparedStatement
 o getArray
 public Array getArray(int parameterIndex) throws SQLException
Returns the value of an SQL ARRAY output parameter as an Array value. DB2 for OS/400 does not support arrays.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
Always thrown because DB2 for OS/400 does not support arrays.
 o getBigDecimal
 public BigDecimal getBigDecimal(int parameterIndex) throws SQLException
Returns the value of an SQL NUMERIC or DECIMAL output parameter as a BigDecimal object.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getBigDecimal
 public BigDecimal getBigDecimal(int parameterIndex,
                                 int scale) throws SQLException
Note: getBigDecimal() is deprecated. Use getBigDecimal(int) instead.

Returns the value of an SQL NUMERIC or DECIMAL output parameter as a BigDecimal object.

Parameters:
parameterIndex - The parameter index (1-based).
scale - The number of digits after the decimal.
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the scale is not valid, the statement was not executed, or the requested conversion is not valid.
See Also:
getBigDecimal
 o getBlob
 public Blob getBlob(int parameterIndex) throws SQLException
Returns the value of an SQL BLOB output parameter as a Blob value.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getBoolean
 public boolean getBoolean(int parameterIndex) throws SQLException
Returns the value of an SQL SMALLINT output parameter as a Java boolean.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or false if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getByte
 public byte getByte(int parameterIndex) throws SQLException
Returns the value of an SQL SMALLINT output parameter as a Java byte.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid, or an error occurs.
 o getBytes
 public byte[] getBytes(int parameterIndex) throws SQLException
Returns the value of an SQL BINARY or VARBINARY output parameter as a Java byte array.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getClob
 public Clob getClob(int parameterIndex) throws SQLException
Returns the value of an SQL CLOB output parameter as a Clob value.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getDate
 public Date getDate(int parameterIndex) throws SQLException
Returns the value of an SQL DATE output parameter as a java.sql.Date object using the default calendar.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getDate
 public Date getDate(int parameterIndex,
                     Calendar calendar) throws SQLException
Returns the value of an SQL DATE output parameter as a java.sql.Date object using a calendar other than the default.

Parameters:
parameterIndex - The parameter index (1-based).
calendar - The calendar.
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, the calendar is null, or the requested conversion is not valid.
 o getDouble
 public double getDouble(int parameterIndex) throws SQLException
Returns the value of an SQL DOUBLE or FLOAT output parameter as a Java double.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getFloat
 public float getFloat(int parameterIndex) throws SQLException
Returns the value of an SQL REAL or FLOAT output parameter as a Java float.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getInt
 public int getInt(int parameterIndex) throws SQLException
Returns the value of an SQL INTEGER output parameter as a Java int.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getLong
 public long getLong(int parameterIndex) throws SQLException
If the connected AS/400 supports SQL BIGINT data, this returns the value of an SQL BIGINT output parameter as a Java long. Otherwise, this returns the value of an SQL INTEGER output parameter as a Java long. SQL BIGINT data is supported on V4R5 and later.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getObject
 public Object getObject(int parameterIndex) throws SQLException
Returns the value of an output parameter as a Java Object. The type of the object corresponds to the SQL type that was registered for this parameter using registerOutParameter(). When the parameter is a user-defined type, then the connection's type map is used to create the object.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getObject
 public Object getObject(int parameterIndex,
                         Map typeMap) throws SQLException
Returns the value of an output parameter as a Java Object. This driver does not support the type map.

Parameters:
parameterIndex - The parameter index (1-based).
type - The type map. This is not used.
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getRef
 public Ref getRef(int parameterIndex) throws SQLException
Returns the value of an SQL REF output parameter as a Ref value. DB2 for OS/400 does not support structured types.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
Always thrown because DB2 for OS/400 does not support arrays.
 o getShort
 public short getShort(int parameterIndex) throws SQLException
Returns the value of an SQL SMALLINT output parameter as a Java short value.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or 0 if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getString
 public String getString(int parameterIndex) throws SQLException
Returns the value of an SQL CHAR or VARCHAR output parameter as a Java String object.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getTime
 public Time getTime(int parameterIndex) throws SQLException
Returns the value of an SQL TIME output parameter as a java.sql.Time object using the default calendar.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getTime
 public Time getTime(int parameterIndex,
                     Calendar calendar) throws SQLException
Returns the value of an SQL TIME output parameter as a java.sql.Time object using a calendar other than the default.

Parameters:
parameterIndex - The parameter index (1-based).
calendar - The calendar.
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, the calendar is null, or the requested conversion is not valid.
 o getTimestamp
 public Timestamp getTimestamp(int parameterIndex) throws SQLException
Returns the value of an SQL TIMESTAMP output parameter as a java.sql.Timestamp object using the default calendar.

Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, or the requested conversion is not valid.
 o getTimestamp
 public Timestamp getTimestamp(int parameterIndex,
                               Calendar calendar) throws SQLException
Returns the value of an SQL TIMESTAMP output parameter as a java.sql.Timestamp object using a calendar other than the default.

Parameters:
parameterIndex - The parameter index (1-based).
calendar - The calendar.
Returns:
The parameter value or null if the value is SQL NULL.
Throws: SQLException
If the statement is not open, the index is not valid, the index is not registered as an output parameter, the statement was not executed, the calendar is null, or the requested conversion is not valid.
 o registerOutParameter
 public void registerOutParameter(int parameterIndex,
                                  int sqlType,
                                  int scale) throws SQLException
Registers the type for an output parameter. Before executing the stored procedure call, explicitly register the type of each output parameter. When reading the value of an output parameter, use a get method that corresponds to the registered type. A parameter that is used for both input and output can not be registered with a different type than was used when it was set.

Parameters:
parameterIndex - The parameter index (1-based).
sqlType - The SQL type code defined in java.sql.Types.
scale - The number of digits after the decimal if sqlType is DECIMAL or NUMERIC.
Throws: SQLException
If the index is not valid, the scale is not valid, the parameter is not an output parameter, or the requested conversion is not valid.
 o registerOutParameter
 public void registerOutParameter(int parameterIndex,
                                  int sqlType) throws SQLException
Registers the type for an output parameter. Before executing the stored procedure call, explicitly register the type of each output parameter. When reading the value of an output parameter, use a get method that corresponds to the registered type. A parameter that is used for both input and output can not be registered with a different type than was used when it was set.

Parameters:
parameterIndex - The parameter index (1-based).
sqlType - The SQL type code defined in java.sql.Types.
Throws: SQLException
If the index is not valid, the parameter is not an output parameter, or the requested conversion is not valid.
 o registerOutParameter
 public void registerOutParameter(int parameterIndex,
                                  int sqlType,
                                  String typeName) throws SQLException
Registers the type for an output parameter. Before executing the stored procedure call, explicitly register the type of each output parameter. When reading the value of an output parameter, use a get method that corresponds to the registered type. A parameter that is used for both input and output can not be registered with a different type than was used when it was set.

Parameters:
parameterIndex - The parameter index (1-based).
sqlType - The SQL type code defined in java.sql.Types.
typeName - The fully-qualified name of an SQL structured type. This value will be ignored.
Throws: SQLException
If the index is not valid, the parameter is not an output parameter, or the requested conversion is not valid.
 o wasNull
 public boolean wasNull() throws SQLException
Indicates if the last parameter read has the value of SQL NULL.

Returns:
true if the value is SQL NULL; false otherwise.
Throws: SQLException
If the statement is not open.

All Packages  Class Hierarchy  This Package  Previous  Next  Index