Count « Record « Java Database Q&A

1. Record Count

Anand, If your table is index correctly, you can execute one SQL to get the record count, before executing the second SQL to fetch the records. Assuming you want to execute something like SELECT City FROM TblCountry where City = "FOO" then you can do the following. 1st get record count using "SELECT COUNT(*) FROM TblCountry WHERE City = "FOO". Once ...

2. Count of Records

3. Record Count

Hi Guys !!! Is there a way to find out the number of records returned by a select query without having to make another query (something like select count(*)) that returns the number of records. I mean something similar as in the case of ASP's rs.recordCount() functionality. Pls let me know. Thanks Guys

4. How do you get the complete count of records?

Thinking back... I was sure that there was some sort of ResultSet.getCount() function. HOWERVER, I came to find out I was mistaken when I took a browse of to see that there is not! Taking that into consideration, and thinking a little more, I believe that the rare case I wanted the count of the rows, I would simply open ...

5. Count the Records


Well, if the entertainment is going away...the code shows a PreparedStatment object both being built with a Connection.prepareStatement call and calling executeQuery on a String. My experience is that this will always blow up - do one or the other, not both. The advice to just use a Statement is sound in this case. (I have a headache - no yelling ...