public interface JdbcRowSet extends RowSet, Joinable
JdbcRowSet必须实现的标准接口。
ResultSet对象的包装器,可以将结果集用作JavaBeans的组件。
因此, JdbcRowSet对象可以是工具可用于构成应用程序的Bean之一。
因为JdbcRowSet是一个连接的行集,也就是说,它使用支持JDBC技术的驱动程序不断维护与数据库的连接,同时也有效地使驱动程序成为JavaBeans组件。
因为它始终连接到它的数据库, JdbcRowSet一个实例可以简单地调用它调用的调用,并在它的ResultSet对象上调用它们。 因此,结果集可以例如是Swing应用程序中的组件。
JdbcRowSet对象的另一个优点是它可以用于使一个ResultSet对象可滚动和可更新。 所有RowSet对象默认为可滚动和可更新。 如果正在使用的驱动程序和数据库不支持滚动和/或更新结果集,应用程序可以使用JdbcRowSet对象的数据填充ResultSet对象,然后对JdbcRowSet对象进行操作,就像它是ResultSet对象一样。
JdbcRowSet对象 JdbcRowSet实现, JdbcRowSetImpl提供了默认构造函数的实现。
新实例使用默认值初始化,可以根据需要使用新值进行设置。
一个新的实例在它的execute方法被调用之前并不真正有效。
一般来说,此方法执行以下操作:
PreparedStatement对象并设置其任何占位符参数 ResultSet对象 execute方法成功,它将设置适当的私人JdbcRowSet字段与以下:
Connection对象 - 行集和数据库之间的连接 PreparedStatement对象 - 生成结果集的查询 ResultSet对象 - 行集的命令生成的结果集,实际上是一个JavaBeans组件 execute方法尚未成功执行,则不能在行集上调用execute和close以外的方法。
所有其他公共方法都会抛出异常。
然而,在调用execute方法之前,必须设置建立连接所需的命令和属性。 以下代码段创建一个JdbcRowSetImpl对象,设置命令和连接属性,设置占位符参数,然后调用方法execute 。
JdbcRowSetImpl jrs = new JdbcRowSetImpl();
jrs.setCommand("SELECT * FROM TITLES WHERE TYPE = ?");
jrs.setURL("jdbc:myDriver:myAttribute");
jrs.setUsername("cervantes");
jrs.setPassword("sancho");
jrs.setString(1, "BIOGRAPHY");
jrs.execute();
可变jrs现在表示的实例JdbcRowSetImpl即围绕一个瘦包装ResultSet包含在表中的所有行对象TITLES其中书的类型是基础资料。
此时,调用jrs将影响结果集中的行,这实际上是一个JavaBeans组件。
所述的实施RowSet方法execute在JdbcRowSet参考实现从在不同CachedRowSet A“¢参考实现以考虑连接和断开的不同要求RowSet对象。
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| Modifier and Type | Method and Description |
|---|---|
void |
commit()
每个
JdbcRowSet包含一个
Connection对象从
ResultSet或JDBC属性传递给它的构造函数。
|
boolean |
getAutoCommit()
每个
JdbcRowSet包含一个
Connection对象,从原始的
ResultSet或传递给它的JDBC属性。
|
RowSetWarning |
getRowSetWarnings()
检索通过此
JdbcRowSet对象的呼叫报告的第一个警告。
|
boolean |
getShowDeleted()
检索一个
boolean指示标记为删除的行是否显示在当前行的集合中。
|
void |
rollback()
每个
JdbcRowSet包含一个
Connection对象,从原始的
ResultSet或传递给它的JDBC属性。
|
void |
rollback(Savepoint s)
每个
JdbcRowSet包含一个
Connection对象,从原始的
ResultSet或传递给它的JDBC属性。
|
void |
setAutoCommit(boolean autoCommit)
每个
JdbcRowSet包含一个
Connection对象从原始的
ResultSet或传递给它的JDBC属性。
|
void |
setShowDeleted(boolean b)
将属性
showDeleted设置为给定的
boolean值。
|
addRowSetListener, clearParameters, execute, getCommand, getDataSourceName, getEscapeProcessing, getMaxFieldSize, getMaxRows, getPassword, getQueryTimeout, getTransactionIsolation, getTypeMap, getUrl, getUsername, isReadOnly, removeRowSetListener, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBlob, setBlob, setBlob, setBoolean, setBoolean, setByte, setByte, setBytes, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setClob, setClob, setClob, setCommand, setConcurrency, setDataSourceName, setDate, setDate, setDate, setDate, setDouble, setDouble, setEscapeProcessing, setFloat, setFloat, setInt, setInt, setLong, setLong, setMaxFieldSize, setMaxRows, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNClob, setNClob, setNClob, setNString, setNString, setNull, setNull, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setObject, setPassword, setQueryTimeout, setReadOnly, setRef, setRowId, setRowId, setShort, setShort, setSQLXML, setSQLXML, setString, setString, setTime, setTime, setTime, setTime, setTimestamp, setTimestamp, setTimestamp, setTimestamp, setTransactionIsolation, setType, setTypeMap, setURL, setUrl, setUsernameabsolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getMetaData, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNullisWrapperFor, unwrapgetMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumnboolean getShowDeleted()
throws SQLException
boolean指示标记为删除的行是否显示在当前行的集合中。
如果返回true ,则删除的行与当前行可见。
如果返回false ,则行与当前行的集合不可见。
默认值为false 。
标准行集实现可能会选择限制此行为的安全注意事项或某些部署方案。 已删除行的可见性是实现定义的,不代表标准行为。
注意:允许删除的行保持可见使一些标准JDBC RowSet实现方法的行为RowSet化。 然而,大多数行集用户可以简单地忽略这个额外的细节,因为只有非常专门的应用程序可能希望利用此功能。
true如果删除的行是可见的;
false否则
SQLException - 如果行集实现无法确定标记为删除的行是否保持可见
setShowDeleted(boolean)
void setShowDeleted(boolean b)
throws SQLException
showDeleted设置为给定的boolean值。
此属性确定标记为删除的行是否继续显示在当前行的集合中。
如果该值设置为true ,则删除的行将立即与当前行的集合一起显示。
如果该值设置为false ,则删除的行将被设置为与当前行集不可见。
标准行集实现可能会选择限制此行为的安全注意事项或某些部署方案。 这是按照实现定义的,不代表标准行为。
b - true如果删除的行应该显示;
false否则
SQLException - 如果行集实现无法重置删除的行是否应该可见
getShowDeleted()
RowSetWarning getRowSetWarnings() throws SQLException
JdbcRowSet对象的呼叫报告的第一个警告。
如果这个JdbcRowSet对象报告了第二个警告,它将被链接到第一个警告,可以通过调用第一个警告的方法RowSetWarning.getNextWarning 。
对此JdbcRowSet对象的后续警告将链接到方法RowSetWarning.getNextWarning返回的RowSetWarning对象。
每次阅读新行时,警告链都会自动清除。
此方法可以不被称为上RowSet已封闭的对象;
这样做会导致SQLException被抛出。
因为它总是连接到它的数据源, JdbcRowSet对象可以依靠活性的存在Statement , Connection和ResultSet实例。 这意味着应用程序可以通过调用他们提供的getNextWarning方法获得额外的SQLWarning通知。 断开连接的Rowset对象,如CachedRowSet对象,无法访问这些getNextWarning方法。
RowSetWarning对象报告在这个
JdbcRowSet对象或
null如果没有
SQLException - 如果在封闭的
JdbcRowSet对象上调用此方法
RowSetWarning
void commit()
throws SQLException
JdbcRowSet都包含一个Connection对象,从ResultSet或JDBC属性传递给它的构造函数。
此方法包含Connection提交方法,以允许灵活的自动提交或非自动提交事务控制支持。
使自上次提交/回滚以来所做的所有更改都将永久性,并释放此Connection对象当前持有的任何数据库锁。 只有当自动提交模式被禁用时,才应该使用此方法。
SQLException - 如果发生数据库访问错误或此JdbcRowSet内的此
JdbcRowSet对象处于自动提交模式
Connection.setAutoCommit(boolean)
boolean getAutoCommit()
throws SQLException
JdbcRowSet包含一个Connection对象,从原始的ResultSet或传递给它的JDBC属性。
此方法包含Connection的getAutoCommit方法,以允许应用程序确定JdbcRowSet事务行为。
将此连接的自动提交模式设置为给定状态。 如果连接处于自动提交模式,则其所有SQL语句将作为单个事务执行并提交。 否则,它的SQL语句被分组到通过调用方法commit或方法回滚而终止的事务中。 默认情况下,新连接处于自动提交模式。
true如果启用了自动提交;
false否则
SQLException - 如果发生数据库访问错误
Connection.getAutoCommit()
void setAutoCommit(boolean autoCommit)
throws SQLException
JdbcRowSet包含一个Connection对象,从原始的ResultSet或传递给它的JDBC属性。
该方法包含Connection的getAutoCommit方法,允许应用程序设置JdbcRowSet事务行为。
设置此Connection对象的当前自动提交模式。
autoCommit - true启用自动提交;
false禁用自动提交
SQLException - 如果发生数据库访问错误
Connection.setAutoCommit(boolean)
void rollback()
throws SQLException
JdbcRowSet包含一个Connection对象,从原始的ResultSet或传递给它的JDBC属性。
撤销在当前事务中所做的所有更改,并释放此Connection对象当前持有的任何数据库锁。
只有当自动提交模式被禁用时,才应该使用此方法。
SQLException - 如果发生数据库访问错误或此
Connection内的此
JdbcRowSet对象处于自动提交模式。
rollback(Savepoint)
void rollback(Savepoint s) throws SQLException
JdbcRowSet都包含一个Connection对象,从原始的ResultSet或传递给它的JDBC属性。
将当前事务中所做的所有更改撤消到上一集保存点,并释放此Connection对象当前持有的任何数据库锁。
只有当自动提交模式被禁用时,才应该使用此方法。
s -
Savepoint回滚到
SQLException -如果发生数据库访问错误或者此
Connection此内对象
JdbcRowSet是在自动提交模式。
rollback()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.