Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2015
    Posts
    36
    Provided Answers: 2

    Answered: IBM xlc compiler for db2 systemcall

    In order to call shell scripts from DB2 I need to be able to do system calls as describe here
    http://www.ibm.com/developerworks/da...303stolze.html

    They describe how to compile the os_calls with ibm xlc
    The problem is that I cant find xlc compiler for linux rhel . They do provide xlc for linux on power but other architectures doesnt support this (RHEL for example).

    this is the base problem

    [db2fenc1@mlozdb3 ~]$ db2 "call systemCall ('/home/db2fenc1/test.sh', null)"
    SQL1646N A routine failed because the fenced user ID cannot access required
    files in the sqllib directory or other instance or database directories.

  2. Best Answer
    Posted by AntiLopa

    "missing component: "base application development tools"

    after I installed that I have my bldrtn in sqllib/samples/c/ and manage to build OS_CALLS"


  3. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    What are the OS permissions for the shared object containing your code for this SP?
    Can you provide the 'ls -l' output for this file?
    Regards,
    Mark.

  4. #3
    Join Date
    Nov 2015
    Posts
    36
    Provided Answers: 2
    Code:
    [>]# ll /home/db2fenc1/test.sh
    -rwxrwxrwx 1 db2fenc1 db2grp1 18 Dec  8 17:29 /home/db2fenc1/test.sh
    the code of the file is:
    Code:
    #!/bin/bash
    
    date
    I don'y believe it is a permission issue because I already changed most of the related files permissions to 755 / 777
    plus I dont have the os_calls.o file in sqllib/function so I believe this is the problem

  5. #4
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    ls -l ~${DB2INSTANCE}/sqllib/function/os_calls
    Regards,
    Mark.

  6. #5
    Join Date
    Nov 2015
    Posts
    36
    Provided Answers: 2
    this is the output

    Code:
    [>]# ll /home/db2inst1/sqllib/function/os_calls
    ls: cannot access /home/db2inst1/sqllib/function/os_calls: No such file or directory

  7. #6
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Why didn't you copy the shared library for your function to the ~${DB2INSTANCE}/sqllib/function directory?
    This file must appear in your current directory after the link step.
    If you source code file has a name os_calls.c, then it's expected that the shared library name would be os_calls.
    Regards,
    Mark.

  8. #7
    Join Date
    Nov 2015
    Posts
    36
    Provided Answers: 2
    i cant compile the os_calls.c as the required compiler (IBM XLC) is only for Linux on POWER and not RHEL

    [>]$ uname -a
    Linux mlozdb3 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

  9. #8
    Join Date
    May 2010
    Location
    India
    Posts
    84
    Provided Answers: 2
    No need for XLC compiler. You can use gcc compiler on RHEL. Please go thru README file in {DB2INSTANCE}/sqllib/samples/c directory. Run following commands as instance owner. bldrtn script will compile os_calls.c file and copy the executable to {DB2INSTANCE}/sqllib/function directory. Is there any specific reason for using fence user for testing? fence user is not usually used for connecting to database.


    cd {DB2INSTANCE}/sqllib/samples/c
    bldrtn os_calls

    Satya

  10. #9
    Join Date
    Nov 2015
    Posts
    36
    Provided Answers: 2
    missing component: "base application development tools"

    after I installed that I have my bldrtn in sqllib/samples/c/ and manage to build OS_CALLS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •