May 15th, 2007, 01:55 PM
JdbcTemplate Connection Management in MyIsam tables
Please correct me if I am wrong, but when the
JdbcTemplate is used in Spring, in a non-transactional environment (without the Spring Transaction Manager),
then "each time" an operation is invoked, such as
queryForInt, it opens a new connection, executes the statement,
and then closes the statement and connection. Is this correct?
Hence, if some service calls queryForInt multiple times, that's three
database connections opened and closed.
If the Spring Transaction Manager is used, it recognizes that
the operation is part of a transaction, and re-uses the same connection,
by checking if the call is within the same thread, or something along
that line. Kind of magical, but nice if that is that what it does.
But what I am really wondering, is how does this type of resource
management occur in a non-transational situation, such as when
using MyIsam non-transactional databases?
I don't want a new connection each time. Does the Spring Transaction
Manager at least manage the JdbcConnections properly in that situation?
Maybe I am getting this all wrong. Oddly enough, transaction management
is generally considered an advanced topic, but I am finding that
developing without transactions is even MORE DIFFICULT!
Any sense of direction would be greatly appreciated