We are using the JRC to display reports in our software. We are running jboss-4.2.0 as our application server. The backend could be either SQL Server or Oracle. For Oracle we are using the oracle.jdbc.driver.OracleDriver driver. The reports are set up using a JDBC (JNDI) connection. Generally we have it working ok but in Oracle the JRC is leaving open cursors leading to ORA-01000: MAXIMUM OPEN CURSORS EXCEEDED. I have found that a new cursor is opened when the data source is changed in the following code snippet
Iterator tableIT = tableNames.iterator();
while (tableIT.hasNext()) {
ITable oldTable = (ITable)tableIT.next();
ITable table = (ITable) ((IClone)oldTable).clone(true);
table.setQualifiedName(table.getName());
clientDoc.getDatabaseController().setTableLocation(oldTable, table);
}
When we hit the last line in this loop, a new cursor is opened in Oracle so if a report has 10 tables, I get 10 cursors opened. I know that I need to close the cursors somehow but nothing I do seems to make a difference. After my processHttpRequest call to the viewer I added:
crystalReportPageViewer.getReportSource().dispose(); clientDoc.getReportSource().dispose();
The code definately executes but the the number of open cursors in Oracle does not change. I am at a loss.