Name
SQLCommandBean
Synopsis
|
Class Name: |
com.ora.jsp.sql.SQLCommandBean |
|
Extends: |
None |
|
Implements: |
None |
Description
The SQLCommandBean class is a bean for executing
SQL statements, and is used by the database custom actions. It can
also be used in a servlet to simplify the database access code. The
bean has three properties that can be set:
connection, sqlValue, and
values. The connection and
sqlValue properties must always be set before
calling one of the execute methods. If the values
property is set, the sqlValue property must be a
SQL statement with question marks as placeholders for the value
objects in the values property. The bean
properties are described in Table 3.24.
Table C-24. com.ora.jsp.SQLCommandBean Properties
|
Property Name |
Java Type |
Access |
Description |
|---|---|---|---|
connection |
java.sql.Connection |
write |
The database |
sqlValue |
String |
write |
The SQL statement to execute, optionally with question marks as placeholders for values. |
values |
java.util.Vector |
write |
A |
The SQLCommandBean class also provides the
following regular methods for executing the SQL statement.
-
public java.util.Vector executeQuery( ) throws java.sql.SQLException, UnsupportedTypeException Returns a
VectorwithRowobjects as the result of executing aSELECTstatement.-
public int executeUpdate( ) throws java.sql.SQLException, UnsupportedTypeException Returns the number of rows affected by a
DELETE,INSERT, orUPDATE
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access