From: | Andreas Tille <tillea(at)rki(dot)de> |
---|---|
To: | chris markiewicz <cmarkiew(at)commnav(dot)com> |
Cc: | "'PostgreSQL General'" <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: Error in servlet |
Date: | 2000-09-15 08:29:29 |
Message-ID: | Pine.LNX.4.21.0009151023040.6463-100000@wr-linux02.rki.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Caamaño | 2000-09-15 08:46:38 | load data from a file |
Previous Message | Dronamraju Rajesh | 2000-09-15 06:18:41 | libpq errors when makeing postgres 7.0.2... |