If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > select * from anotherDB.someTable

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-03-05, 11:05
bfmaclean bfmaclean is offline
Registered User
 
Join Date: Mar 2005
Posts: 8
select * from anotherDB.someTable

I'm a SQL Server and Oracle guy and new to DB2. I have 4 databases (dbA, dbB, dbC, dbD) that are all on the same schema (s1). When connected to database dbA I want to be able to get data out of dbB. The documentation says that this should work:

SELECT * FROM S1.TBL_HOURS

But I get this error.

SQL0204N "S1.TBL_HOURS" is an undefined name. SQLSTATE=42704

The error sometimes means there is a problem with the table name case. I don't think case is an issue (cause I've tried double quotes and many possible upper/lower case options). I have migrated this data from SQL Server so maybe there's a problem with that.

Any insights would be appreciated.

Blaise
================================================== ==========
About DB2 Administration Tools Environment
================================================== ==========
DB2 administration tools level:
Product identifier SQL08020
Level identifier 03010106
Level DB2 v8.1.7.445
Build level s040812
PTF WR21342
================================================== ==========
Java development kit (JDK):
Level IBM Corporation 1.4.1
================================================== ==========
Reply With Quote
  #2 (permalink)  
Old 03-03-05, 11:29
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by bfmaclean
I have 4 databases (dbA, dbB, dbC, dbD) that are all on the same schema (s1). When connected to database dbA I want to be able to get data out of dbB.
A schema is a part of a database, not the other way around. If I understand you correctly, here's what you've got:

Code:
create database dbA ... ;
connect to dbA ...;
create table s1.tbl_hours ... ;

create database dbB ... ;
connect to dbB .. ;
create table s1.tbl_minutes ...;
select * from s1.tbl_hours;
If that's the case you will need to read about federated databases. Search this forum for that topic, which has been discussed umpteen times.
Reply With Quote
  #3 (permalink)  
Old 03-03-05, 11:37
bfmaclean bfmaclean is offline
Registered User
 
Join Date: Mar 2005
Posts: 8
thanks

thank you for the reply, I will check out federated databases.

I said that all of the databases were on the same schema because when I look at any of the tables in any of the 4 databases the schema is always the same. I assumed the schema was an owner thing. So saying all 4 dbs are on the same schema would be the same as saying all 4 dbs are owned by the same owner. Just curious, no reply really needed.

Blaise
Reply With Quote
  #4 (permalink)  
Old 03-03-05, 12:49
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
No that wouldn't be the same. Saying "all 4 dbs are on the same schema" is like saying "all houses are on the same street". I bet every city and town in North America has a Main Street; however, it doesn't mean that it's the same street. The street name repeats across different cities but these are different streets.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On