Escolar Documentos
Profissional Documentos
Cultura Documentos
PreparedStatement
An object that represents a precompiled SQL statement.
A SQL statement is precompiled and stored in a PreparedStatement object.
This object can then be used to efficiently execute this statement multiple
times.
Note: The setter methods (setShort, setString, and so on) for setting IN
parameter values must specify types that are compatible with the defined
SQL type of the input parameter. For instance, if the IN parameter has SQL
type INTEGER, then the method setInt should be used.
If arbitrary parameter type conversions are required, the
method setObject should be used with a target SQL type.
In the following example of setting a parameter, con represents an active
connection:
PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
SET SALARY = ? WHERE ID = ?");
pstmt.setBigDecimal(1, 153833.00)
pstmt.setInt(2, 110592)
CallableStatement
The interface used to execute SQL stored procedures.
The JDBC API provides a stored procedure SQL escape syntax that allows
stored procedures to be called in a standard way for all RDBMSs.
This escape syntax has one form that includes a result parameter and one
that does not. If used, the result parameter must be registered as an OUT
parameter. The other parameters can be used for input, output or both.
Parameters are referred to sequentially, by number, with the first
parameter being 1.
{?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
{call <procedure-name>[(<arg1>,<arg2>, ...)]}
IN parameter values are set using the set methods inherited from
PreparedStatement. The type of all OUT parameters must be registered
prior to executing the stored procedure; their values are retrieved after
execution via the get methods provided here.
A CallableStatement can return one ResultSet object or multiple ResultSet
objects. Multiple ResultSet objects are handled using operations inherited
from Statement.
RowSet
A JDBC RowSet object holds tabular data in a way that makes it more
flexible and easier to use than a result set.
A RowSet object is considered either connected or disconnected.
A connected RowSet object uses a JDBC driver to make a connection to a
relational database and maintains that connection throughout its life span.
A disconnected RowSet object makes a connection to a data source only to
read in data from a ResultSet object or to write data back to the data
source. After reading data from or writing data to its data source,
the RowSet object disconnects from it, thus becoming "disconnected."
CachedRowSet: