I am trying to run jasper reports against a live and reporting database, but any reports running against live databases throw an exception due to the lack of proper tables (although the default PUBLIC scheme is found). It seems that the main DataSource connection does not match the settings for the H2 connection, which indicate IGNORECASE=true , since the generated columns and tables are header, are not my queries.
DataSource.groovy dataSource:
dataSource { hibernate { cache.use_second_level_cache = false cache.use_query_cache = false } dbCreate = "create-drop" // one of 'create', 'create-drop','update' pooled = true driverClassName = "org.h2.Driver" username = "sa" password = "" url = "jdbc:h2:mem:testDb;MODE=PostgreSQL;IGNORECASE=TRUE;DATABASE_TO_UPPER=false" jndiName = null dialect = null }
Datasources.groovy dataSource:
datasource(name: 'reporting') { environments(['development', 'test']) domainClasses([SomeClass]) readOnly(false) driverClassName('org.h2.Driver') url('jdbc:h2:mem:testReportingDb;MODE=PostgreSQL;IGNORECASE=TRUE;DATABASE_TO_UPPER=false') username('sa') password('') dbCreate('create-drop') logSql(false) dialect(null) pooled(true) hibernate { cache { use_second_level_cache(false) use_query_cache(false) } } }
What fails:
JasperPrint print = JasperFillManager.fillReport(compiledReport, params,dataSource.getConnection())
During debugging, the only difference I found is that the live dataSource when entering or searching using DatasourcesUtils.getDataSource(null) is TransactionAwareDatasourceProxy , and DatasourcesUtils.getDataSource('reporting') is BasicDataSource
What do I need to do for Jasper to work with an active database in H2 memory?
This error does not reproduce in the real postgres database.
source share