Cursor statement in forms

hi all,
i have cursor like
cursor b_details_E is select company,orgport,disport,agent,shipper
                            from b_details
                            where type = 'Export'
                            and status = 'SEA';
begin
for i in  b_details_E
loop
text_io.put_line(output,i.company);
text_io.put_line(output,i.orgport);
text_io.put_line(output,i.disport);
text_io.put_line(output,i.agent);
text_io.put_line(output,i.shipper);
end loop;
this cursor is for export
for import
cursor b_details_I is select company,orgport,disport,agent,shipper
                            from b_details
                            where type = 'Import'
                            and status = 'SEA';
i the form level i have givin type as parameter(list item)
so it should be 'export' or 'import' at a timemy question is, i have to call the cursor b_details_E is the selection is export and it should be b_details_I if user select as import.
is it possible to call the cursor based upon the selection?
or i should write seperate loop for the import once again as i mentioned for exports.
please help me..

hi,
sorry i forgot it inform one more condition
i have one more condition like(for exports)
trunc(b_eta) between :from_date and :to_date
for imports the above condition should be
trunc(b_etd) between :from_date and :to_date
how to change this?
Thanks..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Invalid cursor state error

    Hello everyone i am building a database/web page application using Dreamweaver 8 that allows sudents to report computer issues. The submitting works fine it stores all information to the databse my problem now is updating the database to show a problem has been fixed. I can get the website to pull up current records using but when i click on the lik that should redirect the user to the update form which pulls up the record that the user clicked on i get this error:
    exception
    org.apache.jasper.JasperException: Exception in JSP: /updateIssue.jsp:151
    148:   <table align="center">
    149:     <tr valign="baseline">
    150:       <td nowrap align="right">Cpu:</td>
    151:       <td><input type="text" name="cpu" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    152:       </td>
    153:     </tr>
    154:     <tr valign="baseline">
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] Invalid cursor state
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.updateIssue_jsp._jspService(updateIssue_jsp.java:284)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
         sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
         sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
         sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getObject(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getObject(Unknown Source)
         org.apache.jsp.updateIssue_jsp._jspService(updateIssue_jsp.java:226)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    My code for the page is:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
    <%@ include file="Connections/db.jsp" %>
    <%
    // *** Edit Operations: declare variables
    // set the form action variable
    String MM_editAction = request.getRequestURI();
    if (request.getQueryString() != null && request.getQueryString().length() > 0) {
      String queryString = request.getQueryString();
      String tempStr = "";
      for (int i=0; i < queryString.length(); i++) {
        if (queryString.charAt(i) == '<') tempStr = tempStr + "<";
        else if (queryString.charAt(i) == '>') tempStr = tempStr + ">";
        else if (queryString.charAt(i) == '"') tempStr = tempStr +  """;
        else tempStr = tempStr + queryString.charAt(i);
      MM_editAction += "?" + tempStr;
    // connection information
    String MM_editDriver = null, MM_editConnection = null, MM_editUserName = null, MM_editPassword = null;
    // redirect information
    String MM_editRedirectUrl = null;
    // query string to execute
    StringBuffer MM_editQuery = null;
    // boolean to abort record edit
    boolean MM_abortEdit = false;
    // table information
    String MM_editTable = null, MM_editColumn = null, MM_recordId = null;
    // form field information
    String[] MM_fields = null, MM_columns = null;
    %>
    <%
    // *** Update Record: set variables
    if (request.getParameter("MM_update") != null &&
        request.getParameter("MM_update").toString().equals("form1") &&
        request.getParameter("MM_recordId") != null) {
      MM_editDriver     = MM_db_DRIVER;
      MM_editConnection = MM_db_STRING;
      MM_editUserName   = MM_db_USERNAME;
      MM_editPassword   = MM_db_PASSWORD;
      MM_editTable  = "issue";
      MM_editColumn = "cpu";
      MM_recordId   = "'" + request.getParameter("MM_recordId") + "'";
      MM_editRedirectUrl = "COBA_home.html";
      String MM_fieldsStr = "cpu|value|issue|value|comment|value|issue_Date|value|Fixed|value";
      String MM_columnsStr = "cpu|',none,''|issue|',none,''|comment|',none,''|issue_Date|',none,''|Fixed|',none,''";
      // create the MM_fields and MM_columns arrays
      java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_fieldsStr,"|");
      MM_fields = new String[tokens.countTokens()];
      for (int i=0; tokens.hasMoreTokens(); i++) MM_fields[i] = tokens.nextToken();
      tokens = new java.util.StringTokenizer(MM_columnsStr,"|");
      MM_columns = new String[tokens.countTokens()];
      for (int i=0; tokens.hasMoreTokens(); i++) MM_columns[i] = tokens.nextToken();
      // set the form values
      for (int i=0; i+1 < MM_fields.length; i+=2) {
        MM_fields[i+1] = ((request.getParameter(MM_fields)!=null)?(String)request.getParameter(MM_fields[i]):"");
    // append the query string to the redirect URL
    if (MM_editRedirectUrl.length() != 0 && request.getQueryString() != null) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + request.getQueryString();
    %>
    <%
    // *** Update Record: construct a sql update statement and execute it
    if (request.getParameter("MM_update") != null &&
    request.getParameter("MM_recordId") != null) {
    // create the update sql statement
    MM_editQuery = new StringBuffer("update ").append(MM_editTable).append(" set ");
    for (int i=0; i+1 < MM_fields.length; i+=2) {
    String formVal = MM_fields[i+1];
    String elem;
    java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_columns[i+1],",");
    String delim = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
    String altVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
    String emptyVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
    if (formVal.length() == 0) {
    formVal = emptyVal;
    } else {
    if (altVal.length() != 0) {
    formVal = altVal;
    } else if (delim.compareTo("'") == 0) {  // escape quotes
    StringBuffer escQuotes = new StringBuffer(formVal);
    for (int j=0; j < escQuotes.length(); j++)
    if (escQuotes.charAt(j) == '\'') escQuotes.insert(j++,'\'');
    formVal = "'" + escQuotes + "'";
    } else {
    formVal = delim + formVal + delim;
    MM_editQuery.append((i!=0)?",":"").append(MM_columns[i]).append(" = ").append(formVal);
    MM_editQuery.append(" where ").append(MM_editColumn).append(" = ").append(MM_recordId);
    if (!MM_abortEdit) {
    // finish the sql and execute it
    Driver MM_driver = (Driver)Class.forName(MM_editDriver).newInstance();
    Connection MM_connection = DriverManager.getConnection(MM_editConnection,MM_editUserName,MM_editPassword);
    PreparedStatement MM_editStatement = MM_connection.prepareStatement(MM_editQuery.toString());
    MM_editStatement.executeUpdate();
    MM_connection.close();
    // redirect with URL parameters
    if (MM_editRedirectUrl.length() != 0) {
    response.sendRedirect(response.encodeRedirectURL(MM_editRedirectUrl));
    return;
    %>
    <%
    String IssueUpdate__MMColParam = "1";
    if (request.getParameter("cpu") !=null) {IssueUpdate__MMColParam = (String)request.getParameter("cpu");}
    %>
    <%
    Driver DriverIssueUpdate = (Driver)Class.forName(MM_db_DRIVER).newInstance();
    Connection ConnIssueUpdate = DriverManager.getConnection(MM_db_STRING,MM_db_USERNAME,MM_db_PASSWORD);
    PreparedStatement StatementIssueUpdate = ConnIssueUpdate.prepareStatement("SELECT * FROM issue WHERE cpu = '" + IssueUpdate__MMColParam + "' ORDER BY Fixed ASC");
    ResultSet IssueUpdate = StatementIssueUpdate.executeQuery();
    boolean IssueUpdate_isEmpty = !IssueUpdate.next();
    boolean IssueUpdate_hasData = !IssueUpdate_isEmpty;
    Object IssueUpdate_data;
    int IssueUpdate_numRows = 0;
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form method="post" action="<%=MM_editAction%>" name="form1">
    <table align="center">
    <tr valign="baseline">
    <td nowrap align="right">Cpu:</td>
    <td><input type="text" name="cpu" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Issue:</td>
    <td><input type="text" name="issue" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("issue"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr>
    <td nowrap align="right" valign="top">Comment:</td>
    <td valign="baseline"><textarea name="comment" cols="50" rows="5"><%=(((IssueUpdate_data = IssueUpdate.getObject("comment"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%></textarea>
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Issue_Date:</td>
    <td><input type="text" name="issue_Date" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("issue_Date"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Fixed:</td>
    <td><input type="text" name="Fixed" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("Fixed"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right"> </td>
    <td><input type="submit" value="Update record">
    </td>
    </tr>
    </table>
    <input type="hidden" name="MM_update" value="form1">
    <input type="hidden" name="MM_recordId" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>">
    </form>
    <p> </p>
    </body>
    </html>
    <%
    IssueUpdate.close();
    StatementIssueUpdate.close();
    ConnIssueUpdate.close();
    %>
    Any idea as to what I have done wrong because I am very confused right now. Thank you so much in advance for any help or advice

    I am confused as well.
    It would help if your data layer was separate from your display layer.
    The error suggests that you are attempting to extract a result from a update. And that won't work with a standard update.
    Where that is happening I have no idea.

  • Invalid Cursor state Exception  -  Help required

    Hi,
    I'm having a web page(JSP), which is making use of 3 ResultSet objects. Using the first two, i'll populate two different Drop down list, with values from database(Access) while loading the page for first time.
    Now if the user select any value from any (or both) of drop down list and clicks submit, i need to display all values in database, meeting the criteria from first & second drop down list. For this selection, i'm using the third ResultSet variable. While executing the query, i'm sure that 3rd ResultSet is returning some value. But when i try to retrieve the value to a string variable, i'm getting the Invalid cursor state exception.
    Throughout the page, i haven't closed any of the ResultSet. When i closed the first and second ResultSets in the third function(where 3rd ResultSet is used), i'm not getting any value. Its returning like ResultSet closed.
    Please help me to get this solved. It's very urgent because without this, i cannot proceed further. Please share your ideas.
    Thanks in advace for your valuable help

    If you open a new resultset within the same statement, all previously opened will be closed.
    Read the API docs, luke.

  • Invalid cursor state when trying to insert record

    Hi everyone!
    I'm using JDBC-ODBC bridge to connect to a mySql database, which works fine. Then I try to insert new records, but this only works for the first record in the table.
    When there is already a record in the table, I always get "[Microsoft][ODBC Driver Manager] Invalid cursor state" when calling the updateRow()-method of the result set.
    Here is my code:            // open db connection
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection conn = DriverManager.getConnection("jdbc:odbc:TTManager", "xxxx", "xxxx");
                // Prepare SQL statement
                java.sql.Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                ResultSet result = stmt.executeQuery("SELECT * FROM Player");
                result.moveToInsertRow();Then all fields are filled in this manner:            result.updateString("Name", name);And finally the insertRow should be written to the db:            result.insertRow();But at this point it gives the mentioned error, including these messages:         at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(JdbcOdbcResultSet.java:5272)
            at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:4132)Since I'm very unexperienced with Java, I guess (or hope^^) it's just some stupid beginner's mistake.
    Oh, almost forgot to mention: The new record's data doesn't violate any unique-constraints on the table, all fields are explicitely filled and all variable's data types are matching their according field types!
    Any help would be appreciated!
    reinski

    Ok, I needed to help myself and this is what I found out:
    If the table already contains records, it is not enough to doresult.moveToInsertRow();but I must beresult.last();
    result.moveToInsertRow();I didn't find any explanation and even the code examples from the Sun tutorial don't mention this, so I guess it's a bug occurring in my poor IT environment: DB server running mySQL 5.0.0-alpha on a P1-233-MMX w/ 64MB under WinNT4 (hey don't laugh!!^^).
    Maybe this information is of use to someone having similar problems...
    Greetings!
    reinski

  • "Invalid Cursor" Error in Form

    Hi,
    I wrote a procedure that take a REF CURSOR as an IN OUT argument. This procedure does an "OPEN cursor FOR qry" with a dynamic query:
    OPEN l_cursor FOR
           'SELECT A '||
             'FROM B '||
            'WHERE C = :l_var'
         USING myVar;After calling the procedure, I do a LOOP with FETCH.
    It works well when I use it in SQL*Plus with DBMS_OUTPUT but it returns a "ORA-01001 invalid cursor" error in Forms.
    Any help is welcome!
    Regards,
    Olivier.

    I found a solution on Metalink:
    Note:170881.1
    Note: 1007395.6
    Olivier.

  • Need Help ASAP  my State tax form is in a PDF file and the attachment in my email says Please wait

    Need Help ASAP  my State tax form is in a PDF file and the attachment in my email says Please wait...
    I tried downloading updates like it said to but it still will not display the document.  How do I print the PDF file ASAP

    Can you give us a LOT more info?
    What email client? What version of Reader (I can only assume you even have Reader at this point)?
    Please wait? I'm sure it says more than that, right?
    Have you tried simply saving the PDF (it IS a PDF correct?) to your desktop and opening it from there?
    Did you get this form from the IRS or did it come from somewhere else? If the IRS again, what version of Reader?
    Help us help you.

  • Invalid Cursor State

    Hi all,
    i was using SAPB0 2007A 42Patches, try to use AP Purchase Order and AP Goods Receipt PO together add serial numbers for Item facing this error as below:
    [Goods Receipt PO - Rows - Warehouse Code][line: 1], '1).[Microsoft][SQL Native Client]Invalid cursor state 'Serial Numbers for Items' (OSRI)'
    [Purchase Order - Rows - Warehouse Code][line: 1], '1).[Microsoft][SQL Native Client]Invalid cursor state 'Serial Numbers for Items' (OSRI)'
    Can i have the solution from anyone?
    Thank you.
    Best Regards,
    danny

    Hi all,
    I know the caused of it.
    Because i have created triggers on these 2 table and on Serial Table.
    But why so strange, i have triggers on it and nothing error like this before this scenario happened.
    Cheers,
    danny ng

  • Invalid cursor state error while executing the prepared statement

    hai friends,
    following code showing the invalid cursor state error while executing the second prepared statement.
    pls anyone help me
    String query = "select * from order_particulars where order_no=" + orderno + " order by sno";             psmt1 = conEntry.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);             rs1 = psmt1.executeQuery();             rs1.last();             intRowCount = rs1.getRow();             particularsdata = new Object[intRowCount][6];             rs1.beforeFirst();             if (intRowCount >= 1) {                 for (int i = 0; rs1.next(); i++) {                     particularsdata[0] = i + 1;
    particularsdata[i][1] = rs1.getString(3);
    particularsdata[i][2] = Double.parseDouble(rs1.getString(4));
    rs1.close();
    psmt1.close();
    query = "SELECT sum(delqty) FROM billdetails,billparticulars WHERE order_no= " + orderno + " and " +
    "billdetails.bill_no = billparticulars.bill_no GROUP BY particulars ORDER BY sno";
    psmt1 = conEntry.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    rs1 = psmt1.executeQuery(); //error showing while executing this line

    Also .. Why using arrays instead of collections? Shifting the cursor all the way forth and back to get the count is fairly terrible.
    With regard to the problem: either there's a nasty bug in the JDBC driver used, or you actually aren't running the compiled class version of the posted code.

  • Need help with **** Invalid Cursor State ****

    Hi,
    can someone tell me why am i getting this error....
    //******java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    Any help is greatly appreciated.....
    Thanks in advance.
    //***********this is the output on servlet side**************//
    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.3
    Starting service Tomcat-Apache
    Apache Tomcat/4.0.3
    init
    DBServlet init: Start
    DataAccessor init: Start
    Accessor init: Loading Database Driver: sun.jdbc.odbc.JdbcOdbcDriver
    DataAccessor init: Getting a connection to - jdbc:odbc:SCANODBC
    username SYSDBA
    password masterkey
    DataAccessor init: Preparing searchPolicy
    DataAccessor init: Prepared policySearch
    DataAccessor init: Prepared ssnSearch
    DataAccessor init: End
    After the myDataAccessor
    Database Connection...
    in doGet(...)
    SSSSSSSGetpolicynumber
    In GetPolicyInformation
    b05015195
    Getting Policy Informaton for = b05015195
    okay, building vector for policy
    in GetPolicyInformation for = b05015195
    starting query... policy Information
    finishing query... Policy Information
    Inside the while(next) loop
    sun.jdbc.odbc.JdbcOdbcResultSet@4db06e
    sun.jdbc.odbc.JdbcOdbcResultSet@4db06e
    b05015195
    policy information constructor with resultset
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3266)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:
    5398)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:326)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:383)
    at viewscreenappletservlet.policyinformation.<init>(policyinformation.ja
    va:56)
    at viewscreenappletservlet.DatabaseAccessor.getPolicyInformation(Databas
    eAccessor.java:145)
    at viewscreenappletservlet.Servlet.policyDisplay(Servlet.java:108)
    at viewscreenappletservlet.Servlet.doGet(Servlet.java:91)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
    et.java:446)
    at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
    :180)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:475)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
    468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
    r.java:1012)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
    va:1107)
    at java.lang.Thread.run(Thread.java:484)
    result set closed
    1
    sending response
    Sending policy vector to applet...
    Data transmission complete.

    1) JDBC-ODBC driver is buggy
    2) Some drivers (truly speaking most of them) doesn't
    support cursors or supports them in a wrong way
    Paul

  • JDBC Sender Adapter : java.sql.SQLException: Cursor state not valid.

    Hello all,
    We have configured JDBC Sender Adapter which fetches around 10K records with poll interval 1hr  from DB2 System .
    It was working fine,suddenly it started throwing an exception in Adapter Monitoring :
    Error during conversion of query result to XML: java.sql.SQLException: Cursor state not valid.
    It is not fetching any records.
    Without changing any configurations when we tried to fetch to around 1000 records it's working fine.
    For 10K records same exception persists
    What could be the reason ?How to resolve this issue?
    regards
    GangaPrasad

    Hello Christophe ,
    Trace in VA :::
    Date : 05/09/2008
    Time : 11:45:57:750
    Message : Unexpected error converting database resultset to XML, reason: java.sql.SQLException: Cursor state not valid.
         at java.lang.Throwable.<init>(Throwable.java:194)
         at java.lang.Exception.<init>(Exception.java:41)
         at java.sql.SQLException.<init>(SQLException.java:40)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
         at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
         at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
         at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:309)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
         at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
         at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
         at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
    Severity : Error
    Category : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
    Location : com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(ResultSet, ResultSetMetaData)
    Application :
    Thread : XI JDBC2XI[JDBC_SND_DB2_VehicleReceiving/DB2PRD00/]_170
    Datasource : 12428950:/usr/sap/PXI/DVEBMGS01/j2ee/cluster/server0/log/applications/com.sap.xi/xi.log
    Message ID : 00145E742794005E0014980B000000BE00044CC763766C4F
    Source Name : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
    Argument Objs : java.sql.SQLException: Cursor state not valid.
         at java.lang.Throwable.<init>(Throwable.java:194)
         at java.lang.Exception.<init>(Exception.java:41)
         at java.sql.SQLException.<init>(SQLException.java:40)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
         at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
         at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
         at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:309)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
         at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
         at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
         at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
    Arguments : java.sql.SQLException: Cursor state not valid.
         at java.lang.Throwable.<init>(Throwable.java:194)
         at java.lang.Exception.<init>(Exception.java:41)
         at java.sql.SQLException.<init>(SQLException.java:40)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
         at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
         at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
         at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:309)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
         at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
         at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
         at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
    Dsr Component :
    Dsr Transaction : d1f629d01d9b11dd984200145e742794
    Dsr User :
    Indent : 0
    Level : 0
    Message Code :
    Message Type : 1
    Relatives : com.sap.aii.adapter.jdbc.JDBC2XI
    Resource Bundlename :
    Session : 0
    Source : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
    ThreadObject : XI JDBC2XI[JDBC_SND_DB2_VehicleReceiving/DB2PRD00/]_170
    Transaction : SAP J2EE Engine JTA Transaction : [0ffffffbdffffffa6ffffff960086]
    User : J2EE_GUEST
    Regards
    Ganga Prasad

  • What is an invalid cursor state exception?

    exception caught in webmaster servlet java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    any ideas? this is the first time i've seen this one.

    For example you tried to read the next record from a result set when you had already read the last record. But you might get better results from a specific question.

  • SQLException, invalid cursor state

    Came across the weirdest thing... Suppose i use this statement in a servlet:
    ResultSet result = statement.executeQuery("SELECT City FROM Destinations");and the following code in the JSP to which the browser is redirected:
    <select name="selectedCity" value="" size="1">
    <% ResultSet result = (ResultSet) session.getAttribute("rstCity");
    while (result.next()) { %>
         <option><%= result.getString(1) %>
    <% } %>
    </select>This works properly in my case. (Don't think other code is necessary to provide... please tell me you think it is..)
    But because result is full of duplicate rows, i want to change the line into:
    ResultSet result = statement.executeQuery("SELECT DISTINCT City FROM Destinations");A ServletException and SQLException message in the browser (at index.jsp, not servlet/servletname!) both say [Micrisoft][ODBC Driver Manager]Invalid Cursor State...
    Now if i (temporarily) remove the expression <%= result.getString(1) %> in the JSP file, the error no longer appears. Ofcourse the listbox <select> is now filled with about 100 empty <option>s...
    I can't locate the problem this way, can't see any logic in this. It seems like by adding DISTINCT in the SQL statement, the JSP file cannot handle the getString function anymore.
    Can anyone help me with this invalid cursor state thing?
    Thanks!!

    Peter,
    I'm getting the same problem with this:
    String sql = "SELECT DISTINCTROW collectedwho FROM steps WHERE status = 'overdue finish' AND escalatedwho = " + util.sqlEsc(username) + " ORDER BY collectedwho";
    recordset rs = new recordset();
    rs.open(sql);
    while (rs.rs.next()) {
    accountable = rs.rs.getString("collectedwho");
    (recordset is simply my own wrapper for the ResultSet class, which hides the db connection string and saves me rewriting it every time)
    What happens is that the loop falls off the end of the resultset but thinks that it hasn't, ie rs.next() returns true, but there's no data when it gets to the getString and it throws an "Invalid cursor state".
    Bummer.
    I'm using the JDBC:ODBC bridge to an access database, by the way.
    I tried changing DISTINCT to to DISTINCTROW which then worked with no errors but of course gave me the wrong results in the ResultSet!
    Is this a bug in the bridge, or in the ResultSet class?
    Sorry this isn't much help but at least you know you're not the only one!
    David

  • How to close open cursors in a forms app

    All,
    I'm not a forms developer. I'm a database administrator so I'm asking this question from that perspective. I know nothing about forms development.
    We have several forms applications that appear to hold many SELECT cursors open when they run. I've asked my forms developers about this and they are giving me the idea that they don't have much control over this. I have no idea myself so I'm asking here.
    When one issues selects from a form, do those selects remain as open cursors while the form runs? Is it possible to close those select cursors from within the form so that the application does not keep so many cursors open simultaneously?
    I am typically seeing a forms application with 70-100 open cursors. And we have hundreds of end users each running the forms application which is causing a lot of problems with the sheer number of open cursors.
    I've already bumped the database OPEN_CURSORS parameter but it's my feeling that developers should be doing a better job of closing cursors from within the form.
    Can anyone give me some guidance here or point me to some documents that describe how to reduce the number of open cursors to the database from a forms app?
    Thanks,

    There are several ways Forms use cursors. In the standard default method, users enter a query where condition and then execute the query. This process opens a cursor on the server, and the form fetches a few (20 or so) rows and displays on the screen (in a base-table "block"). If the user scrolls down, more rows are fetched from the cursor. This can go on and on if the user keeps scrolling down through the data. I am not sure when the cursor gets closed -- there is no Forms command to close this one. Only closing the form, or else re-executing the query process would close such a cursor.
    In the PL/SQL code, where the developer has control, a cursor can be opened, rows fetched, and then closed. This can be done either with Open-Fetch-Close or in a For... Loop. The developer can explicitly close this cursor, or PL/SQL theoretically closes the cursor when the block of code is exited.
    There is of course the SQL Select into, but that only works in PL/SQL for single-row selects. I doubt this is a major problem.
    And finally, there are the record groups, where Forms runs the select to draw all the data into an array in the form. These should be closed automatically, I believe.
    Now... if you can determine which tables the cursors are remaining open, maybe your developers can zero in on the forms, and maybe clean up some things. However, I am doubtful much can be done. It seems to me that if the open cursors are causing some database sluggishness, then maybe adding more memory on the server is the best option.

  • How can I execute Dynamic SQL statement in Forms?

    Hi All,
    I have to execute dynamic SQL statement from Forms
    Below statement I have to execute
    "EXECUTE IMMEDIATE v_stmt INTO v_return;".
    Googled for the same got results saying, Better use Database function or procedures to execute these Dynamic Statements but We want to execute in forms only.
    Can any one help me..
    Thanks,
    Madhu

    So in short you are trading code obfuscation for maintainability and the ability to share code between tools? If from somewhere else you need a procedure already implemented in database PL/SQL (and now ported to forms) this would mean you'd need to implement it in every other tool. In times where you might want to integrate your forms with $other_technology and putting stuff on the database is the first step to share functionality you just go the opposite way? And all that because someone is afraid that somebody might steal your source code? I am sorry to be blunt, but this is just plain stupid.
    Leaving aside that some things like Analytic Functions, Bulk processing or execute immediate are not even available in forms your software consists of how many LOC? How long does it take to bring a new developer up to speed with your source code? Imagine how long that would take for a developer who doesn't have coleagues who know their way around.
    And just so you know: I work for a ISV selling a closed-source product as well. We have 200+ customers all over the planet. We are well aware that wrapped packages can be reverse engineered. The premise is: stored procedures can be reused in every tool we have, if it makes sense to put stuff on the database by all means do it. If someone would want to reverse engineer our software I'd wish him good luck as some parts are implemented in such a hilarious complicated way I have troubles understanding them (and quite frankly I refuse to understand certain parts, but that's another story). I do work for almost 10 years for that ISV.
    In any case the possible solutions have already been mentioned: you have exec_sql, create_group_from_query and forms_ddl to execute dynamic SQL in forms whereas forms_ddl is a one way street and most certainly not the thing you need or want. Take a look at the documentation for the other 2 things.
    cheers

  • Wisconsin State tax form

    I am trying to access the Wisconsin State tax form on Wisconsin.gov, and I am unable to access it. I installed the program that they suggest and it still doesn't come up. It is: 2013 Form 1A.

    Or configure your browser to use the Adobe PDF plugin: http://helpx.adobe.com/acrobat/kb/pdf-browser-plugin-configuration.html

Maybe you are looking for

  • How can I correct a file moved from music to audiobook ?

    I moved files from music to audiobooks. One audiobook has combined chapters 7 and 2 instead of creating two separate "books."  How can I split off one of those chapters into a separate book? I need to add that I have not figured out how to merge all

  • Time Machine backup on OSX Leopard Server, no user logged in

    Hi I'd like to use Time Machine to do backups of a Mini running OSX Leopard Server. It has a TimeCapsule connected, which it backs up to fine, at the moment. However, I've been wondering, if it still backs up, if no user is logged in? I've been readi

  • Why is Safari screen so large that I cannot use the close button?

    I've turned off zoom, but all my windows are opening so large that I've had to relocate the dock to the side because I cannot get to the "close" button.  What monster did this to me?  Mountain Lion 10.8.3?

  • My photo is awful in photoshop CC and alright in lightroom? WhY?

    When I'm in lightroom and ask to modify in photoshop CC the photo in photoshop is very awful and a lot of noise? I don't understand. It is happened after the new update. But I needed this update for my canon 7D mark2. what can I do now.. I also updat

  • Why installation was not completed

    My OS is WINXP_32bit SP3 (latest update installed: May, 2014). I installed the trial version of CS 6 and I also went online and visited the official website. However, after the installation, I received an information saying that some items of this pr