On 30-3-2012 14:24, Norman Dunbar wrote: >> Extensive use of prepared statements and variables > Yes, and I'll bet they do what every Java application I've seen does, > prepares the same statement hundreds of times, even though they should > do it only once.
I disagree, the application (or application developer) should do that (preparing statements every time it needs it). It is the driver and/or connection pool that should keep a pool of prepared statements (see section 11.6 of JDBC 4.1) for reuse. The application (and its developer) should not be bothered with keeping track of prepared statements. > See > http://qdosmsq.dunbar-it.co.uk/blog/2009/02/it-must-be-efficient-im-using-bind-variables/ > for details. :-) Interesting read. However keeping track of connections and statements as part of your application makes it more complex and puts responsibilities in your application that don't belong there. It also duplicates what connection pools (including statement pools) could be doing for you. Mark -- Mark Rotteveel
