This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes urgent help needed!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "urgent help needed!!" Watch "urgent help needed!!" New topic

urgent help needed!!

arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
i have logservlet. I have this connection object, retrieving data from database. This connection object has autocommit=false I am able to display the rows in my System.out.println within while loop. I am setting the resultset obtained from this retrieval into session and passing onto jsp. But I am not able to display the rows from this resultset.
I guess but not sure this is because my statement object is autocommit=false.
when i take out autocommit=false from the statement object, i get error
"ResultSet not open, operation next not permitted. Verify that autocommit is OFF"
way i am creating my statement object is:
Connection connect1 = DriverManager.getConnection("jdbc:cloudscape:c:/cloudscape/onlineshop;autocommit=false");
/* code */
ResultSet choicebookresult = null;
/* code */
Statement stmtchoice = connect1.createStatement();
choicebookresult = stmtchoice.executeQuery(querychoice);
String author = null;
String bookname = null;
author = choicebookresult.getString("AUTHOR");
bookname = choicebookresult.getString("BOOKNAME");
System.out.println(" the bookname " + bookname);
System.out.println(" the author " + author);
/* code */

kvk kishore

Joined: Sep 27, 2001
Posts: 12
arpit ,
Why don't you pass Hashtable or Vector in place of resultset . Or try the Service to Worker Model .

Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

It's kind of problematic to pass a resultset to a JSP page, and you've discovered why.

Resultsets cannot be removed from their connection. So when you pass a resultset to a JSP you've sort of done that. The connection didn't move along with it.

I agree. Here's the link:
subject: urgent help needed!!
It's not a secret anymore!