db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject Antwort: hanging database connections
Date Fri, 08 Jul 2005 14:11:11 GMT




Hi,

are you using the save() method or the save(Connection) method ?

In the save() method, connections should be returned to the pool even if an
error occurs.
in the save(Connection) method, if an error occurs, no rollback or return
of the connection is made. You are responsible yourself that all
connections are returned in all circumstances, even if an error occurs.
This is usually achieved by code similar to this:

Connection connection = null;
try
{
  connection = getConnectionFromSomwhere();
  // do whatever you want to do with the connection
  // maybe ? connection.commit()
}
finally
{
  if (connection != null)
  {
    try
    {
      connection.close();
    }
    catch(Exception e)
    { }
  }
}

   Thomas


Roel van Dijk <rdvdijk@gmail.com> schrieb am 08.07.2005 15:08:50:

> I am using Torque as a part of Jetspeed, and I am updating something
> in the database. I am using an Oracle database without any troubles so
> far.
>
> However, when I try to insert a null-value into a fields which cannot
> be null according to the database, I receive an Oracle error message
> (as I expected). However, the connection on which this error was
> received is never released into the connection pool.
>
> Therefore, after 10 of these errors, my entire connection pool is
> filled, and I cannot make any new connections to the database. The
> application hangs from then on.
>
> Is there a way to free up these connections after I have caught this
> database exception?
> --
> Roel -- rdvdijk@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
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