From: Johannsen, C. <cjo...@re...> - 2003-03-21 17:22:08
|
>| Don't think there's any reason, just no one has needed to do that yet. >My comment has nothing to do with MockConnection, but usually it is >better for database performance if you use prepared statements, at least >if there are variable parameters. >(At least some) databases cache statements execution plans and use the >string statement as key for the plan - this doesn't work with changing >parameters in every execute. Even worse, as the database cache is >limited in size, it may be that ad hoc statements even make prepared >statements flush from the cache. >(On the other hand, perfect reasons for adhoc statements exist, just >wanted to share this thought) I agree,and normally use PreparedStatements (if for nothing else than the type conversion for Strings), but in this case I'm dealing with code someone else has written, that I cannot alter (for a variety of reasons). There are certainly performance tradeoffs between Statement and PreparedStatement, but I normally find PreparedStatements more useable, even if they are generally slower (and require more round-trips to the database). Cory |