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 executes a stored procedure. Use AS400JDBCConnection.prepareCall() to create new AS400JDBCCallableStatement 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.

Some of the get methods convert parameter values from different types than are described in the JDBC specification. This is because some SQL types are not supported by DB2 for OS/400. See Unsupported SQL Types for a complete list.

See Also:
AS400JDBCResultSet

Method Index

 o clearParameters()
Releases the resources used by the current input parameter values and registered output parameters.
 o getBigDecimal(int, int)
Returns the value of a SQL NUMERIC or DECIMAL output parameter as a BigDecimal object.
 o getBoolean(int)
Returns the value of a SQL SMALLINT output parameter as a Java boolean.
 o getByte(int)
Returns the value of a SQL SMALLINT output parameter as a Java byte.
 o getBytes(int)
Returns the value of a SQL BINARY or VARBINARY output parameter as a Java byte array.
 o getDate(int)
Returns the value of a SQL DATE output parameter as a java.sql.Date object.
 o getDouble(int)
Returns the value of a SQL DOUBLE or FLOAT output parameter as a Java double.
 o getFloat(int)
Returns the value of a SQL REAL or FLOAT output parameter as a Java float.
 o getInt(int)
Returns the value of a SQL INTEGER output parameter as a Java int.
 o getLong(int)
Returns the value of a SQL INTEGER output parameter as a Java long.
 o getObject(int)
Returns the value of an output parameter as a Java Object.
 o getShort(int)
Returns the value of a SQL SMALLINT output parameter as a Java short value.
 o getString(int)
Returns the value of a SQL CHAR or VARCHAR output parameter as a Java String object.
 o getTime(int)
Returns the value of a SQL TIME output parameter as a java.sql.Time object.
 o getTimestamp(int)
Returns the value of a SQL TIMESTAMP output parameter as a java.sql.Timestamp object.
 o registerOutParameter(int, int)
Registers the type for an output parameter.
 o registerOutParameter(int, int, int)
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 getBigDecimal
 public BigDecimal getBigDecimal(int index,
                                 int scale) throws SQLException
Returns the value of a SQL NUMERIC or DECIMAL output parameter as a BigDecimal object.

Parameters:
index - The parameter index (1-based).
scale - The number of digits after the decimal.
Returns:
The 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.
 o getBoolean
 public boolean getBoolean(int index) throws SQLException
Returns the value of a SQL SMALLINT output parameter as a Java boolean.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL SMALLINT output parameter as a Java byte.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL BINARY or VARBINARY output parameter as a Java byte array.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL DATE output parameter as a java.sql.Date object.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 getDouble
 public double getDouble(int index) throws SQLException
Returns the value of a SQL DOUBLE or FLOAT output parameter as a Java double.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL REAL or FLOAT output parameter as a Java float.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL INTEGER output parameter as a Java int.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL INTEGER output parameter as a Java long.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) 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().

Parameters:
index - The parameter index (1-based).
Returns:
The 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 getShort
 public short getShort(int index) throws SQLException
Returns the value of a SQL SMALLINT output parameter as a Java short value.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL CHAR or VARCHAR output parameter as a Java String object.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL TIME output parameter as a java.sql.Time object.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 index) throws SQLException
Returns the value of a SQL TIMESTAMP output parameter as a java.sql.Timestamp object.

Parameters:
index - The parameter index (1-based).
Returns:
The 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 registerOutParameter
 public void registerOutParameter(int index,
                                  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:
index - 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 index,
                                  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:
index - 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 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