Hi there,

Cool, I'm not imagining things :)

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

I currently drop the temporary table after use, so that the connection gets
'cleaned' up for reuse.  I've used the finally clause of Java to ensure this
gets done, like this:

Connection dbConnection = Pool.getConection();

try
{
        /* Do some funky MySQL stuff here, using temp tables x,y,z */
        ....
        return true;
}
finally
{
        dbConnection.prepareStatment("DROP TABLES x,y,z;").executeUpdate;
        /* Close method is overridden, so actually returns to the Pool */
        dbConnection.close();
}

The problem for me is that I don't like giving the Tomcat user DROP
privilege for security reasons.  Seems like a feature request is needed to
ask for a DROP TEMPORARY TABLE privilege to match the CREATE TEMPORARY TABLE
privilege.

Thanks,

Mike

> -----Original Message-----
> From: Hassan Schroeder [mailto:[EMAIL PROTECTED]
> Sent: 28 October 2003 15:54
> To: mysql
> Cc: MySQL Java
> Subject: Re: DROP TEMORARY TABLE
>
>
> 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 ----------------------------- [EMAIL PROTECTED]
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>
>                            dream.  code.
>
>
>
>
> --
> MySQL Java Mailing List
> For list archives: http://lists.mysql.com/java
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to