-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael McTernan wrote:
> Hi Larry, > > I was wondering a similar thing, but for JDBC using connection pooling. In > your example you say that 2 people will hit the script at the same time; if > they are using independent connections this should cause no problems since > TEMPORARY tables are local to the connection so don't interfere. > > My worry is that when using connection pooling, if I create temporary tables > without dropping them and then return the connection to the pool, if the > connection then gets reused, the temporary table will still exist and cause > problems. Clearly dropping the temporary table is needed, although I don't > want to give the user in question DROP TABLES priveledge, and there is no > such priveledge just for temporary tables :( I'm not sure how the database > connection gets 'reset' without being terminated and then reconnecting. > > Thanks, > > Mike MySQLConnectionPoolDataSource in Connector/J 3.1.1 uses the 'change user' network command to take care of this (the mysql server 'resets' the connection to an initial state). However, that version is in developemnt (not stable), and not every connection pool uses ConnectionPoolDataSources. Unfortunately, this is an issue with most connection pools for most databases, because there is no 'standard' way to 'refresh' the connection. If you have a way to centralize your connection pooling/temporary table handling, you could always throw the created temp-tables in a thread-local list, and then drop them immediately before closing the pooled connection. -Mark - -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 557 2388 www.mysql.com Are you MySQL Certified? http://www.mysql.com/certification/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQE/oUqItvXNTca6JD8RAjBAAJ43XOMVzawXG9IBeSCCGk1stCi3NQCbBhwJ 3DPcQmwFbDN4PoFqP//Mbl0= =VZ4f -----END PGP SIGNATURE----- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]