List:General Discussion« Previous MessageNext Message »
From:Hassan Schroeder Date:October 28 2003 3:53pm
View as plain text  
Michael McTernan wrote:

> My problem, that so far no one has been able to answer, is that I'm using
> connection pooling with the Tomcat server. 

> TransactionA gets connection A from the pool.
> TransactionA creates a temporary table for some query.
> TransactionA is done, and returns the connection to the pool.
> TransactionB gets a connection from the pool, which just so happens to be
> connection A.
> TransactionB tries to create a temporary table with the same name as the one
> that already exists.
> ** BANG!! **

Yes, you're right -- as long as the container-managed connection is
open, the original TEMPORARY table will persist across the sessions
of different individuals.

I just ran into this issue myself, and so far I've thought of

1) creating a *unique* temporary table using the SESSIONID, in a
    separate DB where the tomcat 'user' has DROP privileges, and use
    a method implementing HttpSessionBindingListener to drop that
    table when the session terminates;

2) just keeping the original ResultSet in memory and manipulating
    it there...

Neither quite as graceful as using a real temporary table, so I'm
also open to other suggestions :-)

Hassan Schroeder ----------------------------- hassan@stripped
Webtuitive Design ===  (+1) 408-938-0567   ===

                           dream.  code.

help... cannot killRoy F. Cabaniss2 Jul
  • Re: help... cannot killRoy F. Cabaniss2 Jul
  • RE: DROP TEMORARY TABLESteve Buehler28 Oct
  • Re: DROP TEMORARY TABLEHassan Schroeder28 Oct