javax.sql.RowSet |
An interface which provides means to access data which persists on a database. It extends the functionality of ResultSet into a form that it can be used as a JavaBean component, suited for a visual programming environment.
RowSet
provides getters and setters for properties relating to the
general database environment together with the getters and setters for
distinct data values which constitute the row set. The RowSet
class
supports JavaBean events so that other components in an application can be
informed when changes happen such as changes in data values.
RowSet
is a facility implemented on top of the remainder of the JDBC
API. It may be connected, maintaining a connection to the database
throughout its lifecycle. The changes made on a disconnected RowSet
on the other hand can be persisted only establishing a new connection
with the database each time.
Disconnected RowSets
make use of RowSetReaders
to populate
the RowSet
with data, possibly from a non-relational database source.
They may also use RowSetWriters
to send data back to the underlying
data store. There is considerable freedom in the way that RowSetReaders
and RowSetWriters
may be implemented to retrieve and
store data.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
java.sql.ResultSet
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers the supplied RowSetListener with this
RowSet . | |||||||||||
Clears the parameters previously set for this
RowSet . | |||||||||||
Fetches data for this
RowSet from the database. | |||||||||||
Gets the
RowSet 's command property. | |||||||||||
Gets the ODBC Data Source Name property associated with this
RowSet . | |||||||||||
Reports if escape processing is enabled for this
RowSet . | |||||||||||
Gets the maximum number of bytes that can be returned for column values
which are of type
BINARY , VARBINARY , LONGVARBINARYBINARY , CHAR , VARCHAR , or LONGVARCHAR . | |||||||||||
Gets the maximum number of rows for this
RowSet . | |||||||||||
Gets the value of the password property for this
RowSet . | |||||||||||
Gets the timeout for the driver when a query operation is executed.
| |||||||||||
Gets the transaction isolation level property set for this
RowSet . | |||||||||||
Gets the custom mapping of SQL User-Defined Types (UDTs) and Java classes
for this
RowSet , if applicable. | |||||||||||
Gets the URL property value for this
RowSet . | |||||||||||
Gets the value of the
username property for this RowSet . | |||||||||||
Indicates if this
RowSet is read-only. | |||||||||||
Removes a specified RowSetListener object from the set of
listeners which will be notified of events by this
RowSet . | |||||||||||
Sets the specified
ARRAY parameter in the RowSet command
with the supplied java.sql.Array value. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the ASCII data in the supplied java.io.InputStream value. | |||||||||||
Sets the value of the specified SQL
NUMERIC parameter in the
RowSet command with the data in the supplied java.math.BigDecimal value. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to the binary data in the supplied input stream. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to the supplied Blob value. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to the supplied boolean. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to the supplied byte value. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to the supplied byte array value. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to the sequence of Unicode characters carried by the supplied java.io.Reader . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the value of a supplied java.sql.Clob . | |||||||||||
Sets the Command property for this
RowSet - the command is an SQL
query which runs when the execute method is invoked. | |||||||||||
Sets the concurrency property of this
RowSet . | |||||||||||
Sets the database name property for the
RowSet . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the value of a supplied java.sql.Date . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the value of a supplied java.sql.Date , where the conversion
of the date to an SQL DATE value is calculated using a supplied
Calendar . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the supplied double . | |||||||||||
Sets the escape processing status for this
RowSet . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the supplied float . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the supplied integer . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
with the supplied long . | |||||||||||
Sets the maximum number of bytes which can be returned for a column value
where the column type is one of
BINARY , VARBINARY ,
LONGVARBINARYBINARY , CHAR , VARCHAR , or LONGVARCHAR . | |||||||||||
Sets the maximum number of rows which can be held by the
RowSet . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to SQL NULL . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to SQL NULL . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied Java object. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied Java object. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied Java object. | |||||||||||
Sets the database Password for this
RowSet . | |||||||||||
Gets the timeout for the driver when a query operation is executed.
| |||||||||||
Sets whether the
RowSet is read-only or updatable. | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied java.sql.Ref . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied short integer . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied String . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied java.sql.Time , converting it to an SQL TIME
value using a supplied Calendar . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied java.sql.Time , converting it to an SQL TIME
value using the system default Calendar . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied java.sql.Timestamp , converting it to an SQL TIMESTAMP value using a supplied Calendar . | |||||||||||
Sets the value of the specified parameter in the
RowSet command
to a supplied java.sql.Timestamp , converting it to an SQL TIMESTAMP value using the system default Calendar . | |||||||||||
Sets the target instance's transaction isolation level to one of a
discrete set of possible values.
| |||||||||||
Sets the type of this
RowSet . | |||||||||||
Sets the mapping of SQL User Defined Types (UDTs) to Java classes.
| |||||||||||
Sets the URL used by this
RowSet to access the database via a
DriverManager . | |||||||||||
Sets the
Username property for the RowSet , used to
authenticate a connection to the database. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface java.sql.ResultSet
|
Registers the supplied RowSetListener with this RowSet
.
Once registered, the RowSetListener is notified of events
generated by the RowSet
.
theListener | an object which implements the rowSetListener
interface. |
---|
Clears the parameters previously set for this RowSet
.
The RowSet
object retains its value until either a new value for
a parameter is set or its value is actively reset. clearParameters
provides a facility to clear the values for all
parameters with one method call.
SQLException | if a problem occurs accessing the database. |
---|
Fetches data for this RowSet
from the database. If successful,
any existing data for the RowSet
is discarded and its metadata is
overwritten.
Data is retrieved connecting to the database and executing an according SQL statement. This requires some or all of the following properties to be set: URL, database name, user name, password, transaction isolation, type map; plus some or all of the properties: command, read only, maximum field size, maximum rows, escape processing, and query timeout.
The RowSet
may use a RowSetReader
to access the database
it will then invoke the readData(RowSetInternal) method on the
reader to fetch the data. When the new data is fetched all the listeners
are notified to take appropriate measures.
SQLException | if a problem occurs accessing the database or if the properties needed to access the database have not been set. |
---|
Gets the RowSet
's command property.
RowSet
's command property. A
command is a SQL statement which is executed to fetch required
data into the RowSet
.Gets the ODBC Data Source Name property associated with this RowSet
. The database name can be used to find a DataSource
which has been registered with a naming service - the DataSource
can then be used to create a connection to the database.
Reports if escape processing is enabled for this RowSet
. If
escape processing is on, the driver performs a substitution of the escape
syntax with the applicable code before sending an SQL command to the
database. The default value for escape processing is true
.
true
if escape processing is enabled, false
otherwise.SQLException | if a problem occurs accessing the database. |
---|
Gets the maximum number of bytes that can be returned for column values
which are of type BINARY
, VARBINARY
, LONGVARBINARYBINARY
, CHAR
, VARCHAR
, or LONGVARCHAR
. Excess data is silently discarded if the number is
exceeded.
SQLException | if a problem occurs accessing the database. |
---|
Gets the maximum number of rows for this RowSet
. Excess rows are
discarded silently if the limit is exceeded.
SQLException | if a problem occurs accessing the database. |
---|
Gets the value of the password property for this RowSet
. This
property is used when a connection to the database is established.
Therefore it should be set prior to invoking the execute() method.
Gets the timeout for the driver when a query operation is executed. If a
query takes longer than the timeout then a SQLException
is
thrown.
SQLException | if an error occurs accessing the database. |
---|
Gets the transaction isolation level property set for this
RowSet
. The transaction isolation level defines the
policy implemented on the database for maintaining the data
values consistent.
Connection.TRANSACTION_READ_UNCOMMITTED
Connection.TRANSACTION_READ_COMMITTED
Connection.TRANSACTION_REPEATABLE_READ
Connection.TRANSACTION_SERIALIZABLE
Gets the custom mapping of SQL User-Defined Types (UDTs) and Java classes
for this RowSet
, if applicable.
SQLException | if an error occurs accessing the database. |
---|
Gets the URL property value for this RowSet
. If there is no
DataSource
object specified, the RowSet
uses the URL to
establish a connection to the database. The default value for the URL is
null
.
SQLException | if an error occurs accessing the database. |
---|
Gets the value of the username
property for this RowSet
.
The username
is used when establishing a connection to the
database and should be set before the execute
method is invoked.
String
holding the value of the username
property.Indicates if this RowSet
is read-only.
true
if this RowSet
is read-only, false
if it is updatable.Removes a specified RowSetListener object from the set of
listeners which will be notified of events by this RowSet
.
theListener | the RowSetListener to remove from the set of listeners
for this RowSet . |
---|
Sets the specified ARRAY
parameter in the RowSet
command
with the supplied java.sql.Array
value.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theArray | the Array data value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the ASCII data in the supplied java.io.InputStream
value.
Data is read from the InputStream
until end-of-file is reached.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theInputStream | the ASCII data value to which the parameter is set. |
length | the length of the data in bytes. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified SQL NUMERIC
parameter in the
RowSet
command with the data in the supplied java.math.BigDecimal
value.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theBigDecimal | the big decimal value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to the binary data in the supplied input stream. Data is read from the
input stream until end-of-file is reached.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theInputStream | the binary data stream to which the parameter is set. |
length | the length of the data in bytes. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to the supplied Blob
value.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theBlob | the Blob value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to the supplied boolean.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theBoolean | the boolean value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to the supplied byte value.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theByte | the byte value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to the supplied byte array value.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theByteArray | the Array of bytes to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to the sequence of Unicode characters carried by the supplied java.io.Reader
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theReader | the Reader which contains the Unicode data to set the
parameter. |
length | the length of the data in the Reader in characters. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the value of a supplied java.sql.Clob
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theClob | the Clob value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the Command property for this RowSet
- the command is an SQL
query which runs when the execute
method is invoked. This
property is optional for databases that do not support commands.
cmd | the SQL query. Can be null . |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the concurrency property of this RowSet
. The default value
is ResultSet.CONCUR_READ_ONLY
.
concurrency | the concurrency value. One of:
|
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the database name property for the RowSet
.
The database name can be used to find a DataSource which has been registered with a naming service - the DataSource can then be used to create a connection to the database.
name | the database name. |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the value of a supplied java.sql.Date
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theDate | the date value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the value of a supplied java.sql.Date
, where the conversion
of the date to an SQL DATE
value is calculated using a supplied
Calendar
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theDate | the date to which the parameter is set. |
theCalendar | the Calendar to use in converting the Date to an SQL
DATE value. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the supplied double
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theDouble | the double value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the escape processing status for this RowSet
. If escape
processing is on, the driver performs a substitution of the escape syntax
with the applicable code before sending an SQL command to the database.
The default value for escape processing is true
.
enable | true to enable escape processing, false to
turn it off. |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the supplied float
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theFloat | the float value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the supplied integer
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theInteger | the integer value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
with the supplied long
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theLong | the long value value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the maximum number of bytes which can be returned for a column value
where the column type is one of BINARY
, VARBINARY
,
LONGVARBINARYBINARY
, CHAR
, VARCHAR
, or LONGVARCHAR
. Data which exceeds this limit is silently discarded. For
portability, a value greater than 256 is recommended.
max | the maximum size of the returned column value in bytes. 0 implies no size limit. |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the maximum number of rows which can be held by the RowSet
.
Any additional rows are silently discarded.
max | the maximum number of rows which can be held in the RowSet . 0 means no limit. |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to SQL NULL
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
sqlType | the type of the parameter, as defined by java.sql.Types . |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to SQL NULL
. This form of the setNull
method should be
used for User Defined Types and REF
parameters.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
sqlType | the type of the parameter, as defined by java.sql.Types . |
typeName | the fully qualified name of an SQL user defined type or the
name of the SQL structured type referenced by a REF
type. Ignored if the sqlType is not a UDT or REF type. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied Java object.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theObject | the Java object containing the data value. |
targetSqlType | the SQL type to send to the database, as defined in java.sql.Types . |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied Java object.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theObject | the Java object containing the data value. |
targetSqlType | the SQL type to send to the database, as defined in java.sql.Types . |
scale | the number of digits after the decimal point, for java.sql.Types.DECIMAL and java.sql.Types.NUMERIC
types. Ignored for all other types. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied Java object.
The JDBC specification provides a standard mapping for Java objects to SQL data types. Database specific types can be mapped by JDBC driver specific Java types.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theObject | the Java object containing the data value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the database Password for this RowSet
. This property is used
when a connection to the database is established. Therefore it should be
set prior to invoking the execute() method.
password | a String holding the password. |
---|
SQLException | if an error occurs accessing the database. |
---|
Gets the timeout for the driver when a query operation is executed. If a
query takes longer than the timeout, a SQLException
is thrown.
seconds | the number of seconds for the timeout. |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets whether the RowSet
is read-only or updatable.
readOnly | true to set the RowSet to read-only state,
false to allow updates. |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied java.sql.Ref
. This is sent to the database as an
SQL REF
value.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theRef | the value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied short integer
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theShort | the value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied String
. The string is placed into the database as a
VARCHAR
or LONGVARCHAR
SQL value, depending on the
database limits for the length of VARCHAR
values.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theString | the value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied java.sql.Time
, converting it to an SQL TIME
value using a supplied Calendar
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theTime | the value to which the parameter is set. |
theCalendar | the Calendar to use in the conversion operation. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied java.sql.Time
, converting it to an SQL TIME
value using the system default Calendar
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theTime | the value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied java.sql.Timestamp
, converting it to an SQL TIMESTAMP
value using a supplied Calendar
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theTimestamp | the value to which the parameter is set. |
theCalendar | the Calendar to use in the conversion operation |
SQLException | if an error occurs accessing the database. |
---|
Sets the value of the specified parameter in the RowSet
command
to a supplied java.sql.Timestamp
, converting it to an SQL TIMESTAMP
value using the system default Calendar
.
parameterIndex | the index of the parameter to set; the first parameter's index is 1. |
---|---|
theTimestamp | the value to which the parameter is set. |
SQLException | if an error occurs accessing the database. |
---|
Sets the target instance's transaction isolation level to one of a discrete set of possible values. The transaction isolation level defines the policy implemented on the database for maintaining the data values consistent.
Keep in mind that setting a transaction isolation level has no effect unless your driver and DBMS support it.
level | the transaction isolation level. One of:
|
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the type of this RowSet
. By default, the type is
non-scrollable.
type | the type for the RowSet . One of:
|
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the mapping of SQL User Defined Types (UDTs) to Java classes. The Java classes must all implement the SQLData interface.
theTypeMap | the names of SQL UDTs and the Java classes to which they are mapped. |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the URL used by this RowSet
to access the database via a
DriverManager
. The URL is optional - an alternative is to use a
database name to create a connection.
theURL | the URL for the database. Can be null . |
---|
SQLException | if an error occurs accessing the database. |
---|
Sets the Username
property for the RowSet
, used to
authenticate a connection to the database.
theUsername | the new user name for this row set. |
---|
SQLException | if an error occurs accessing the database. |
---|