db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: DB Connections are not being closed...
Date Thu, 24 Mar 2005 07:52:59 GMT




Hi,

if you do not open any connection explicitly, Torque makes sure that the
connections are closed.

If you open connections explicitly, make sure that they are closed
afterwards. A secure way is doing it like this.

Connection connection = null;
try {
   connection = Torque.getConnection();
   // do whatever you want with the connection
  Torque.closeConnection(connection);
  connection = null;
}
finally {
  if (connection != null) {
    try {
      Torque.closeConnection(connection);
    }
    catch (Exception e) {}
    connection = null;
  }
}

Also, only store connections in local variables in order not to run in any
threading problems, not in class or instance variables. And never ever
store them in sessions.

   Thomas

Irineu Avanço Jr. <iavanco@mcn.com.br> schrieb am 22.03.2005 18:30:08:

> Hi..
>
>
>
> We are facing an issue  with DB connections  using  Jetspeed 1.5  and
Torque
> 3.1.    We are making stress tests
>
> with  a  portal application  impelemented under  Jetspeed and Torque
> architecture.
>
> The problem is that the connection with Jetspeed DB is not being closed
> even after the user gets disconnected.   Instead,  the connection are
closed
> only if I  shutdown  the Web server,  in this case Tomcat 5.
>
>
>
> We did some changes in  the Torque.properties file to try to make them
close
> properly and it did not work.
>
>
>
> Can anybody help us out with this issue ?
>
>
>
> Thank you.
>
>
>
>
>
> Irineu Avanço Jr.
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message