DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005

    javax.servlet.ServletException: General error - invalid cursor state

    I have an SQL statement that is returning a ResultSet and looping through rows in the database.

    I've run the SQL in the database and it works perfectly, but when I run it on the browser, I am getting the following message:
    javax.servlet.ServletException: General error

    The code is as follows:
    String sql = "SELECT patient.FName,patient.LName, patientClaim.claimNo, claim.claimNo, claim.submittedDate,"
    +"claim.totalCost, claim.SOB_ID, claim.visitID, claimStatus.statusID, status.StatusName,"
    +"employee.employeeID, SOB.claimType FROM SOB, status, employee, claim, patient, employeeClaim ,"
    +"claimStatus, patientClaim WHERE patient.patientID = patientClaim.patientID AND claim.claimNo = patientClaim.claimNo"
    +"AND claim.claimNo = employeeClaim.claimNo AND employeeClaim.employeeID = employee.employeeID AND"
    +" patientClaim.claimNo = claimStatus.claimNo AND claim.claimNo = claimStatus.claimNo AND status.statusID = claimStatus.statusID AND"
    +" SOB.SOB_ID = claim.SOB_ID AND status.StatusName='Pending' AND employeeClaim.employeeID =9;";

    Statement stmt =con.createStatement();
    ResultSet rs = stmt.executeQuery(sql);


    <table border = "1" align = "center">
    <th> Claim No </th>
    <th> Submitted Date</th>
    <th> Total Cost </th>
    <th> Date of Symptoms</th>
    <th> Claim Status</th>
    <th> Patient Name</th>
    while (rs.next())

    out.println("<tr> <td>");


    out.println("<td>"+rs.getDate("submittedDate") +"</td>");

    out.println("<td>"+rs.getInt("totalCost") +"</td>");

    out.println("<td>"+rs.getDate("dateOfSymptoms") +"</td>");

    out.println("<td>"+rs.getString("statusName") +"</td>");

    out.print("<td>"+rs.getString("FName")+ "</td></tr>");



    <% rs.close(); %>

    If I change the line with the out.println("claimNo") I get an error message of invalid cursor state.

    Can anyone kindly suggest a way out of this problem.
    PS. I have run a simpler sql statement such as select * from claim and I got the same error message.
    Last edited by Maria Modeste; 10-11-2005 at 08:43 AM. Reason: Added invalid cursor state to the subject. The subject was too vague

  2. #2
    Join Date
    Sep 2005
    Does anyone out there know how to fix this?

  3. #3
    Join Date
    Oct 2005
    Superior, CO, USA
    I'm not sure how to fix it exactly but I can point out at least one issue:

     String sql = "SELECT patient.FName,patient.LName, patientClaim.claimNo,
    claim.claimNo, claim.submittedDate,"
    Right away, which claimNo should JDBC get out of the ResultSet - you have patientClaim.claimNo and claim.claimNo? You may be better off using the integer version of the ResultSet get methods than the String version. For example, maybe you'd instead like something like:

    out.println("<td>"+rs.getDate(4) +"</td>");
    though you can mix and match the integer versions and the string versions.

Similar Threads

  1. 'On Error Goto' versus 'Try, Catch, Fail'
    By clarence_rollins in forum .NET
    Replies: 21
    Last Post: 09-11-2002, 11:32 AM
  2. Returning errors from SQL Server Stored Procs
    By Khalizan in forum VB Classic
    Replies: 1
    Last Post: 11-28-2001, 01:32 AM
  3. No Backwards Fetching
    By Brian in forum VB Classic
    Replies: 3
    Last Post: 01-07-2001, 05:14 PM
  4. WinForm Compile Error
    By Robert in forum .NET
    Replies: 1
    Last Post: 10-24-2000, 11:38 AM
  5. Replies: 0
    Last Post: 04-07-2000, 09:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.