Jump to content
We've recently updated our Privacy Statement, available here ×

Execption: ResultSet is closed


Recommended Posts

By: Peter Sch. - peter136

Execption: ResultSet is closed

2003-04-27 09:17

Hello,

 

when trying the following source-code, I get: "java.sql.SQLException: ResultSet is closed

"

can anybody help?

 

 

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";

String connectString = "jdbc:odbc:jasper_demo";

String user = "myuser";

String password = "mypass";

 

 

Class.forName(driver);

Connection conn = DriverManager.getConnection(connectString, user, password);

 

 

Map parameters = new HashMap();

parameters.put("ReportTitle", "WebappReport_ProWide");

parameters.put("BaseDir", reportFile.getParentFile());

parameters.put("FilterClause", "'2002'");

 

byte[] bytes =

JasperRunManager.runReportToPdf(

reportFile.getPath(),

parameters,

conn

);

 

 

my XML-FILE:

 

<parameter name="ReportTitle" class="java.lang.String"/>

<parameter name="FilterClause" class="java.lang.String"/>

<queryString><![CDATA[sELECT umsatz.id AS id, umsatz.id_monat AS id_monat, umsatz.id_periode AS id_periode, umsatz.jahr AS jahr, umsatz.umsatz AS umsatz FROM jasper_demo.umsatz WHERE jahr=( $P!{FilterClause} ) ]]></queryString>

<field name="id" class="java.lang.Integer"/>

<field name="id_monat" class="java.lang.Integer"/>

<field name="id_periode" class="java.lang.Integer"/>

<field name="jahr" class="java.lang.Integer"/>

<field name="umsatz" class="java.lang.Double"/>

 

 

 

 

By: Victor Gieci - drummer

RE: Execption: ResultSet is closed

2003-04-27 23:15

Hello, I've experienced the same problem using odbc & mssql 2000. After tracking back the jasper reports sources, I've found the place where the result set is closed. Since I immediatelly needed to run the reports, I just did a quick hack and commented out the "rs.close()" line in dori.jasper.engine.fill.JRBaseFiller class. Ever since that time it works well. Of course, this is no long-run solution and I guess I'll spend more time with this in the future. I just took a brief look into j2ee spec and found the following line: "A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results". So, I hope this hack does no harm...

 

 

 

 

By: ethon smith - ethon

RE: Execption: ResultSet is closed

2003-04-28 20:12

Yes, it does work!!!!

Thanks.

 

 

 

 

 

By: Victor Gieci - drummer

RE: Execption: ResultSet is closed

2003-04-27 23:08

Hello, I've experienced the same problem using odbc & mssql 2000. After tracking back the jasper reports sources, I've found the place where the result set is closed. Since I immediatelly needed to run the reports, I just did a quick hack and commented out the "rs.close()" line in dori.jasper.engine.fill.JRBaseFiller class. Ever since that time it works well. Of course, this is no long-run solution and I guess I'll spend more time with this in the future. I just took a brief look into j2ee spec and found the following line: "A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results". So, I hope this hack does no harm...

 

 

 

 

By: Teodor Danciu - teodord

RE: Execption: ResultSet is closed

2003-04-29 13:25

 

Hi,

 

This is a bug that is present in the 0.4.5 version.

There is a patch provided for it in the "Patches"

area at sourceforge.net.

 

This patch is now included in the 0.4.6 version.

 

Thank you,

Teodor

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...