• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JDBC Scrollable ResultSet

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!
 
Who among you feels worthy enough to be my best friend? Test 1 is to read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic