Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

CachedRowSetImpl vs RowSet

 
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been using CachedRowSetImpl because I remember reading that I cannot use RowSet after I close the connection. Now I am not sure. If my assumption correct. Could I use RowSet after clossing the connection if I create the Statement with RowSet.CONCUR_READ_ONLY?
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Alejandro Barrero wrote: Could I use RowSet after clossing the connection if I create the Statement with RowSet.CONCUR_READ_ONLY?




Yes you can use rowset after closing connection, I tried it long back, check if this helps

http://ilovej2ee.blogspot.com/2008/01/using-cachedrowset-in-java.html


Thanks,
Shailesh
 
Alejandro Barrero
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Shailesh.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, yeah. If your RowSet was created from Statement tied to a Connection and you close the Connection, all the resources opened by that connection SHOULD be released. If you have a scrollable rowset, it is possible that the JDBC driver (incorrectly) has rows cached that you can use, but if you haven't retrieved all the rows, you won't be able to scroll past the last block retrieved.

If your intent is to disconnect the Rowset from the database connection, then you should use the disconneced rowset (CachedRowSetImpl).
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/731949/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic