• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

ResultSet object returning null

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
https://coderanch.com/t/299924/JDBC/java/workings-ResultSet-getFetchSize
 
Arpit Panwar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
https://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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
It Really Helped
 
Jan Cumps
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah. Good!
 
reply
    Bookmark Topic Watch Topic
  • New Topic