Menu

#19 PreparedStatement Pooling is broken

open
nobody
None
5
2002-04-05
2002-04-05
Anonymous
No

Besides the bug reported in 502648, there are fatal
problems with the current implementation of
PreparedStatement pooling.

PreparedStatements are pooled on the JDBCPool level.
This means that calling connection.prepareStatement()
may return a statement associated with another
connection. Firstly, this may result in your updates
becoming part of someone else's transaction and/or
your updates not being part of your own transaction.
Secondly, the statement that you retrieve may be
associated with a connection that has the wrong
security credentials.

To turn off PreparedStatement pooling put
<poolPreparedStatements>false</poolPreparedStatements>
in your poolman.xml config file.

Fixing this would require that statements are pooled
on a per-connection basis. Adding an API to fetch
PreparedStatements with an anonymous connection might
be useful for auto-commit updates.

Discussion


Log in to post a comment.