This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes resultset type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "resultset type" Watch "resultset type" New topic
Author

resultset type

krishna prasad gunasekaran
Ranch Hand

Joined: Jul 25, 2006
Posts: 158
good day,
i use connection.preparecall to call a procedure that returns some rows.
my java code has to do something with the last row returned. so, in order to perform that logic, i could comeup with only two options

1. we have to find out the total rows returned which can be done in the procedure. is there a way to find the total rows returned by the cursor, without doing looping and fetching.

2. use resultset.isLast(). i have used the following code.
callableStatement = connection.prepareCall("{call Pkg_test.prget(?,?,?)}", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
but somehow the type is reset to TYPE_FORWARD_ONLY by the driver. why is my type not feasible. due to this, i couldn't use isLast().

have a nice day,
krishna prasad


have a great day,
krishna prasad
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

Why not use ORDER BY to change the order around so the last item now is the first item then, also combined with a limitation on the number of rows (TOP 1 in MS SQL Server, LIMIT 0 in MySQL).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: resultset type