dbTalk Databases Forums  

fetching stored procedure return code in JDBC

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss fetching stored procedure return code in JDBC in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
hsn_
 
Posts: n/a

Default fetching stored procedure return code in JDBC - 08-28-2010 , 01:18 PM






Stored procedures can return result code which is distinct from OUT
parameters. Example:
db2 => call postgres.tpcbprofile(1,1,1,15)

Stav při návratu = 540

Is there way to get this return code via JDBC API?

Reply With Quote
  #2  
Old   
joeNOSPAM@bea.com
 
Posts: n/a

Default Re: fetching stored procedure return code in JDBC - 08-30-2010 , 09:48 AM






On Aug 28, 11:18Â*am, hsn_ <kolar.ra... (AT) gmail (DOT) com> wrote:
Quote:
Stored procedures can return result code which is distinct from OUT
parameters. Example:
db2 => call postgres.tpcbprofile(1,1,1,15)

Stav při návratu = 540

Is there way to get this return code via JDBC API?
Hi, I'm typing this from memory, before I've fully woken up,
so do check the details of the syntax, but this is close...

CallableStatement cs = c.prepareCall("{ ? :=
postgres.tpcbprofile(1,1,1,15) }");
cs.registerOutParameter(1, INT );
cs.execute();
int foo = cs.getInt(1);

Joe Weinstein

Reply With Quote
  #3  
Old   
joeNOSPAM@bea.com
 
Posts: n/a

Default Re: fetching stored procedure return code in JDBC - 08-30-2010 , 12:58 PM



On Aug 30, 7:48Â*am, "joeNOS... (AT) bea (DOT) com" <joe.weinst... (AT) gmail (DOT) com>
wrote:
Quote:
On Aug 28, 11:18Â*am, hsn_ <kolar.ra... (AT) gmail (DOT) com> wrote:

Stored procedures can return result code which is distinct from OUT
parameters. Example:
db2 => call postgres.tpcbprofile(1,1,1,15)

Stav při návratu = 540

Is there way to get this return code via JDBC API?

Hi, I'm typing this from memory, before I've fully woken up,
so do check the details of the syntax, but this is close...

CallableStatement cs = c.prepareCall("{ ? :=
postgres.tpcbprofile(1,1,1,15) }");
cs.registerOutParameter(1, INT );
cs.execute();
int foo = cs.getInt(1);

Joe Weinstein
It's
CallableStatement cs = c.prepareCall("{ ? =
postgres.tpcbprofile(1,1,1,15) }");
cs.registerOutParameter(1, java.sql.Types.INTEGER );
cs.execute();
// first process any 'inline' returns first, such as update counts and
resultsets, if any
// Then:
int foo = cs.getInt(1);

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.