Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2016
    Posts
    4
    Provided Answers: 1

    Question Answered: DB2 federated function

    Hi all,

    I'm new to DB2, and i've trying to call a function that is allowed on database A from database B. I'm using federated server, but i can't do it.
    This are my steps to do it:
    -Create two test databases A B.
    -Create function in A.
    -Set federated to YES/restart server.
    -Create wrapper
    -Create server.
    -Create Function mapping¿? (I can't continue in this step, this don't works).

    I don't know if this information is relevant but the function is a table function.

    Thanks in advance.

  2. Best Answer
    Posted by igallego

    "I resolved the problem.

    I created a trigger and table(code,control,param) in DB A that when user do an insert on the table(control, param) the trigger calls the function.
    It's possible because with a federated server i can do delete/update/insert statments B --> A and then use the trigger allocate in A.

    Regards."


  3. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,

    It's hard to help you if you don't provide exact sql statement, an error code and a message you get.
    Regards,
    Mark.

  4. #3
    Join Date
    Jun 2016
    Posts
    4
    Provided Answers: 1

    DB2 federated function

    Quote Originally Posted by mark.b View Post
    Hi,

    It's hard to help you if you don't provide exact sql statement, an error code and a message you get.

    Hi,

    I have the table function in A, and my goal is to run it on B, but i want to know how to map a function in B.


    The error is :In a reference to function, method, or stored procedure "<routine-name>"
    by signature, no matching function, method, or stored procedure could be
    found.

    I need something like this, but for a function instead a table/column:

    Code:
    db2 create database db1a
    db2 create database db2a
    
    db2 connect to db1a
    
    db2 "create table schema1.tab1 (cod1 int)"
    db2 "insert into schema1.tab1 values (1)"
    
    db2 connect to db2a
    
    db2 "create table schema2.tab2 (name1 char)"
    db2 "insert into schema2.tab2 values ('a')"
    
    db2 update dbm cfg using FEDERATED yes
     
    
    db2stop/db2start
     
    db2 connect to db1a
    
    
    db2 create wrapper drda
    
    
    db2 "create server sevdb2a type DB2/UDB version '9.5' wrapper drda authorization \"db2inst1\" PASSWORD \"db2inst1\" options( add dbname 'db2a')"
    
    db2 "CREATE USER MAPPING FOR schema2 SERVER SEVDB2A OPTIONS (REMOTE_AUTHID 'db2inst1', REMOTE_PASSWORD 'db2inst1')"
    
    db2 CREATE NICKNAME schema2.tab2 FOR SEVDB2A.schema2.tab2
    
    
    
    db2 connect to db2a
    db2 "select * from schema2.tab2,schema1.tab1"

    This works for the tables. I found something like CREATE FUNCTION MAPPING but i have not been able to make it work.


    Thanks for reply.

  5. #4
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Table functions are not supported to be mapped.
    Regards,
    Mark.

  6. #5
    Join Date
    Jun 2016
    Posts
    4
    Provided Answers: 1
    Quote Originally Posted by mark.b View Post
    Table functions are not supported to be mapped.
    Okay, thanks also for your time.

  7. #6
    Join Date
    Jun 2016
    Posts
    4
    Provided Answers: 1
    I resolved the problem.

    I created a trigger and table(code,control,param) in DB A that when user do an insert on the table(control, param) the trigger calls the function.
    It's possible because with a federated server i can do delete/update/insert statments B --> A and then use the trigger allocate in A.

    Regards.

  8. #7
    Join Date
    Jun 2016
    Posts
    5

    "A vendor device reported a media error." TSM issue

    will post a new topic...
    thnks
    Last edited by kiran21; 06-16-16 at 01:21.

  9. #8
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,

    You should open a new topic instead of replying to an existing one with a completely different problem.
    As for your problem: there must be a TSM error code in the db2diag.log near the records you provided.
    So, please, create a new topic and post there a message with a TSM return code.
    Regards,
    Mark.

Tags for this Thread

Posting Permissions

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