Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006
    Posts
    1

    Angry Unanswered: How can I get the return value in JDBC use a store procedure

    Informix: 7.3
    JDK: 1.3

    this is my code:

    Connection conn = getConnection() ; // connect to the informix db
    // my store procedure named authenUser , it has two input parameters,
    // and has one output parameter
    CallableStatement cstmt = conn.prepareCall("{ ? = call authenUser(?,?)}") ;
    cstmt.registerOutParameter(1,java.sql.Types.INTEGE R) ;
    // when I excute this code , throw an Exception "Function doesn't have an
    // output parameter or the output parameter doesn't returned".
    cstmt.setString(2,"username") ;
    cstmt.setString(3,"password") ;
    cstmt.execute() ;
    int a = cstmt.getInt(1) ;
    cstmt.close() ;
    conn.close() ;

    I want help ,who could tell me how to get return value when execute an informix store procedure that has return value ; thanks a lot ; if possible ,give me an example

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780
    Hi,
    Please look about ON EXCEPTION section and RAISE EXEPTION sintax.
    Ex: RAISE EXCEPTION -746, 0, 'You broke the rules';

    Gustavo.

Posting Permissions

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