File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

line just after result of query

 
Mohammed Mudassir Mohiuddin
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using JDBC how to retrieve "5 rows in set (0.00 sec)", line just after result of query.

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used code like this:



I've always wanted to be able to do something like rs.getRowCount() instead, but having implemented a JDBC driver I realize how dangerous such as function is. The programmer will assume that it is a simple number that the driver can return, but in many case, in order to get that number, the driver has to get all of the rows first. At least, that is what the issue was with our database. So making the programmer do extra work might force him/her to think whether such a thing is a good idea (especially if the row count is possibly in the thousands or higher!)
 
Paul Clapham
Sheriff
Pie
Posts: 20177
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However, to produce the posted output, all you need to do is to increment a counter for each row you read.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic