Do I need to explicitly manage database resources when using the Spring Framework .. like to close all open connections, etc.
I read that Spring frees the developer from such coding of boiler tables ...
This is the answer to the error I get in the Spring web application:
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to get JDBC connection; nested The exception is java.sql.SQLException: ORA-00020: maximum number of processes (150) exceeded
jdbcTemplateconfigured in the xml file, and the DAO implementation has a link to this jdbcTemplatebean, which is used to query the database.
jdbcTemplate
Spring Framework, , ..?
Spring, JbdcTemplate, Spring , , .
, ( applicationContext.xml), ( , ?), -. , : destroy-method="close", ? - :
destroy-method="close"
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
destroy .
. spring? JdbcTemplate ? spring?
, Spring
Spring, . JdbcTemplate , fire-and-forget, - JDBC (, , ..). , getConnection(), - releaseConnection().
JdbcTemplate
getConnection()
releaseConnection()
ORA-00020: (150)
? , , , ( 150). , .
: "jdbcTemplate XML ". jdbcTemplate , spring.
, , jdbcTemplate bean spring, , , , spring applicationContext, .
20 . db. destory-method bean ( " " ), requst. (: JdbcDaoSupport dao).
public void cleanUp() { try { if (!this.getJdbcTemplate().getDataSource().getConnection().isClosed()) { this.getJdbcTemplate().getDataSource().getConnection().close(); } } catch (Exception e) { Logger.getLogger(myDAOImpl.class.getName()).log(Level.SEVERE, null, e); } }
Source: https://habr.com/ru/post/1732475/More articles:Dynamic forms in zend? - dynamicDateTime in RFC-1123 gives inaccurate timezone - c #href tag for link placement - javascriptAn explanation of how stacks work in C - cПочему gcc не работает с "непризнанной опцией командной строки" -L/lusr/opt/mpfr-2.4.2/lib? '? - cOracle data source data pool pooling not working with Spring and JDBCTemplate - javaGood documentation / book about the future - javaHow to compare execution paths in .NET? - c #Add text to image - textThe Basics of Converting Nullable Values to a Nullable Type - c # -3.0All Articles