Ankit Garg wrote:I went through the documentation of JdbcRowSet, and what it's intended to do is it makes any ResultSet scrollable and update-able. Not all databases and JDBC drivers are scrollable. But irrespective of whether your ResultSet is scrollable and update-able, JdbcRowSet will add those capabilities...
Thanks or replying,
However if you create a JdbcRowSet by passing a ResultSet in the constructor as JdbcRowSet rowSet = new JdbcRowSetImpl(rs); and the rs is not updatable, the outcome of the wrapped jRowSet is
not updatadable.
Yet they say that it allows any result set to be updatable and scrollable... It's kind of confusing.
Again from the same
tutorial:
One of the main uses of a JdbcRowSet object is to make a ResultSet object scrollable and updatable when it does not otherwise have those capabilities.
after a few lines below they contradicts what they have just said:
Note: The ResultSet object that is passed to the JdbcRowSetImpl constructor must be scrollable.
I would add it must be updatable too as if I pass a ResultSet in the JdbcResultSetImpl(rs); construcctor If this ResultSet I am passing is not updatable, the RowSet
won't be
updatable.
I am quite concerned for the exam about this topic as both the java tutorial and the mock exams I have done so far, are quite ramming a point of the fact that any RowSet will make scrollable and updatable any ResultSet otherwise not having those capabilities. And when of course i select the answer stating they are wrappers giving scrollability and updatability it's the right answer for the mocks. But still... passing a ResultSet in the constructor which is non scrollable and non updatable it will not produce the expected outcome, plus the contradiction in the java tutorial.
At this point I might thing that what they mean is: It is a wrapper for any ResultSet otherwise not scrollable or updatable, however when this ResultSet is created it must be declared with those parameters on. (ResultSet.CONCUR_UPDATABLE, ResultSet.TYPE_SCROLL_INSENSITIVE); now if the database and the drivers or either of them don't support those capabilities the JdbcRowSet will make up for it. But if those parameters are not set, even if wrapped in a JdbcRowSet the result will be the same (non scrollable non updatable).
It is my view of the thing. I cannot think of anything else... I am using mysql and those are supported capabilities, so I cannot
test what happens with an underlying dbms/drivers not supporting them.
Anybody feeling to confirm (or not) my thesis, please do it as this topic is quite bleak.
Thanks in advance.