The Artima Developer Community
Sponsored Link

Java Answers Forum
JDBC help needed

2 replies on 1 page. Most recent reply: Apr 6, 2002 2:31 AM by Elliott Wood

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Elliott Wood

Posts: 15
Nickname: tooess
Registered: Mar, 2002

JDBC help needed Posted: Apr 5, 2002 12:46 PM
Reply to this message Reply
Advertisement
I have a method that queries a database and has a while loop that loops through the results from the query. Within this loop another method is called that queries the database.
My problem is that when the second method is called the results from the first method are lost eventhough both methods have differnt resultSets.

Can anyone help?


Singh M.

Posts: 154
Nickname: ms
Registered: Mar, 2002

Re: JDBC help needed Posted: Apr 5, 2002 8:16 PM
Reply to this message Reply
This will happen if you are using the same Statement object for executing the query.

According to the java doc. for resultset,

A ResultSet is automatically closed by the Statement that generated it when that Statement is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet is also automatically closed when it is garbage collected.

Hope?@this helps.

Elliott Wood

Posts: 15
Nickname: tooess
Registered: Mar, 2002

Re: JDBC help needed Posted: Apr 6, 2002 2:31 AM
Reply to this message Reply
That sounds like my problem, thank you

Flat View: This topic has 2 replies on 1 page
Topic: telephone Previous Topic   Next Topic Topic: How to skip 404/401/403

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use