java.sql.SQLException: ResultSet is closed
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Giuseppe_JSP
Posted On:   Friday, September 26, 2003 02:45 AM

Hi, I have a web application with a jsp page which has a grid generated by reading a table. For each row of this table I read from others to complete data. Application almost always works, but sometimes rows aren't loaded and I receive the message: java.sql.SQLException: ResultSet is closed I'm using SQLServer. Tell me if anyone knows the problem This is my code in JSP page try { DataTap source = DataTapFactory.getDataSourceAccessor (dbType, url, username, password, driverName); Collection detail= source.getPBSDetail((String)request.getSession().getAttribute("PBSNAME")); Iterator iter = detail.iterator(); rowsFetched=detail.size();    More>>

Hi,
I have a web application with a jsp page which has a grid generated by reading a table.
For each row of this table I read from others to complete data.
Application almost always works, but sometimes rows aren't loaded and I receive the message:
java.sql.SQLException: ResultSet is closed
I'm using SQLServer.
Tell me if anyone knows the problem
This is my code in JSP page

try
{
DataTap source = DataTapFactory.getDataSourceAccessor
(dbType, url, username, password, driverName);
Collection detail= source.getPBSDetail((String)request.getSession().getAttribute("PBSNAME"));
Iterator iter = detail.iterator();
rowsFetched=detail.size();
request.getSession().setAttribute("ROWS",""+rowsFetched);
String data[][] = new String[detail.size()+1][ini.colPBS()+10];
int row=0;
for (int k=0;k <=12;k++) {Totali[k]=0;}
while(iter.hasNext()){
PBSDetail d = (PBSDetail)iter.next();

............

try {
DataTap sourceEndexm = DataTapFactory.getDataSourceAccessor
(dbType, url, username, password, driverName);
if (end==11) {qualify="JR";}
if (end==12) {qualify="SR";}
if (end==13) {qualify="MG";}
Collection endexm=
sourceEndexm.getEndEstimation((String)request.getSession().getAttribute("PBSNAME"),
d.getlev1(),d.getlev2(),d.getlev3(),d.getlev4(),qualify);
Iterator iterEndexm = endexm.iterator();
while(iterEndexm.hasNext()){
EndEstimation ee = (EndEstimation)iterEndexm.next();
data[row][end]= String.valueOf(ee.getEndexm());
if (data[row][end].equals(null)) {data[row][end]="0.0";}
}}

catch (Exception e){
e.printStackTrace();
}
}

..........

catch (Exception e){
e.printStackTrace();
}



instead here below one of methods I call from JSP page in my DataAccessObject:

............
public Collection getPBSDetail(String PBS) {
Collection results = new ArrayList();
final String GET_PBSDETAIL = "Select * from PBSDTTBL WHERE PBS='" + PBS +
"'" +
" ORDER BY NOMELEV1,NOMELEV2,NOMELEV3,NOMELEV4";
Connection con = _connectionPool.getConnection();
try {
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(GET_PBSDETAIL);
System.out.println(GET_PBSDETAIL);
while (rs.next()) {
PBSDetail detail = new PBSDetail(rs.getString(1), rs.getString(2),
rs.getString(3), rs.getString(4),
rs.getString(5),
Double.parseDouble(rs.getString(6)),
Double.parseDouble(rs.getString(7)),
Double.parseDouble(rs.getString(8)));
results.add(detail);

}
stmt.close();
_connectionPool.closeConnection(con);
con.close();
}
catch (SQLException ex) {
System.out.println(ex);
}
finally {
try {
stmt.close();
con.close();
}
catch (SQLException ex2) {
System.out.println(ex2);
}
}
return results;
}
...............

(I have of course a PBSDetail class)

Do you think that's OK to do so?
Thanks bye

   <<Less
About | Sitemap | Contact