public interface RowSet extends java.sql.ResultSet
A RowSet can be created and configured at design time in a JavaBeans visual development environment 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. In addition to that, the RowSet interface extends the ResultSet interface, which provides methods necessary to handle query results represented by a RowSet. Changes made to the rows of a RowSet object can be saved to the database.
addRowSetListener
public void addRowSetListener(RowSetListener listener)
This registers a rowset listener object that is being notified of events occurring on the rowset.
Parameters:
listener: | The event listener |
clearParameters
public void clearParameters() throws java.sql.SQLException
This method can be used to free the resources used by the parameter values set for the current rowset. Such values are freed when new parameter values are provided, but in some cases it may be useful to free them all by using this method.
A SQLException is thrown if a database access error occurs.
execute
public void execute() throws java.sql.SQLException
This method executes the command for the rowset and fills it with the result data. A connection can be established for this command to execute: You can use either the connection URL or data source. The database username and password must be set prior to calling execute(). Other properties such as the transaction isolation level, a type map, being read-only, the maximum field size, the maximum rows, the command time-out, and escape processing can be set as well.
A SQLException is thrown if a database access error occurs or when a mandatory parameter is missing.
getCommand
public String getCommand()
This gets the command associated to the rowset. It is a SQL command when the data source is a database. This command will be executed to fill the rowset with data coming from the data source. The default value for the command is null.
Returns: The command string
getDataSourceName
public String getDataSourceName()
This returns the JNDI name for the data source used by the rowset.
Returns: The data source name
getEscapeProcessing
public boolean getEscapeProcessing() throws java.sql.SQLException
Escape processing happens before the SQL statement is sent to the database. This method returns the current setting for escape processing. A SQLException is thrown if a database access error occurs.
Returns: true if enabled or false if disabled
getMaxFieldSize
public int getMaxFieldSize() throws java.sql.SQLException
This returns the maximum number of bytes returned for any column value of the following types:
Types.BINARY
Types.VARBINARY
Types.LONGVARBINARY
Types.CHAR
Types.VARCHAR
Types.LONGVARCHAR
A SQLException is thrown if a database access error occurs.
Returns: The maximum column size limit for this rowset. Zero means unlimited.
getMaxRows
public int getMaxRows() throws java.sql.SQLException
This returns the maximum number of rows that the rowset can contain. A SQLException is thrown if a database access error occurs.
Returns: The current maximum row limit. Zero means unlimited.
getPassword
public String getPassword()
This gets the password for the database user used by the rowset when connecting to the database.
Returns: The user password
getQueryTimeout
public int getQueryTimeout() throws java.sql.SQLException
This returns the number of seconds the driver will wait for a Statement to execute. A SQLException is thrown if a database access error occurs.
Returns: The limit in seconds. A value of zero means unlimited.
getTransactionIsolation
public int getTransactionIsolation()
This gets the transaction isolation level used by the rowset. The possible values are defined in java.sql.Connection.
Returns: The transaction isolation level, which can be any of the following:
Connection.TRANSACTION_NONE: Indicates that transactions aren’t supported at all.
Connection.TRANSACTION_READ_COMMITTED: Dirty reads are prevented, but non-repeatable reads and phantom reads can occur.
Connection.TRANSACTION_READ_UNCOMMITTED: Dirty reads, non-repeatable reads, and phantom reads can occur.
Connection.TRANSACTION_REPEATABLE_READ: Dirty reads and non-repeatable reads are prevented, but phantom reads can occur.
Connection.TRANSACTION_SERIALIZABLE: Dirty reads, non-repeatable reads, and phantom reads are prevented.
getTypeMap
public java.util.Map getTypeMap() throws java.sql.SQLException
This gets the type-map object associated with the rowset or an empty map if the type map wasn’t set earlier. A SQLException is thrown if a database access error occurs.
Returns: The type map for the rowset
getUrl
public String getUrl() throws java.sql.SQLException
This returns the URL used to create the JDBC connection. A SQLException is thrown if a database access error occurs.
Returns: The URL as a string
getUsername
public String getUsername()
This gets the username (database login) for the connection used by the rowset.
Returns: The username
isReadOnly
public boolean isReadOnly()
This verifies whether a rowset is read-only. The default for a rowset isn’t read-only, when the data source allows it.
Returns: true if updatable, false otherwise
removeRowSetListener
public void removeRowSetListener(RowSetListener listener)
This removes the rowset listener object from the registered listeners for the rowset.
Parameters:
listener: The event listener
setArray
public void setArray(int i, java.sql.Array x) throws java.sql.SQLException
This sets an Array parameter. A SQLException is thrown if a database access error occurs.
Parameters:
i: | The parameter index, starting at 1 |
x: | An object representing a SQL array |
setAsciiStream
public void setAsciiStream( int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException
This reads the ASCII value from an input stream and inputs it to a LONGVARCHAR parameter. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The Java input stream that contains the ASCII parameter value |
length: | The number of bytes to be read from the stream |
setBigDecimal
public void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws java.sql.SQLException
This sets a parameter to a BigDecimal value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setBinaryStream
public void setBinaryStream( int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException
This reads a binary value from an input stream and inputs it to a LONGVARBINARY parameter. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The java input stream that contains the binary parameter value |
length: | The number of bytes to be read from the stream |
setBlob
public void setBlob(int i, java.sql.Blob x) throws java.sql.SQLException
This sets a BLOB parameter. A SQLException is thrown if a database access error occurs.
Parameters:
i: | The parameter index, starting at 1 |
x: | An object representing a BLOB |
setBoolean
public void setBoolean(int parameterIndex, boolean x) throws java.sql.SQLException
This sets a parameter to a Java boolean value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setByte
public void setByte(int parameterIndex, byte x) throws java.sql.SQLException
This sets a parameter to a Java byte value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setBytes
public void setBytes(int parameterIndex, byte[] x) throws java.sql.SQLException
This sets a parameter to a Java array of bytes. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setCharacterStream
public void setCharacterStream( int parameterIndex, java.io.Reader reader, int length) throws java.sql.SQL Exception
This reads a Unicode value from an input stream and inputs it to a LONGVARCHAR parameter. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The Java reader that contains the Unicode data |
length: | The number of characters in the stream |
setClob
public void setClob(int i, java.sql.Clob x) throws java.sql.SQLException
This sets a CLOB parameter. A SQLException is thrown if a database access error occurs.
Parameters:
i: | The parameter index, starting at 1 |
x: | An object representing a CLOB |
setCommand
public void setCommand(String cmd) throws java.sql.SQLException
This sets the SQL command associated to the rowset when the data source is a database or another type of command when the data source isn’t a database. This command will be executed to fill the rowset with data coming from the data source. The default value for the command is null. A SQLException is thrown if a database access error occurs.
Parameters:
cmd: | A command string |
setConcurrency
public void setConcurrency(int concurrency) throws java.sql.SQLException
This sets the rowset concurrency level for the rowset. A SQLException is thrown if a database access error occurs.
Parameters:
concurrency: | The concurrency level as defined in ResultSet with one of the following attributes:
|
setDataSourceName
public void setDataSourceName(String name) throws java.sql.SQLException
This sets the data source name for the rowset. Note that either a data source name or a JDBC URL can be provided to the rowset. A SQLException is thrown if a database access error occurs.
Parameters:
name: | The name of the data source |
setDate
public void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLException
This sets a parameter to a java.sql.Date value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setDate
public void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal) throws java.sql.SQLException
This sets a parameter to a java.sql.Date value that will be converted to a SQL DATE value when it is sent to the database. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
cal: | The calendar value |
setDouble
public void setDouble(int parameterIndex, double x) throws java.sql.SQLException
This sets a parameter to a Java double value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws java.sql.SQLException
This enables or disables escape processing by the JDBC driver before sending each SQL statement to the database. A SQLException is thrown if a database access error occurs.
Parameters:
enable: Set to true to enable or false to disable
setFloat
public void setFloat(int parameterIndex, float x) throws java.sql.SQLException
This sets a SQL Float parameter to a Java float value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setInt
public void setInt(int parameterIndex, int x) throws java.sql.SQLException
This sets a parameter to a Java int value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setLong
public void setLong(int parameterIndex, long x) throws java.sql.SQLException
This sets a parameter to a Java long value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setMaxFieldSize
public void setMaxFieldSize(int max) throws java.sql.SQLException
This sets the maximum number of bytes returned for any column value of the following types:
Types.BINARY
Types.VARBINARY
Types.LONGVARBINARY
Types.CHAR
Types.VARCHAR
Types.LONGVARCHAR
A SQLException is thrown if a database access error occurs.
Parameters:
max: | The maximum column size limit for this rowset. Zero means unlimited. |
setMaxRows
public void setMaxRows(int max) throws java.sql.SQLException
This sets the maximum number of rows that the rowset can contain. A SQLException is thrown if a database access error occurs.
Parameters:
max: | The maximum rows limit. Zero means unlimited. |
setNull
public void setNull(int parameterIndex, int sqlType) throws java.sql.SQLException
This sets a parameter to SQL NULL. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
sqlType: | The SQL type code defined by java.sql.Types |
setNull
public void setNull(int paramIndex, int sqlType, String typeName) throws java.sql.SQLException
This sets a parameter to SQL NULL. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
sqlType: | The SQL type code defined by java.sql.Types |
typeName: | The fully qualified name of a SQL user-named type for user-named types or REF types |
setObject
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws java.sql.SQLException
This sets the value of a parameter using an object, which will be converted to a target SQL type. Basic data types can be passed using their object equivalents (for example, Integer for int).
A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The object containing the input parameter value |
targetSqlType: | One of these java.sql.Types types must be used for this parameter:
|
scale: | The number of digits after the decimal (only for java.sql.Types.DECIMAL and java.sql.Types.NUMERIC types) |
See also: java.sql.Types
setObject
public void setObject(int parameterIndex, Object x, int targetSqlType) throws java.sql.SQLException
This sets the value of a parameter using an object, which will be converted to a target SQL type. Basic data types can be passed using their object equivalents (for example, Integer for int).
A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The object containing the input parameter value |
targetSqlType: | The java.sql.Types type to be used for this parameter |
See also: java.sql.Types
setObject
public void setObject(int parameterIndex, Object x) throws java.sql.SQLException
This sets the value of a parameter using an object, which will be converted using the standard JDBC mapping from Java objects to SQL types. Basic data types can be passed using their object equivalents (for example, Integer for int).
A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The object containing the input parameter value |
setPassword
public void setPassword(String password) throws java.sql.SQLException
This sets the password used to connect to the database. The password must be set before invoking the execute() method. A SQLException is thrown if a database access error occurs.
Parameters:
password: | The password |
setQueryTimeout
public void setQueryTimeout(int seconds) throws java.sql.SQLException
This sets the number of seconds that the driver must wait for a Statement to execute. A SQLException is thrown if a database access error occurs.
Parameters:
seconds: | The limit in seconds. Zero means unlimited. |
setReadOnly
public void setReadOnly(boolean value) throws java.sql.SQLException
When value is set to true, attempts to update a read-only rowset will result in a SQLException being thrown. Rowsets are updatable by default if updates are possible.
Parameters:
value: | true if read-only, false otherwise |
setRef
public void setRef(int i, java.sql.Ref x) throws java.sql.SQLException
This sets a SQL REF typed parameter. A SQLException is thrown if a database access error occurs.
Parameters:
i: | The parameter index, starting at 1 |
x: | An object representing data of a SQL REF type |
setShort
public void setShort(int parameterIndex, short x) throws java.sql.SQLException
This sets a parameter to a Java short value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setString
public void setString(int parameterIndex, String x) throws java.sql.SQLException
This sets a parameter to a Java String value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setTime
public void setTime(int parameterIndex, java.sql.Time x) throws java.sql.SQLException
This sets a parameter to a java.sql.Time value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setTime
public void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal) throws java.sql.SQLException
This sets a parameter to a java.sql.Time value that will be converted to a SQL TIME value when it is sent to the database. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
cal: | The calendar value |
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws java.sql.SQLException
This sets a parameter to a java.sql.Timestamp value. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
setTimestamp
public void setTimestamp( int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal) throws java.sql.SQLException
This sets a parameter to a java.sql.Timestamp value that will be converted to a SQL TIMESTAMP value when it is sent to the database. A SQLException is thrown if a database access error occurs.
Parameters:
parameterIndex: | The parameter index, starting at 1 |
x: | The parameter value |
cal: | The calendar value |
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLException
This sets the transaction isolation level for the rowset.
Parameters:
level: | The transaction isolation level. Allowed values are defined in the Connection object as follows:
|
A SQLException is thrown if a database access error occurs.
setType
public void setType(int type) throws java.sql.SQLException
This sets the rowset type for the rowset. A SQLException is thrown if a database access error occurs.
Parameters:
type: | The rowset type value as defined in ResultSet with one of the following:
|
setTypeMap
public void setTypeMap(java.util.Map map) throws java.sql.SQLException
This registers a type-map object as the default type map for the rowset. A SQLException is thrown if a database access error occurs.
Parameters:
map: | The type-map object |
setUrl
public void setUrl(String url) throws java.sql.SQLException
Using this method is not mandatory. If set, the URL passed as a parameter is used to create a database connection when needed; otherwise, the data source name will be used. A SQLException is thrown if a database access error occurs.
Parameters:
url: | The URL as a string value |
setUsername
public void setUsername(String name) throws java.sql.SQLException
This sets the username used to connect to the database. The username must be set before invoking the execute() method. A SQLException is thrown if a database access error occurs.
Parameters:
name: | The username |