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 > Passing cursor Into SQL SP With JDBC

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-26-07, 02:29
Craig Kemple Craig Kemple is offline
Registered User
 
Join Date: Apr 2005
Posts: 2
Passing cursor Into SQL SP With JDBC

Does anyone know, if there is a way to pass a cursor into a DB2 SQL stored procedure, (DB2 v8.1)?

A cursor is originally obtained from a JDBC call to a SQL stored procedure. The Java application making the JDBC call contains the decisioning logic to determine if the rows in the cursor/ResultSet need additional processing. The additional processing is done for all rows in the cursor. if the procesing is required, the cursor needs to be passed into a seperate SP that does the processing.
Reply With Quote
  #2 (permalink)  
Old 02-26-07, 13:08
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
That is not (yet) supported. You will have to fetch all rows from the cusor, write the data into another table, and then call the SP. The SP has to access the table to retrieve the data that way.

However, the real question is why you want to fetch the rows from the server, process them at the client, and send them back instead of simply doing the whole prossing at the server. You would avoid a network round trip.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 02-27-07, 11:17
Craig Kemple Craig Kemple is offline
Registered User
 
Join Date: Apr 2005
Posts: 2
Thank you for your reply! The lack of any liturature explaining how to do so, hinted at the fact that it was not supported. But, I could not find anything explicitely saying so. Thanks for confirming!

We have also considered temporary tables.

Why? We are begining to explore the use of a rules engine to provide a variety of decoupled services. The services can be declaritively chained together. However, a challenge was how to let one service know what records the predecessor service has modified.
Reply With Quote
  #4 (permalink)  
Old 02-28-07, 14:51
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Quote:
Originally Posted by Craig Kemple
Why? We are begining to explore the use of a rules engine to provide a variety of decoupled services. The services can be declaritively chained together. However, a challenge was how to let one service know what records the predecessor service has modified.
One thing that you could consider is to wrap the rules engine and its services in stored procedures themselves. Then you can possibly just pass ids around, or have the rules engines work on the same table. Or you could use nested result sets, i.e. use objects that are a result set and operate on another result set to do filtering or whatever.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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