Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Lew" Subject: Re: Close resultset but n Message-ID: X-Comment-To: comp.lang.java.databases Newsgroups: comp.lang.java.databases In-Reply-To: <90816268-847f-4656-9d2f-6ac3b2af1533@x35g2000hsb.googlegroups.co References: <90816268-847f-4656-9d2f-6ac3b2af1533@x35g2000hsb.googlegroups.co Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 24 Date: Wed, 27 Apr 2011 15:22:44 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303917764 96.60.20.240 (Wed, 27 Apr 2011 10:22:44 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:22:44 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.databases:265 To: comp.lang.java.databases "polilop" wrote: >> After i [sic] collect the rs i [sic] close it, but how do i [sic] close the connection? joeNOSPAM@BEA.com wrote: > The code isn't so good, that you obtain a connection and don't > retain/manage it. That being said, you can do this in the code > that is closing the result set, instead of closing the result set: > > rs.getStatement().getConnection().close(); > > By spec, closing the connection will close the statement which > will close the result set. Alternatively, use a disconnected RowSet. Then you can close the connection in the normal place, in the context of the code that opened it, and not worry. -- Lew --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24