๐๐ SPRING CERTIFICATION QUESTION: When does the JDBC template acquire (and release) a connection ๐ - for every method called or once per template?
๐๐ SPRING CERTIFICATION QUESTION: When does the JDBC template acquire (and release) a connection ๐ - for every method called or once per template?
Answer:
๐๐๐๐๐๐๐ฆ๐ฉ๐ฅ๐๐ญ๐ acquires and releases connection of each called method.
๐๐๐๐๐๐๐ฆ๐ฉ๐ฅ๐๐ญ๐ source code confirms that (look at ๐๐๐๐๐๐๐ฆ๐ฉ๐ฅ๐๐ญ๐#๐๐ฑ๐๐๐ฎ๐ญ๐ ).
This connection acquiring/releasing strategy is used to minimize connection holding time allowing other clients to utilize free connections.
#spring #certificationquestion #vcp
๐งโ๐ป JdbcTemplate source code ๐ https://github.com/spring-projects/spring-framework/blob/main/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java