Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    1

    Unanswered: how to access print / raiseerror messages from a sybase stored procs in JDBC/Jconnect

    how to access print / raiseerror messages from a sybase stored procs in JDBC/Jconnect.

    I have a stored procedure which would return a resultset if the execution is sucessfull , but if it fails then it would not return any resultsets(this can be achived by using stmt.getUpdateCount()),
    but how can I get the print and raise error messages in my java class.

    this is what I am using
    --------------------------------------------------------
    stmt = conn.createStatement();
    boolean bolExecute = stmt.execute(sqlStatement);

    SQLWarning warn = conn.getWarnings();
    while (warn != null){
    logger.debug("Conn Warning::SQLState=" + warn.getMessage());
    warn = warn.getNextWarning();
    }

    retValue = stmt.getUpdateCount();
    warn = stmt.getWarnings();
    while (warn != null){
    logger.debug("STMT Warning::SQLState=" + warn.getMessage());
    warn = warn.getNextWarning();
    }

    logger.debug("CreateFKClientTransactionBean::-->stmt.getUpdateCount=="+retValue );
    if (retValue > 0)
    {
    ResultSet results = stmt.getResultSet();
    warn = stmt.getWarnings();
    while (warn != null)
    {
    logger.debug("ResultSet Warning::SQLState=" + warn.getMessage());
    warn = warn.getNextWarning();
    }

    retValue =0;
    if (results!=null){
    retValue = BuildResultArray(results);
    }
    }
    else {
    retValue = 0;
    }
    --------------------------------------------------------

  2. #2
    Join Date
    Oct 2003
    Posts
    1
    I posted some code that I used to capture print messages presented by sp_showplan. I was trying to understand metadata info from jconnect, then SybaseServer class have a lot of stuff to work with this. But I think it could help ... Trying to "catch" print messages was not a good experience ...
    Attached Files Attached Files

Posting Permissions

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