Testing using HSQL DB in Spring - cached PreparedStatement error

Viewed 23

Our backend app is Spring/Java based batch server. Our backend db is Oracle.

I am writing unit tests to use HSQL DB instead of Oracle. I inserted some test data and running Select query on it. Its not using any parameters.

Using a 'NamedJDBCTemplate', I call the 'query(String sql, RowCallBackHandler rch)' method to run the query and read results.

I get the error

org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL.... SQL state [null]; error code [0]; A problem occurred while trying to acquire a cached PreparedStatement in a background thread.; nested exception is java.sql.SQLException: A problem occurred while trying to acquire a cached PreparedStatement in a background thread

I wonder is this because of some config settings.. My settings are below

hibernate.hbm2ddl.auto=create hibernate.connection.driver_class=org.hsqldb.jdbc.JDBCDriver hibernate.connection.url=jdbc:hsqldb:mem:mers;sql.syntax_ora=true hibernate.connection.username=mers hibernate.connection.password=mers hibernate.dialect=org.hibernate.dialect.HSQLDialect hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy hibernate.cache.use_query_cache=false hibernate.c3p0.minPoolSize=3 hibernate.c3p0.maxPoolSize=25 hibernate.c3p0.timeout=300 #hibernate.c3p0.maxStatements=50000 hibernate.c3p0.maxStatements=50000 #hibernate.c3p0.maxStatementsPerConnection=1000 hibernate.c3p0.maxStatementsPerConnection=1000 hibernate.c3p0.idleConnectionTestPeriod=1800 hibernate.c3p0.acquireIncrement=3 hibernate.cache.provider_class= hibernate.cache.use_second_level_cache=false hibernate.event.merge.entity_copy_observer=allow showSql=true

Any leads what could be causing it ? Is it because of 'prepared statement caching' ?

0 Answers
Related