If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > How can I get the return value in JDBC use a store procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-28-06, 22:57
sunnysea sunnysea is offline
Registered User
 
Join Date: Apr 2006
Posts: 1
Angry 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
Reply With Quote
  #2 (permalink)  
Old 04-29-06, 15:45
gurey gurey is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On