Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why I am getting ResutlSet is close error? Help!!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi

From some reasons I am getting ResouldSet is close error in JRun 3 when I running jsp page which is calling one method in bean class file. Help !

here is 1 line that is calling been from jsp page.

while (rs.next())
{
..............
............
.....
details = db.catdetails(catid); //here crashes i don't know why!!
..........
....
}

and here is my been method that extract forum category infos.
. Please help i have spend 2 week trying to figure out what is wrong wit it,
and why i am getting Record Set close exception. THANK YOU VERY MUCH!!

public String[] catdetails (int id) throws SQLException
{
//Creating array to hold all the details for the category record
String[] details = new String[3];

Statement sstmt = con.createStatement();

//Query for total toppics for this category
rs = sstmt.executeQuery("SELECT COUNT(*) AS Topics FROM Thread WHERE ID_category="+id+"");

//Retriving the value of query from result set
if (rs.next())
{
details[0] = rs.getString(1);
}


//Query for date of last message posted and it's creator.
rs = sstmt.executeQuery("SELECT * FROM Message AS m1 WHERE m1.Date IN (SELECT MAX(m2.DATE) FROM Message m2 WHERE m2.ID_thread IN (SELECT ID_thread FROM Thread WHERE id_category="+id+"))");

if (rs.next())
{
//details[1] = (rs.getDate("Date")).toString();
details[1] = rs.getString("Date");
details[2] = rs.getString("User_ID");
}

return details;
}
 
I'm a bit confused regarding wat you are trying to do. In the method catdetails you have declared the ResultSet object as rs which is again declared outside the method and from there you are trying to call the method

while (rs.next())
{
..............
............
.....
details = db.catdetails(catid); //here crashes i don't know why!!
..........
....

Wish you luck,
pri...
}

try out a different name for resultset object like rs1,rs3,.. etc.

while (rs3.next())
{
...

 
I'm a bit confused regarding wat you are trying to do. In the method catdetails you have declared the ResultSet object as rs which is again declared outside the method and from there you are trying to call the method

while (rs.next())
{
..............
............
.....
details = db.catdetails(catid); //here crashes i don't know why!!
..........
....

}

try out a different name for resultset object like rs1,rs3,.. etc.

while (rs3.next())
{
...


Wish you luck,
pri...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top