Does Spring's JdbcTemplate close the connection after query timeout?
In short yes it does close the connection. The long answer it depends.
When you don't have a Spring managed transaction then yes the JdbcTemplate
will call the close()
method on the Connection
. However if there was already a connection available due to Springs transaction management closing the connection will be handled by Springs transaction support, which in turn also will call close()
on the Connection
.
The only difference is when the connection is closed but close()
will be called.
If the connection will be actually closed depends on which DataSource
is used, in general when using a connection pool the connection will be returned to the pool instead of actually closing the connection.
Yes it does.
And if the connection was obtained from connection pool, it won't actually close the connection, rather will send it back to the pool.
No need to close the connection manually. Spring container itself to take of the operation. Kindly refer this spring url,
http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html