This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
hi all, i want to find out the number of rows in a result set before proceesing it. i used getFetchSize() for this but this method is returning 1 always. i want to know what is the significance of this method and is there any method in jdbc 2.0 to find out the number of rows in a resultset. regards deeksha
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
posted
0
According to JDBC 2.0, It Returns the fetch size for this result set...I have never tried to use it. What you can also do is issue a select count (*) before executing your querry. Bosun
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
sateesh arumbaka
Greenhorn
Joined: May 17, 2001
Posts: 5
posted
0
Here is a solution for ur problem Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = statement.executeQuery(query); rs.last(); int numberOfRows = rs.getRow(); rs.beforeFirst(); mail me if u have any questions sateesh
Originally posted by deekasha gunwant: hi all, i want to find out the number of rows in a result set before proceesing it. i used getFetchSize() for this but this method is returning 1 always. i want to know what is the significance of this method and is there any method in jdbc 2.0 to find out the number of rows in a resultset. regards deeksha
and what is FetchSize? The number of rows that should be fetched from the database each time new rows are needed. This is much different than the total number of rows. For example, if your query finds 10,000 matches, it won't return all 10,000 rows from the database. This is where fetch size comes in to play. If fetchSize is 10, then it will initially retrieve the first ten rows. When you call rs.next() after row ten, the program makes a call to the database to return the next 10(or whatever the fetchSize is) rows. Jamie
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.