|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The RowSet interface adds support to the JDBC API for the JavaBeans(TM) component model. A rowset can be used as a JavaBean in a visual Bean development environment. A RowSet can be created and configured at design time and executed at runtime. The RowSet interface provides a set of JavaBeans properties that allow a RowSet instance to be configured to connect to a JDBC data source and read some data from the data source. A group of setXXX() methods provide a way to pass input parameters to a rowset. The RowSet interface supports JavaBeans events, allowing other components in an application to be notified when an important event on a rowset occurs, such as a change in its value.
The RowSet interface is unique in that it is intended to be implemented using the rest of the JDBC(TM) API. In other words, a RowSet implementation is a layer of software that executes "on top" of a JDBC driver. Implementations of the RowSet interface can be provided by anyone, including JDBC driver vendors who want to provide a RowSet implementation as part of their JDBC products.
Rowsets are easy to use. The RowSet interface extends the standard java.sql.ResultSet interface. The RowSetMetaData interface extends the java.sql.ResultSetMetaData interface. Thus, developers familiar with the JDBC API will have to learn a minimal number of new APIs to use rowsets. In addition, third-party software tools that work with JDBC ResultSets will also easily be made to work with rowsets.
Field Summary |
Fields inherited from interface java.sql.ResultSet |
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE |
Method Summary | |
void |
addRowSetListener(RowSetListener rowSetListener)
RowSet listener registration. |
void |
clearParameters()
In general, parameter values remain in force for repeated use of a RowSet. |
void |
execute()
Fills the rowset with data. |
String |
getCommand()
Get the rowset's command property. |
String |
getDataSourceName()
The JNDI name that identifies a JDBC data source. |
boolean |
getEscapeProcessing()
If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. |
int |
getMaxFieldSize()
The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. |
int |
getMaxRows()
The maxRows limit is the maximum number of rows that a RowSet can contain. |
String |
getPassword()
The password used to create a database connection. |
int |
getQueryTimeout()
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. |
int |
getTransactionIsolation()
The transaction isolation property contains the JDBC transaction isolation level used. |
Map |
getTypeMap()
Get the type-map object associated with this rowset. |
String |
getUrl()
Get the url used to create a JDBC connection. |
String |
getUsername()
The username used to create a database connection. |
boolean |
isReadOnly()
A rowset may be read-only. |
void |
removeRowSetListener(RowSetListener rowSetListener)
RowSet listener deregistration. |
void |
setArray(int i,
Array array)
Set an Array parameter. |
void |
setAsciiStream(int i,
InputStream inputStream,
int j)
When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. |
void |
setBigDecimal(int i,
BigDecimal bigDecimal)
Set a parameter to a java.lang.BigDecimal value. |
void |
setBinaryStream(int i,
InputStream inputStream,
int j)
When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream. |
void |
setBlob(int i,
Blob blob)
Set a BLOB parameter. |
void |
setBoolean(int i,
boolean flag)
Set a parameter to a Java boolean value. |
void |
setByte(int i,
byte b)
Set a parameter to a Java byte value. |
void |
setBytes(int i,
byte[] ab)
Set a parameter to a Java array of bytes. |
void |
setCharacterStream(int i,
Reader reader,
int j)
When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. |
void |
setClob(int i,
Clob clob)
Set a CLOB parameter. |
void |
setCommand(String string)
Set the rowset's command property. |
void |
setConcurrency(int i)
Set the rowset concurrency. |
void |
setDataSourceName(String string)
Set the data source name. |
void |
setDate(int i,
Date date)
Set a parameter to a java.sql.Date value. |
void |
setDate(int i,
Date date,
Calendar calendar)
Set a parameter to a java.sql.Date value. |
void |
setDouble(int i,
double d)
Set a parameter to a Java double value. |
void |
setEscapeProcessing(boolean flag)
If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. |
void |
setFloat(int i,
float f)
Set a parameter to a Java float value. |
void |
setInt(int i,
int j)
Set a parameter to a Java int value. |
void |
setLong(int i,
long j)
Set a parameter to a Java long value. |
void |
setMaxFieldSize(int i)
The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. |
void |
setMaxRows(int i)
The maxRows limit is set to limit the number of rows that any RowSet can contain. |
void |
setNull(int parameterIndex,
int sqlType)
Set a parameter to SQL NULL. |
void |
setNull(int paramIndex,
int sqlType,
String typeName)
JDBC 2.0 Set a parameter to SQL NULL. |
void |
setObject(int parameterIndex,
Object object)
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values. |
void |
setObject(int parameterIndex,
Object object,
int targetSqlType)
This method is like setObject above, but the scale used is the scale of the second parameter. |
void |
setObject(int parameterIndex,
Object object,
int j,
int scale)
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values. |
void |
setPassword(String string)
Set the password. |
void |
setQueryTimeout(int seconds)
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. |
void |
setReadOnly(boolean flag)
Set the read-onlyness of the rowset |
void |
setRef(int i,
Ref ref)
Set a REF(<structured-type>) parameter. |
void |
setShort(int i,
short s)
Set a parameter to a Java short value. |
void |
setString(int parameterIndex,
String string)
Set a parameter to a Java String value. |
void |
setTime(int parameterIndex,
Time time)
Set a parameter to a java.sql.Time value. |
void |
setTime(int parameterIndex,
Time time,
Calendar calendar)
Set a parameter to a java.sql.Time value. |
void |
setTimestamp(int parameterIndex,
Timestamp timestamp)
Set a parameter to a java.sql.Timestamp value. |
void |
setTimestamp(int parameterIndex,
Timestamp timestamp,
Calendar calendar)
Set a parameter to a java.sql.Timestamp value. |
void |
setTransactionIsolation(int level)
Set the transaction isolation. |
void |
setType(int i)
Set the rowset type. |
void |
setTypeMap(Map map)
Install a type-map object as the default type-map for this rowset. |
void |
setUrl(String url)
Set the url used to create a connection. |
void |
setUsername(String name)
Set the user name. |
Method Detail |
public void addRowSetListener(RowSetListener rowSetListener)
rowSetListener
- - an event listenerpublic void clearParameters() throws SQLException
SQLException
- - if a database-access error occurs.public void execute() throws SQLException
SQLException
- - if a database-access error occurs.public String getCommand()
public String getDataSourceName()
public boolean getEscapeProcessing() throws SQLException
SQLException
- - if a database-access error occurs.public int getMaxFieldSize() throws SQLException
SQLException
- - if a database-access error occurs.public int getMaxRows() throws SQLException
SQLException
- - if a database-access error occurs.public String getPassword()
public int getQueryTimeout() throws SQLException
SQLException
- - if a database-access error occurs.public int getTransactionIsolation()
public Map getTypeMap() throws SQLException
SQLException
- - if a database-access error occurs.public String getUrl() throws SQLException
SQLException
- - if a database-access error occurs.public String getUsername()
public boolean isReadOnly()
public void removeRowSetListener(RowSetListener rowSetListener)
rowSetListener
- - an event listenerpublic void setArray(int i, Array array) throws SQLException
i
- - the first parameter is 1, the second is 2, ...array
- - an object representing an SQL array
SQLException
- - if a database-access error occurs.public void setAsciiStream(int i, InputStream inputStream, int j) throws SQLException
When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
i
- - the first parameter is 1, the second is 2, ...inputStream
- - the java input stream which contains the ASCII parameter valuej
- - the number of bytes in the stream
SQLException
- - if a database-access error occurs.public void setBigDecimal(int i, BigDecimal bigDecimal) throws SQLException
i
- - the first parameter is 1, the second is 2, ...bigDecimal
- - the parameter value
SQLException
- - if a database-access error occurs.public void setBinaryStream(int i, InputStream inputStream, int j) throws SQLException
When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
i
- - the first parameter is 1, the second is 2, ...inputStream
- - the java input stream which contains the binary parameter valuej
- - the number of bytes in the stream
SQLException
- - if a database-access error occurs.public void setBlob(int i, Blob blob) throws SQLException
i
- - the first parameter is 1, the second is 2, ...blob
- - an object representing a BLOB
SQLException
- - if a database-access error occurs.public void setBoolean(int i, boolean flag) throws SQLException
i
- - the first parameter is 1, the second is 2, ...flag
- - the parameter value
SQLException
- - if a database-access error occurs.public void setByte(int i, byte b) throws SQLException
i
- - the first parameter is 1, the second is 2, ...b
- - the parameter value
SQLException
- - if a database-access error occurs.public void setBytes(int i, byte[] ab) throws SQLException
i
- - the first parameter is 1, the second is 2, ...ab
- - the parameter value
SQLException
- - if a database-access error occurs.public void setCharacterStream(int i, Reader reader, int j) throws SQLException
When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. JDBC will read the data from the stream as needed, until it reaches end-of-file.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
i
- - the first parameter is 1, the second is 2, ...reader
- - the java reader which contains the UNICODE dataj
- - the number of characters in the stream
SQLException
- - if a database-access error occurs.public void setClob(int i, Clob clob) throws SQLException
i
- - the first parameter is 1, the second is 2, ...clob
- - an object representing a CLOB
SQLException
- - if a database-access error occurs.public void setCommand(String string) throws SQLException
string
- - a command string, may be null
SQLException
- - if a database-access error occurs.public void setConcurrency(int i) throws SQLException
i
- - a value from ResultSet.CONCUR_XXX
SQLException
- - if a database-access error occurs.public void setDataSourceName(String string) throws SQLException
string
- - a data source name
SQLException
- - if a database-access error occurs.public void setDate(int i, Date date) throws SQLException
i
- - the first parameter is 1, the second is 2, ...date
- - the parameter value
SQLException
- - if a database-access error occurs.public void setDate(int i, Date date, Calendar calendar) throws SQLException
i
- - the first parameter is 1, the second is 2, ...date
- - the parameter valuecalendar
- - the calendar used
SQLException
- - if a database-access error occurs.public void setDouble(int i, double d) throws SQLException
i
- - the first parameter is 1, the second is 2, ...d
- - the parameter value
SQLException
- - if a database-access error occurs.public void setEscapeProcessing(boolean flag) throws SQLException
flag
- - true to enable; false to disable
SQLException
- - if a database-access error occurs.public void setFloat(int i, float f) throws SQLException
i
- - the first parameter is 1, the second is 2, ...f
- - the parameter value
SQLException
- - if a database-access error occurs.public void setInt(int i, int j) throws SQLException
i
- - the first parameter is 1, the second is 2, ...j
- - the parameter value
SQLException
- - if a database-access error occurs.public void setLong(int i, long j) throws SQLException
i
- - the first parameter is 1, the second is 2, ...j
- - the parameter value
SQLException
- - if a database-access error occurs.public void setMaxFieldSize(int i) throws SQLException
i
- - the new max column size limit; zero means unlimited
SQLException
- - if a database-access error occurs.public void setMaxRows(int i) throws SQLException
i
- - the new max rows limit; zero means unlimited
SQLException
- - if a database-access error occurs.public void setNull(int parameterIndex, int sqlType) throws SQLException
Set a parameter to SQL NULL.
Note: You must specify the parameter's SQL type.
parameterIndex
- - the first parameter is 1, the second is 2, ...sqlType
- - SQL type code defined by java.sql.Types
SQLException
- - if a database-access error occurs.public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException
JDBC 2.0 Set a parameter to SQL NULL. This version of setNull should be used for user-named types and REF type parameters. Examples of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and named array types.
Note: To be portable, applications must give the SQL type code and the fully qualified SQL type name when specifying a NULL user-named or REF parameter. In the case of a user-named type the name is the type name of the parameter itself. For a REF parameter the name is the type name of the referenced type. If a JDBC driver does not need the type code or type name information, it may ignore it. Although it is intended for user-named and Ref parameters, this method may be used to set a null parameter of any JDBC type. If the parameter does not have a user-named or REF type then the typeName is ignored.
paramIndex
- - the first parameter is 1, the second is 2, ...sqlType
- - a value from java.sql.TypestypeName
- - the fully qualified name of a SQL user-named type, ignored if the parameter is not a user-named type or REF
SQLException
- - if a database-access error occurs.public void setObject(int parameterIndex, Object object) throws SQLException
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.
The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.
Note that this method may be used to pass datatabase specific abstract data types, by using a Driver specific Java type. If the object is of a class implementing SQLData, the rowset should call its method writeSQL() to write it to the SQL data stream. else If the object is of a class implementing Ref, Blob, Clob, Struct, or Array then pass it to the database as a value of the corresponding SQL type. Raise an exception if there is an ambiguity, for example, if the object is of a class implementing more than one of those interfaces.
parameterIndex
- - The first parameter is 1, the second is 2, ...object
- - The object containing the input parameter value
SQLException
- - if a database-access error occurs.public void setObject(int parameterIndex, Object object, int targetSqlType) throws SQLException
parameterIndex
- - The first parameter is 1, the second is 2, ...object
- - The object containing the input parameter valuetargetSqlType
- - The SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may
further qualify this type.
SQLException
- - if a database-access error occurs.public void setObject(int parameterIndex, Object object, int j, int scale) throws SQLException
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.
The given Java object will be converted to the targetSqlType before being sent to the database. If the object is of a class implementing SQLData, the rowset should call its method writeSQL() to write it to the SQL data stream. else If the object is of a class implementing Ref, Blob, Clob, Struct, or Array then 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.
parameterIndex
- - The first parameter is 1, the second is 2, ...object
- - The object containing the input parameter valuej
- - 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.
For all other types this value will be ignored
SQLException
- - if a database-access error occurs.public void setPassword(String string) throws SQLException
string
- - the password string
SQLException
- - if a database-access error occurs.public void setQueryTimeout(int seconds) throws SQLException
seconds
- - the new query timeout limit in seconds; zero means unlimited
SQLException
- - if a database-access error occurs.public void setReadOnly(boolean flag) throws SQLException
flag
- - true if read-only, false otherwise
SQLException
- - if a database-access error occurs.public void setRef(int i, Ref ref) throws SQLException
i
- - the first parameter is 1, the second is 2, ...ref
- - an object representing data of an SQL REF Type
SQLException
- - if a database-access error occurs.public void setShort(int i, short s) throws SQLException
i
- - the first parameter is 1, the second is 2, ...s
- - the parameter value
SQLException
- - if a database-access error occurs.public void setString(int parameterIndex, String string) throws SQLException
parameterIndex
- - the first parameter is 1, the second is 2, ...string
- - the parameter value
SQLException
- - if a database-access error occurs.public void setTime(int parameterIndex, Time time) throws SQLException
parameterIndex
- - the first parameter is 1, the second is 2, ...time
- - the parameter value
SQLException
- - if a database-access error occurs.public void setTime(int parameterIndex, Time time, Calendar calendar) throws SQLException
parameterIndex
- - the first parameter is 1, the second is 2, ...time
- - the parameter valuecalendar
- - the calendar used
SQLException
- - if a database-access error occurs.public void setTimestamp(int parameterIndex, Timestamp timestamp) throws SQLException
parameterIndex
- - the first parameter is 1, the second is 2, ...timestamp
- - the parameter value
SQLException
- - if a database-access error occurs.public void setTimestamp(int parameterIndex, Timestamp timestamp, Calendar calendar) throws SQLException
parameterIndex
- - the first parameter is 1, the second is 2, ...timestamp
- - the parameter valuecalendar
- - the calendar used
SQLException
- - if a database-access error occurs.public void setTransactionIsolation(int level) throws SQLException
level
- - the transaction isolation level
SQLException
- - if a database-access error occurs.public void setType(int i) throws SQLException
i
- - a value from ResultSet.TYPE_XXX
SQLException
- - if a database-access error occurs.public void setTypeMap(Map map) throws SQLException
map
- - a map object
SQLException
- - if a database-access error occurs.public void setUrl(String url) throws SQLException
url
- - a string value, may be null
SQLException
- - if a database-access error occurs.public void setUsername(String name) throws SQLException
name
- - a user name
SQLException
- - if a database-access error occurs.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |