By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,934 Members | 1,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,934 IT Pros & Developers. It's quick & easy.

DB2 UDF calling external application

P: n/a
Group.. We are running on db2 UDF V8 on Sun solaris platform. I
created an UDF which calles a C-routine(SQL_API_FN). This C-routine in
turn calls an external C-function. The C-function is provided to us by
a vendor(PCMILER application). The C-Function does the following
operations- Open the server,get distance between two points and close
the server. It takes two input parameters(points).
Whenever I call UDF via select statement it always retrieves 1. On
further analysis it is not able to open the server.
The function is working fine when I called through a C program.
When I contacted the vendor, they said DB2 is not able to load
pcmiler libraries during run time because we use setuid in the bldrtn
script. So I copied all pcmiler libraries to /usr/lib and reexecuted
the udf..Still no luck. The server was not able to open & the udf
always returns 1.
Has any one overcome this issue while calling external applications
via udf. What needs to be done to load external application libraries
to db2 during run time.Any help is greatly appreciated.
Thanks
Siva
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Do you know for certain that the UDF failed to load? If that's the case
one of the dependent libraries might still not be accessable...as a
'quick test' for this you could change the owner of your
sqllib/adm/.fenced file to be the instance owner, recycle the instance,
and try to run the UDF (make sure you switch back the owner after your
test).

If the load works when run as the instance owner, then you'll need to
figure out what library remains inacessable (doesn't have read access to
other).

Sivakumar Shanmugam wrote:
Group.. We are running on db2 UDF V8 on Sun solaris platform. I
created an UDF which calles a C-routine(SQL_API_FN). This C-routine in
turn calls an external C-function. The C-function is provided to us by
a vendor(PCMILER application). The C-Function does the following
operations- Open the server,get distance between two points and close
the server. It takes two input parameters(points).
Whenever I call UDF via select statement it always retrieves 1. On
further analysis it is not able to open the server.
The function is working fine when I called through a C program.
When I contacted the vendor, they said DB2 is not able to load
pcmiler libraries during run time because we use setuid in the bldrtn
script. So I copied all pcmiler libraries to /usr/lib and reexecuted
the udf..Still no luck. The server was not able to open & the udf
always returns 1.
Has any one overcome this issue while calling external applications
via udf. What needs to be done to load external application libraries
to db2 during run time.Any help is greatly appreciated.
Thanks
Siva

Nov 12 '05 #2

P: n/a
Hi Sean..Thanks.. Well I tried this method..Still no luck. It always
retrieves 1 only. Since I created pcmiler program as a C program and
linked it's object code in buildrtn program.. Does the bldrtn takes
care on loading pcmiler library files..Thanks.
~ Siva

Sean McKeough <mc******@nospam.ca.ibm.com> wrote in message news:<bt**********@hanover.torolab.ibm.com>...
Do you know for certain that the UDF failed to load? If that's the case
one of the dependent libraries might still not be accessable...as a
'quick test' for this you could change the owner of your
sqllib/adm/.fenced file to be the instance owner, recycle the instance,
and try to run the UDF (make sure you switch back the owner after your
test).

If the load works when run as the instance owner, then you'll need to
figure out what library remains inacessable (doesn't have read access to
other).

Sivakumar Shanmugam wrote:
Group.. We are running on db2 UDF V8 on Sun solaris platform. I
created an UDF which calles a C-routine(SQL_API_FN). This C-routine in
turn calls an external C-function. The C-function is provided to us by
a vendor(PCMILER application). The C-Function does the following
operations- Open the server,get distance between two points and close
the server. It takes two input parameters(points).
Whenever I call UDF via select statement it always retrieves 1. On
further analysis it is not able to open the server.
The function is working fine when I called through a C program.
When I contacted the vendor, they said DB2 is not able to load
pcmiler libraries during run time because we use setuid in the bldrtn
script. So I copied all pcmiler libraries to /usr/lib and reexecuted
the udf..Still no luck. The server was not able to open & the udf
always returns 1.
Has any one overcome this issue while calling external applications
via udf. What needs to be done to load external application libraries
to db2 during run time.Any help is greatly appreciated.
Thanks
Siva

Nov 12 '05 #3

P: n/a
Sivakumar Shanmugam <js*********@hotmail.com> wrote:
Hi Sean..Thanks.. Well I tried this method..Still no luck. It always
retrieves 1 only. Since I created pcmiler program as a C program and
linked it's object code in buildrtn program.. Does the bldrtn takes
care on loading pcmiler library files..Thanks.
~ Siva


Hi Siva,

Hazve you already tried what I wrote in my mail yesterday, i.e. fixing the C
function signature of UDF?

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #4

P: n/a
I agree with Knut...most likely there is some other problem (not library
loading, maybe the signature).

Sivakumar Shanmugam wrote:
Hi Sean..Thanks.. Well I tried this method..Still no luck. It always
retrieves 1 only. Since I created pcmiler program as a C program and
linked it's object code in buildrtn program.. Does the bldrtn takes
care on loading pcmiler library files..Thanks.
~ Siva

Sean McKeough <mc******@nospam.ca.ibm.com> wrote in message news:<bt**********@hanover.torolab.ibm.com>...
Do you know for certain that the UDF failed to load? If that's the case
one of the dependent libraries might still not be accessable...as a
'quick test' for this you could change the owner of your
sqllib/adm/.fenced file to be the instance owner, recycle the instance,
and try to run the UDF (make sure you switch back the owner after your
test).

If the load works when run as the instance owner, then you'll need to
figure out what library remains inacessable (doesn't have read access to
other).

Sivakumar Shanmugam wrote:

Group.. We are running on db2 UDF V8 on Sun solaris platform. I
created an UDF which calles a C-routine(SQL_API_FN). This C-routine in
turn calls an external C-function. The C-function is provided to us by
a vendor(PCMILER application). The C-Function does the following
operations- Open the server,get distance between two points and close
the server. It takes two input parameters(points).
Whenever I call UDF via select statement it always retrieves 1. On
further analysis it is not able to open the server.
The function is working fine when I called through a C program.
When I contacted the vendor, they said DB2 is not able to load
pcmiler libraries during run time because we use setuid in the bldrtn
script. So I copied all pcmiler libraries to /usr/lib and reexecuted
the udf..Still no luck. The server was not able to open & the udf
always returns 1.
Has any one overcome this issue while calling external applications
via udf. What needs to be done to load external application libraries
to db2 during run time.Any help is greatly appreciated.
Thanks
Siva

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.