You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jack Zakarian <jz...@welchpartners.com> on 2003/05/25 22:58:30 UTC
RE: [OT] Scrollable Result Set
Hi Keith,
I am running on oracle9i using DAO's and here is how I declare and use
the scrollable ResultSet with a preparedStatement. This allows me to
page - up or down - through the ResultSet without keeping every thing in
memory. There are more calls to the database this way but it was a trade
off that I accepted. Passing in an offset and a limit allows you to
position the cursor and return a limited set or records.
Jack
Ds is the dataSource
conn = ds.getConnection();
pstmt = conn.prepareStatement(SELECT_HDR_CONDITION_SQL+condition,
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );
//pstmt.setString(1, condition);
rs = pstmt.executeQuery();
if(offset > 0) rs.absolute(offset);
int recCount = 0;
while((recCount++ < limit) && rs.next()) {
ServiceInvoiceHdr sh = new ServiceInvoiceHdr();
-----Original Message-----
From: Kamholz, Keith (corp-staff) USX [mailto:kkamholz@moog.com]
Sent: Wednesday, June 25, 2003 2:45 PM
To: Struts (E-mail)
Subject: [OT] Scrollable Result Set
Hey,
I'm trying to use a PreparedStatement to get a ResultSet. I know how to
get
a customized ResultSet if you're only using a Statement, but how can I
get a
scrollable ResultSet with my PreparedStatement?
Thanks!
- Keith
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org