RE: Error in servlet
| От | Andreas Tille |
|---|---|
| Тема | RE: Error in servlet |
| Дата | |
| Msg-id | Pine.LNX.4.21.0009151023040.6463-100000@wr-linux02.rki.de обсуждение исходный текст |
| Ответ на | RE: Error in servlet ("chris markiewicz" <cmarkiew@commnav.com>) |
| Ответы |
RE: RE: Error in servlet
Re: RE: Error in servlet |
| Список | pgsql-general |
On Thu, 14 Sep 2000, chris markiewicz wrote:
> could this be a servlet/thread issue? i cannot tell from the code snippet,
Solved. I really stupidly forgot an rs.next() :-(((.
> but remember that variables in a servlet with class scope are essentially
> static. (i am guessing that query, rs, stmt, etc are all class scope. this
> is very dangerous, in the programming sense of the word...) i've had
> similar (but not the same) problems before. as a general rule, i NEVER put
> a class scope variable in a servlet unless i really mean to.
Well, that might be true for query and rs and I'll change that, but
in my opinion
public class ServletSQLClass
{
private Connection con;
private Statement stmt;
...
con = DriverManager.getConnection(url,user,passwd);
stmt = con.createStatement();
...
}
con and stmt have to be class scope to hold the connection to the
database and don't have to reopen over and over. Or did I understand
something wrong?
Kind regards
Andreas.
В списке pgsql-general по дате отправления: