Quite wrong. The normal ResultSet needs the connection to the database to do iterate through the results. So don't close the connection before you're done with the ResultSet. The CachedRowSet of the upcoming JDBC 3.0 will work as described. (See http://java.sun.com/products/jdbc/download.html#corespec30) To answer the original question: rs.close() will close your ResultSet. This is a quite important operation, as some drivers won't free all resources on a connection.close() unless you call close on all (!!!) ResultSets and Statements that have been created. > -----Ursprüngliche Nachricht----- > Von: Zenon Braga F. [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag, 20. März 2001 15:49 > An: [EMAIL PROTECTED] > Betreff: Re: Closing ResultSet and Statement? > > > I'm not sure, but I think that you don't close a > ResultSet, you only close > the connection, in fact, you can even close the connection > and still work > with your ResultSet. > Think of ResultSet like a normal class with an > interator that allows you to > go forward and backward. > > sincerely, > > Zenon Farias Braga F. > > > >From: "Mick Sullivan" <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: [EMAIL PROTECTED] > >Subject: Closing ResultSet and Statement? > >Date: Mon, 19 Mar 2001 20:48:31 -0000 > > > >Hi > >Does anyone know how to close a ResultSet? > >Heres my code: > >public String getName() throws Exception { > > Statement statement = connection.createStatement(); > > int myInt = 1; > > ResultSet rs = statement.executeQuery("SELECT Name"+ > > " FROM nameAddress" + > > " WHERE ID = ("+ > > myInt + ")"); > > rs.next(); > > String myString = rs.getString("Name"); > > //change the resultSet to a string > > //so it can be used by the jsp page > > return myString; > > } > >Any help at all would be much appreciated > >Thanks in advance, > >Mick > > > > > > > >_____________________________________________________________ > ____________ > >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com
