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 > DB2 > Java syntax to Call a sproc in DB2 OS/390

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-24-04, 13:02
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
Java syntax to Call a sproc in DB2 OS/390

Any Java developers out there that have called a sproc on the mainframe?

Any comments welcome.

Thanks
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
  #2 (permalink)  
Old 02-26-04, 11:12
tschiereck tschiereck is offline
Registered User
 
Join Date: Feb 2004
Posts: 9
Re: Java syntax to Call a sproc in DB2 OS/390

Brett,

Here are the basics.

// Load JDBC driver
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").ne wInstance() ;
// Get database connection
Connection connDB2 = DriverManager.getConnection
("jdbc:db2:database","username", "pwd");


//
CallableStatement cs = connDB2.prepareCall("{CALL schema.spname(?,?,?,?,?)}");

// Register your out parameters
cs.registerOutParameter(1, Types.INTEGER);
cs.registerOutParameter(2, Types.CHAR,70);
cs.registerOutParameter(3, Types.CHAR,5);
cs.registerOutParameter(4, Types.CHAR,50);

// set your in parameters
cs.setLong(5, Long.parseLong(iIdx));
// execute it.
cs.execute();

Quote:
Originally posted by Brett Kaiser
Any Java developers out there that have called a sproc on the mainframe?

Any comments welcome.

Thanks
Reply With Quote
  #3 (permalink)  
Old 02-26-04, 11:18
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
Hey,

Thanks a bunch...

Another question

Anyone doing INTERNAL stored procedures on OS/390...

Looked around in my shop (through the catalogs) and NOBODY is using INTERNAL

They're all external


Also, what's the point of external?

Still gotta write a COBOL (or whatever) program anyway...

AND I noticed that only INTERAL sprocs are stored in the database in sysroutines_src..
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
  #4 (permalink)  
Old 02-26-04, 13:39
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
All Non SQL Stored Procs are EXTERNAL ...

Have a look at the CREATE PROCEDURE Statement which says LANGUAGE SQL

HTH

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 02-26-04, 14:18
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
Quote:
Originally posted by sathyaram_s
All Non SQL Stored Procs are EXTERNAL ...

Have a look at the CREATE PROCEDURE Statement which says LANGUAGE SQL

HTH

Sathyaram
Yeas, I know...I go tthat far...I've create the INTERnAL Sproc...

The devloper is just trying to call it...

Does anyone use INTERNAL Sprocs though?

They seem quite painful....
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
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