I’m trying to invoke some C++ code in case a trigger is called inside my db2 DB.
to do so i thought of compiling the C++ code to an executable and to run it as a system call from DB2.
ps: I’m new to DB in general.
thanks in advance !
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you want to use a DB2 system call:
http://www.ibm.com/developerworks/data/library/techarticle/0303stolze/0303stolze.html
EDIT:
Specifically, it appears that you could just re-use the system call solution referenced in the “Making system calls” section to call an arbitrary command from your trigger:
http://www.ibm.com/developerworks/data/library/techarticle/0303stolze/0303stolze.html#section5
Generally, the from the docs I gather that you will need to call an external UDF (User Defined Function) from your trigger. The UDF itself defines the call to your external program and needs to be created and configured in such a way that DB2 will recognize it.
Here’s a PDF that covers UDFs is some detail. The “External UDFs” section on page 453 might be useful.
http://www.redbooks.ibm.com/redbooks/pdfs/sg246503.pdf
This article may also be helpful. It shows a solution for integrating a Java function as a UDF to be called from a trigger.
http://www.ibm.com/developerworks/data/library/techarticle/0205bhogal/0205bhogal.html#download