Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resultset doubt

 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a db-access code inside a JSP which has to display 'no value found' if there are no matching values.
Well, I tried like this..

then I tried like this..
and this worked.
My doubt is why is the resultset never 'zero' even when there are no matching values. Can someone tell me where I am going wrong?
Regards,
Nandini
 
Rudy Dakota
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nandini,
From your post I get the strong impression you suppose getFetchSize() will return the number of rows actually retrieved. This is not the case. In fact, there is no easy way in JDBC to determine that number. Your second solution is the 'good' one.
Oh, by the way, you might want to read the documentation on JDBC. There is plenty that will tell you what the methods actually do.
Good riding,
Rudy.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need:

I'm not sure whether my explanation is accurate, but I think a fetchSize is a kind of BufferSize; the number of rows which can be passed by the database at once. You may set it explicitly with 'setFetchSize ()' and it may be smaller or greater than the count of rows returned.
[ April 06, 2004: Message edited by: Stefan Wagner ]
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rudy and Stefan. I will look into it.
Regards,
Nandini
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic