Skip to Content.
Sympa Menu

freetds - Re: Cannot scan servlet header in Apache

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Stefan Bodewig <bodewig AT bost.de>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Cannot scan servlet header in Apache
  • Date: 10 May 2000 15:38:19 +0200


>>>>> "RZ" == Raul Zancan <spopa AT tiscalinet.it> writes:

RZ> About closing connections I open them in the init() method of my
RZ> servlets and I close them in the destroy() method

The JVM won't call destroy until the servlet really is destroyed - and
even then it is not guaranteed to do so.

If you are not using the SingleThreadModel (which is evil anyway) this
will mean, you open a connection the first time your servlet is called
(once for every alias if you happen to have the same servlet class
referenced under different "names") and it won't be closed before
JServ is stopped - JServ doesn't destroy servlets anytime else.

So you could be running out of resources if you use a larger number of
servlet aliases.

As has been suggested, check for your Statements and ResultSets,
too. It should always be something like

ResultSet rs = null;
try {
rs = stmt.executeQuery(...)
...
} finally {
if (rs != null) try {rs.close();} catch (SQLException e) {}
}

likewise for Statements.

BTW I don't think holding open connections for the full lifetime of
your servlet is that good a design. You should consider using a
connection pool and acquire/release connections every time you want to
use it.

Stefan




Archive powered by MHonArc 2.6.24.

Top of Page