This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The problem is really that there isn't any interaction with the databse until you do something with the result set.
You have 3 options:
(1) As you say, do a 'select count(*)' or 'count( whatever your query is )' (2) Iterate through your resultset keeping a tally (3) If you are able to use scrollable resultsets, take a look at this approach. [ March 15, 2005: Message edited by: Horatio Westock ]
Joined: Feb 17, 2005
#3 looks like a better option for what I want to do. thanks
Joined: Feb 23, 2005
Before you decide for sure, take a look at the final section of this article.
You should check that your DB and driver definitely support scrollable cursors, and don't just emulate it. If not, you are basically going to be getting every row anyway.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus