Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet object returning null

 
Arpit Panwar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


where ResultSet is defined in class as

conct is a valid connection object
and query is also valid and the table also has rows in it...still resultset keeps fetching null....Can anyone help..
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens to a ResultSet when you close its connection?
You close the connection. Then you return the resultset.

keeps fetching null
What does that mean: no rows? rs == null ?
 
Arpit Panwar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup ResultSet returns no rows

ResultSet.getFetchSize() returns 0 i.e. no rows are being fetched

And should closing the Connection have anything to do with ResultSet object???
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arpit Panwar wrote:

And should closing the Connection have anything to do with ResultSet object???
Yes.
You can think of a resultset as a cursor into the database. The connection is needed to navigate to the next record.
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arpit Panwar wrote:Yup ResultSet returns no rows

ResultSet.getFetchSize() returns 0 i.e. no rows are being fetched
This method might not do what you expect that it does:
http://www.coderanch.com/t/299924/JDBC/java/workings-ResultSet-getFetchSize
 
Arpit Panwar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it without closing the connection the result is the same....
Still i keep Getting 0 rows
has is something to do with my Connection
 
Arpit Panwar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan Cumps wrote:
Arpit Panwar wrote:Yup ResultSet returns no rows

ResultSet.getFetchSize() returns 0 i.e. no rows are being fetched
This method might not do what you expect that it does:
http://www.coderanch.com/t/299924/JDBC/java/workings-ResultSet-getFetchSize


Ok Thanks
Il try it out right away
 
Arpit Panwar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
It Really Helped
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. Good!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic