Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disconnected resultsets...

 
D James Scanlan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I come from a .net world. One of the nice objects within its data access architecture is a "DataTable". This is similar to a resultset but with one significant difference - it is completely disconnected from its datasource. Which, unless I'm missing the point, is different to resultsets in that they hold connections until they are destroyed.

I like writing generic data layers in whatever language I'm using and am seeking to write a generic method that calls a stored procedure that will return multiple rows. I want then to pass this data to other areas of my application. It doesn't look like I can use a resultset as that would leave open connections all over the place.

I know I could write a method that fills a resultset and then populates classes with the contents of this data but this is not generic.

I've already written a class called (drum roll) "DataTable" which converts a resultset to xml which is generic but feels expensive in terms of resources.

Am I venturing down a cul-de-sac of bad practice? If so, what should I be doing?
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Scanlan,

Welcome to Java world, and welcome to Java ranch as well.


One of the nice objects within its data access architecture is a "DataTable".


We do have similar object in java and that is CachedRowSet. You can use the same.



it is completely disconnected from its datasource. Which, unless I'm missing the point, is different to resultsets in that they hold connections until they are destroyed.


CachedRowSet are also disconnected from database, you can release you resultset once you populate your CachedRowSet. Onwards you can use it the way you like to do the programming.


Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic