Subject PreparedStatement caching and Connection Pools
Author Robert DiFalco
Message
Is there a way to share a prepared statement across connections? I guess my problem is that I use a connection pool. Currently, my transaction object encapsulates a connection and a hashmap of prepared statements. Before preparing a new statement, I see if it has already been created in "this" transaction. The problem is that I get preparation benefits only when I repeat many of the same actions in a single transaction.
 
The only alternative I could think of is preparing all my statements in all my pooled connections so that each has a prepared statement library. However, this seems overkill. Does JayBird have some functionality that might help me here or are there standard patterns for solving this kind of problem?
 
TIA!
 
R.