This content has been marked as final.
Show 1 reply
-
1. Re: Cache PreparedStatement objects?
jonlee May 26, 2003 7:43 PM (in response to mjremijan)Not really. PreparedStatements exist only in the context of a particular open connection instance - it is bound to a particular connection. Therefore, you could achieve your aims through a set of stateless session beans who lock and maintain their own JDBC connection. Or you could build, I suppose, your own PreparedStatement pool and MBean controller that initialises a particular PreparedStatement and its own connection, delivering that to the requester.
There are problems from a DB resource perspective since it holds resource for each instance of the precompiled statement, where the DBMS supports compiled statements - some do not and in this case PreparedStatement is a less efficient method for committing data.