Reputation: 946
I am using Spring Boot and Spring Data (jbdctemplate
, NamedParameterJdbcTemplate
) to develop a web service and a pool of connections.
Like JdbcTemplate
and NamedParameterJdbcTemplate
open and close the connection in each one of the lines in the pool automatically it is great (the pool only is user when the system does an query). On the other hand, when I use the SimpleJdbcCall
to call an stored procedure I have to use the word new
:
objSimpleJdbcCall = new SimpleJdbcCall(this.objJdbcTemplate.getDataSource()).withSchemaName(strSchema).withProcedureName(strProcedmiento);
Because of this the system generates one connection in each request (There are not closed even when the objSimpleJdbcCall
variable in the method is killed when it terminates) and the pool begins to increase connections.
Does someone know how to close the connection in the SimpleJdbcCall
? or how to use a stored procedure of other way without using the word new.
Upvotes: 4
Views: 4731
Reputation: 11
If you are using jdbcTemplateObject.getDataSource().getConnection()
to get connection, please don't use this. Commenting this line before calling new SimpleJdbcCall(jdbcTemplateObject).withProcedureName()
solved connections leakage problem.
Upvotes: 1