0
大家好!
我有一个应用程序,它使用spring 3和hibernate 3进行配置。应用程序使用JDBCTemplate和HibernateTemplate对数据库进行的所有请求。在我的情况下,我有一种方法,其记录一个数组参数:上jdbcTemplate.getDataSource暂停调用方法jdbcTemplate.getDataSource()
protected void registerArrayParameter(PreparedStatement st, int num, Long[] mas) throws SQLException {
Connection conn = jdbcTemplate.getDataSource().getConnection();
OracleConnection ocon = (OracleConnection) ((DelegatingConnection) conn).getInnermostDelegate();
ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor("CCSYS.NUMBER_TABLE", ocon);
java.sql.Array sqlArray = new oracle.sql.ARRAY(arrayDescriptor, ocon, mas);
st.setArray(num, sqlArray);
}
通常应用暂停(冻结)()的getConnection()。
有人可以知道它是什么吗?
感谢您的回复。
不要执行'jdbcTemplate.getDataSource()。getConnection()',因为这会请求在事务管理之外的连接。在它超时之前它将保持打开状态。在某些时候,您的连接池将耗尽,导致应用程序暂停/冻结。 –
你使用Java 1.6.0_29吗? – isah
isah,我正在使用jdk1.6.0_24 – bito4ek