javax.servlet.ServletException: General error


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: javax.servlet.ServletException: General error

  1. #1
    Join Date
    Sep 2005
    Posts
    39

    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">
    <tr>
    <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>
    </tr>
    <%
    while (rs.next())




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

    out.println("+rs.getInt("claimNo")+"</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>");



    %>


    </table>

    <% 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 09:43 AM. Reason: Added invalid cursor state to the subject. The subject was too vague

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

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

    Code:
     String sql = "SELECT patient.FName,patient.LName, patientClaim.claimNo,
    claim.claimNo, claim.submittedDate,"
    
    ...
    
     out.println("+rs.getInt("claimNo")+"</td>");
    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:

    Code:
    ...
    out.println("+rs.getInt(3)+"</td>");
    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, 12:32 PM
  2. Returning errors from SQL Server Stored Procs
    By Khalizan in forum VB Classic
    Replies: 1
    Last Post: 11-28-2001, 02:32 AM
  3. No Backwards Fetching
    By Brian in forum VB Classic
    Replies: 3
    Last Post: 01-07-2001, 06:14 PM
  4. WinForm Compile Error
    By Robert in forum .NET
    Replies: 1
    Last Post: 10-24-2000, 12:38 PM
  5. Replies: 0
    Last Post: 04-07-2000, 10: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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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