Re: Closing ResultSet and Statement?

2001-03-20 Thread Zenon Braga F.

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 -

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




RE: Closing ResultSet and Statement?

2001-03-20 Thread CPC Livelink Admin


ResultSets can and should be closed. They are not like normal classes with
an iterator.

ResultSets are created by Statements. Statements can and should be closed.
When a statement is reused, it will close the resultset (if not closed
already) that it previously supplied in order to get the new results. When a
statement is closed it will close the resultset it created. The number of
simultaneous open statements for a given connection can be (and is)
limited - the oracle limit is about 50 by default.

Statements are created by Connections. If you close the connection it closes
the statement which closes the resultset.

Regards,
Paul


-Original Message-
From: Zenon Braga F. [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 9:49 AM
To: [EMAIL PROTECTED]
Subject: 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 -

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





RE: Closing ResultSet and Statement?

2001-03-19 Thread William Kaufman

 Does anyone know how to close a ResultSet?

Note that this isn't a Tomcat question: there are newsgroups and mailing
lists specifically for JDBC.

 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 + ")");

  try
  {

   rs.next();
   String myString = rs.getString("Name");
  //change the resultSet to a string
  //so it can be used by the jsp page
   return myString;

  }
  finally
  {
  rs.close();
  statement.close();
  }

   }

To be super-cautious, include createStatement() and executeQuery() in the
"try" block, and surround the calls to close() with try/catch blocks.

-- Bill K.



RE: Closing ResultSet and Statement?

2001-03-19 Thread Dianne Cree

rs.close, isn't it?

-Original Message-
From: Mick Sullivan [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 12:49 PM
To: [EMAIL PROTECTED]
Subject: Closing ResultSet and Statement?


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.





RE: Closing ResultSet and Statement?

2001-03-19 Thread Dianne Cree

sorry, rs.close is asp.  the correct java code came a few mails ago

-Original Message-
From: Dianne Cree [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 2:25 PM
To: [EMAIL PROTECTED]
Subject: RE: Closing ResultSet and Statement?


rs.close, isn't it?

-Original Message-
From: Mick Sullivan [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 12:49 PM
To: [EMAIL PROTECTED]
Subject: Closing ResultSet and Statement?


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.






RE: Closing ResultSet and Statement?

2001-03-19 Thread Grewal, Gary
Title: RE: Closing ResultSet and Statement?





You close the statement Object by calling .close() on it.


===
Gary Grewal



-Original Message-
From: Dianne Cree [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 4:33 PM
To: [EMAIL PROTECTED]
Subject: RE: Closing ResultSet and Statement?



sorry, rs.close is asp. the correct java code came a few mails ago


-Original Message-
From: Dianne Cree [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 2:25 PM
To: [EMAIL PROTECTED]
Subject: RE: Closing ResultSet and Statement?



rs.close, isn't it?


-Original Message-
From: Mick Sullivan [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 12:49 PM
To: [EMAIL PROTECTED]
Subject: Closing ResultSet and Statement?



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.






RE: Closing ResultSet and Statement?

2001-03-19 Thread Grewal, Gary
Title: RE: Closing ResultSet and Statement?





or you can even close the Connection object by calling .close() on it. this will close all the underlying statement and ResultSet Object. I hope this is what you meant by close.

===
Gary Grewal
Contractor NEC America
Phone: 214-262-5911
E-Mail: [EMAIL PROTECTED]



-Original Message-
From: Dianne Cree [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 4:33 PM
To: [EMAIL PROTECTED]
Subject: RE: Closing ResultSet and Statement?



sorry, rs.close is asp. the correct java code came a few mails ago


-Original Message-
From: Dianne Cree [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 2:25 PM
To: [EMAIL PROTECTED]
Subject: RE: Closing ResultSet and Statement?



rs.close, isn't it?


-Original Message-
From: Mick Sullivan [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 12:49 PM
To: [EMAIL PROTECTED]
Subject: Closing ResultSet and Statement?



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.