【发布时间】:2019-07-14 09:26:47
【问题描述】:
我应该关闭连接还是 Spring 会处理它?
@Autowired
MyRepository myRepository;
@Autowired
@Qualifier("myJdbc")
JdbcTemplate myJdbc;
@GetMapping("/v1/controlla-abilitazione")
public Set<String> controlloAbilitazione() {
try {
Connection conn = myJdbc.getDataSource().getConnection();
//Here I use previous connection to call an oracle PL/SQL via basic oracle jdbc
//Should I close connection?
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
(我知道我可以使用 Spring 来处理 PL/SQL,但是 Spring 没有原生支持 Oracle Type 作为从 PL/SQL 返回)
【问题讨论】:
-
是的,在这种情况下你应该关闭连接。
标签: oracle spring-boot spring-data-jpa ojdbc