aspose file tools*
The moose likes JDBC and the fly likes JDBC Scrollable ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Scrollable ResultSet" Watch "JDBC Scrollable ResultSet" New topic
Author

JDBC Scrollable ResultSet

jay ceebee
Greenhorn

Joined: Sep 01, 2006
Posts: 3
My current company already have a framework in place and in their framework they have a class that handles all the database connectivity (including pooling) and statement preparation/executions.

Tried doing some scrolling on the returned resultset but ended up with an exception. With some checking, I noticed that the returned resultset is nonscrollable. Looking at the framework code, seems like it is using the prepareStatement(String sql) method without the facility to include or provide the resultSetType and the resultSetConcurrency. I could have easily fixed this problem by extending the class and overriding/overloading methods to create a scrollable resultset. But the attributes and methods that I need to do so are all private and so will not be visible and accessible from the child class. Already asked them if I can update their framework directly to expose a new method that also accepts resultSetType and resultSetConcurrency but they are still a bit hesitant about it considering that there are already dozens of applications built on top of it.

Is there a way I can transform/clone a resultset to become scrollable? Or to set the current preparedstatement to scrollable prior to executing it? Any form of help you can provide will be very much appreciated.

Thanks in advance!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31079
    
163

Originally posted by jay ceebee:
Is there a way I can transform/clone a resultset to become scrollable? Or to set the current preparedstatement to scrollable prior to executing it? Any form of help you can provide will be very much appreciated.

No. By the time you get the resultset, it's type is already set. And a Statement requires to know the type at creation type.

Ask the framework team if they can add a new method. I can understand the need to make things backward compatible, but that doesn't prohibit additions to the API.

Another thing is to consider why you need the resultset to be scrollable. Often things that hint at a scrollable resultset can be done in another (sometimes cleaner) way.

And welcome to JavaRanch!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC Scrollable ResultSet