I have a strange situation here. I'm using BMP so I lookup for the DataSource, ask for a connection and use this connection for executing my statements (prepare statements).
The flow is the following:
create a prepare select statement
execute the select statement
create a prepare update statement
execute the update statement
at this point I get an
java.sql.SQLException: Connection handle is not currently associated with a ManagedConnection
The application is cashing the lookup so the next time when the sequence is executed I'm reusing the same ConnectionFactory.
This is nondeterministic. Why do I get this exception?
Is this all in one method? If so, I have never seen this happen, can you provide an example using hsqldb?
If not, I recommend obtaining the connection handle in each method call. Caching the connection factory should always work, caching the connection won't work without changing some settings.