473,378 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problems querying tables in federated database

Hi,

I have 2 servers each running AIX and both have a DB2 database setup on them. I'm building a news management application and in our setup we need to have a staging and production setup. So the staging database gets the changes performed and then once we're satisfied with how it looks, we push the changes through SQL queries which perform the (deletions, updating, and inserting of articles) onto the production database by comparing it to the staging database.

The problem is the database is federated and the nicknames are created on the staging database but I'm getting errors while running certain queries.

Below is how the databases are setup and how the wrapper was created for the federated database.

-------------------------------------------------
Database 1: STAGING
- Users: NEWSADM, SWGNEWSR, NEWSFED
Database 2: PRODUCTION
- Users: NEWSFED

AIX64/DB2 9.1
-------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. CONNECT TO STAGING user NEWSADM using 'p4ssw0rd';
  2.  
  3. CREATE WRAPPER MEGADBWR LIBRARY 'libdb2drda.a' OPTIONS (ADD DB2_FENCED 'N');
  4.  
  5. CREATE SERVER MEGADB11 TYPE DB2/UDB VERSION '9.1' WRAPPER MEGADBWR AUTHID "NEWSFED" PASSWORD "p4ssw0rd" OPTIONS (ADD DBNAME 'PRODNEWS', PASSWORD 'Y'); 
  6.  
  7. CREATE USER MAPPING FOR SWGNEWSR SERVER MEGADB11 OPTIONS (REMOTE_AUTHID 'NEWSFED', REMOTE_PASSWORD 'p4ssw0rd');
  8.  
  9. CREATE NICKNAME PRODNEWS.NEWS_ARTICLES FOR MEGADB11.SWGNEWS.NEWS_ARTICLES;
  10. CREATE NICKNAME PRODNEWS.NEWS_CATEGORIES FOR MEGADB11.SWGNEWS.NEWS_CATEGORIES;
  11. CREATE NICKNAME PRODNEWS.SITES FOR MEGADB11.SWGNEWS.SITES;
  12.  
  13. GRANT SELECT,INSERT,UPDATE,DELETE,CONTROL ON PRODNEWS.NEWS_ARTICLES TO USER NEWSFED;
  14. GRANT SELECT,INSERT,UPDATE,DELETE,CONTROL ON PRODNEWS.NEWS_CATEGORIES TO USER NEWSFED;
  15. GRANT SELECT,INSERT,UPDATE,DELETE,CONTROL ON PRODNEWS.SITES TO USER NEWSFED;
  16.  
  17. SELECT COUNT(*) FROM PRODNEWS.NEWS_ARTICLES;
  18. SELECT COUNT(*) FROM PRODNEWS.NEWS_CATEGORIES;
  19. SELECT COUNT(*) FROM PRODNEWS.SITES;
  20.  
  21. CONNECT RESET;
================================================

The first error that comes up is when I perform a select query on certain tables:
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2.     *
  3. FROM
  4.     PRODNEWS.NEWS_CATEGORIES AS A
  5. WHERE
  6.     NOT EXISTS(
  7.         SELECT
  8.             CATEGORY_ID
  9.         FROM
  10.             SWGNEWS.NEWS_CATEGORIES AS B
  11.         WHERE
  12.             A.CATEGORY_ID = B.CATEGORY_ID
  13.     )
Gives me this error:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [IBM][CLI Driver][DB2/AIX64] SQL30090N Operation invalid for application execution environment. Reason code = "22". SQLSTATE=25000 , SQL state 25000 in SQLExecDirect

The funny and weird thing is that I can perform this same query except on the NEWS_ARTICLES table and the query runs without any errors.

The second error is when I perform a DELETE:
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM
  2.     PRODNEWS.NEWS_ARTICLES AS A
  3. WHERE
  4.     NOT EXISTS(
  5.         SELECT
  6.             NEWS_ID
  7.         FROM
  8.             SWGNEWS.NEWS_ARTICLES AS B
  9.         WHERE
  10.             A.NEWS_ID = B.NEWS_ID
  11.     )
Gives me this error:
SQL1822N Unexpected error code "-507" received from data source "MEGADB11".
Associated text and tokens are " SQL0507N The cursor specified in the UPDATE
or DELETE ". SQLSTATE=560BD

SQL1822N Unexpected error code "-507" received from data source "MEGADB11". Associated text and tokens are " SQL0507N The cursor specified in the UPDATE or DELETE ".
sqlcode: -1822

sqlstate: 560BD

The weird thing yet again is that this query can be performed on the NEWS_CATEGORIES table without any errors.

If anyone can provide guidance and help on debugging this issue, I would greatly appreciate any help as I have been working endlessly trying to find a solution and what's wrong with the database with no luck.

Thanks!
Sep 1 '09 #1
0 2823

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Lennart Jonsson | last post by:
Hi, I'm trying to create a federated database, but I run into trouble when about to "create server". Some info about the env where I try: $ uname -a Linux db2-00 2.4.21-9.ELsmp #1 SMP Thu Jan 8...
5
by: Klemens | last post by:
I get SQL30090 reason 18 by trying to do an insert in a federated table and an update in a local table in one transaction Do I have to change some settings to get done or ist this not possible by...
1
by: terryintransit | last post by:
Problem: ======== I'm receiving SQL1101N when I sttempt to build a nickname in a federated database. Config ====== Server: AIX Version 5.2 DB2: 8.2.1
2
by: Tim V. | last post by:
Here's the layout: AIX v5.2, DB2 v8 fp8 running in 64bit I've got a Multi-partitioned db running on lpar4 and I want to connect it to 2 instances running on lpar13. We'll deal with just 1...
2
by: Antanas | last post by:
I have one table TABLE1 in X db, and another table TABLE2 in Y db. When I execute the following: CONNECT TO X; SELECT * from TABLE1, TABLE2; I get error: SQL0204N "TABLE2" is an...
3
by: Michael Rudolph | last post by:
Hi, at the moment i try to use the federated database feature (DB2/NT 8.2.3) to use a remote host db2 (DB2 OS/390 7.1.2). I am unsure what privileges are needed for the host db2 user. A...
10
by: Mahesh S | last post by:
Hi I am trying to create a federated database using information integrator. When I tried creating wrapper on by right clicking on "Federated database objects" which appears under every...
2
by: bwana.mpoa | last post by:
Hi, We're using a mySQL database as a replica of another (Sybase) DB for reporting purposes. The Sybase is part of a real-time mission critical system - hence the separate database where people...
3
by: FM | last post by:
Hello there: We want to replicate onto the same server (Capture / Apply) tables into federated DB2 - Tables but we are not able to do it... I've tried it with Replication Center but don't see...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.