Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    Winnipeg, Manitoba
    Posts
    5

    Unanswered: No error thrown to jconnect when stored proc fails

    Hi, first time poster.

    I am connecting up to ASA 7.0.4 (2789) using jconnect and executing the following:

    int newid = -1;
    conn = this.getConnection();
    conn.setAutoCommit(false);
    stmt = conn.createStatement();
    Log.logMessage("[Start] calling stored proc:\n" + sp.toString());
    rs = stmt.executeQuery(sp.toString());
    Log.logMessage("[End] calling stored proc:\n" + sp.toString());
    rs.next();
    if (rs.getInt("SP_STATUS") != 1) {
    conn.rollback();
    throw new DataDispatchSaveException("Stored procedure: " + sp.toString() + "returned an error code in SP_STATUS");
    } else {
    //the value of the id for this newly inserted record
    //in the stored proc, this is returned as @@identity after the insert statement executes
    newid = rs.getInt("order_id");
    }
    conn.commit();

    Now, the actual stored procedure call I am doing on the line that reads rs = stmt.executeQuery(sp.toString()); is:

    execute save_purchaseorder @status='New',@templateid=167,@storeid=62,@vendori d=274033,@promocode='00000',@createdby='CT',@updat edby='CT',@statuschangereason='Some Reason'

    Here is my problem, if I copy and paste that line into dbisql and execute it, I get the error stated in the attached image.

    However, when the java code above executes that statement, no error is reported!!! In fact, one of the fields passed back from the stored proc is the value of the identity field generated by the DB after the insert from within that stored proc executed, and it does actually pass back the value as if the record was inserted into the row without error.

    However, this is not the case!

    Anyway I can make sure I get errors back from jconnect the same way isql is reporting the failure?

    Thanks,

    Craig.
    Attached Thumbnails Attached Thumbnails asa-isql-err.jpg  

  2. #2
    Join Date
    Mar 2004
    Location
    Winnipeg, Manitoba
    Posts
    5
    *bump*

  3. #3
    Join Date
    Mar 2004
    Location
    Winnipeg, Manitoba
    Posts
    5
    *bump*

  4. #4
    Join Date
    Mar 2001
    Location
    Lexington, KY
    Posts
    606
    Thanks,

    Matt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •