1 Reply Latest reply on May 26, 2003 7:43 PM by jonlee

    Cache PreparedStatement objects?

    mjremijan

      Hi all:

      Can jboss have a pool of PreparedStatement objects the way it has Connection pools?

      Mike

        • 1. Re: Cache PreparedStatement objects?
          jonlee

          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.