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 > Writing stored procedure in C

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-13-06, 00:43
sundaram sundaram is offline
Registered User
 
Join Date: Mar 2006
Posts: 104
Writing stored procedure in C

Hi,

We use DB2 7.2.9 on windows 2000 platform.
we are after some good reference giving sample codes for writing stored procedures in C.

Thanks in advance

Harikumar

Last edited by sundaram; 07-13-06 at 00:52.
Reply With Quote
  #2 (permalink)  
Old 07-13-06, 06:59
singhipst singhipst is offline
Registered User
 
Join Date: Jul 2006
Location: Bangalore
Posts: 57
you can write store procedures in C and java also.
just write a procedue in c and crete its dll file.
Then copy this dll file and put it following path

C:\Program Files\IBM\SQLLIB\FUNCTION

C is your drive where you have installed DB2

Now after this create wrapper
Ex.
if your dll file name is abc.dll then

CREATE procedure abc(<Arguments>)
RETURNS <return data type>
NOT FENCED
RETURNS NULL ON NULL INPUT
NO SQL
DBINFO
EXTERNAL ACTION
LANGUAGE C
PARAMETER STYLE DB2SQL
EXTERNAL NAME 'abc!abc';

then it will install procedure in your database and when you call that procedure it will internaly call that procedure which is written in C.
__________________
Ritesh Kumar Singh
IBM Certified DB2 DBA for LUW
**Knowledge Is Theft If Not Shared !!**
Reply With Quote
  #3 (permalink)  
Old 07-13-06, 18:21
sundaram sundaram is offline
Registered User
 
Join Date: Mar 2006
Posts: 104
Thanks very much for that Ritesh. We are also after some sample codes and refrence for this. Any good reference for this (Db2 7.2 & Windows).

Regards

Harikumar
Reply With Quote
  #4 (permalink)  
Old 07-13-06, 20:06
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Have you checked sqllib/samples directory
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 07-13-06, 20:30
sundaram sundaram is offline
Registered User
 
Join Date: Mar 2006
Posts: 104
Checked Sathyaram. Not much, there. We are after some sample code that manipulate LOBs and also after some guidlines as to do's and don't. We are quite inexperienced in this area.

Regards

Harikumar
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