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

    Cache PreparedStatement objects?

    Michael Remijan Newbie

      Hi all:

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


        • 1. Re: Cache PreparedStatement objects?
          Jon Barnett Master

          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.