View previous topic :: View next topic |
Author |
Message |
Frankjiang Beginner
Joined: 10 Jan 2004 Posts: 17 Topics: 10 Location: england
|
Posted: Tue Feb 10, 2004 11:06 pm Post subject: SQL0204N ERROR WHEN USING ODBC TO ACCESS DB2 |
|
|
Hi friends:
When I execute the following codes, got error:
EXEC SQL
SELECT * FROM STAFF
END-EXEC.
error message:
[IBM][CLI Driver][DB2/NT] SQL0204N "db2admin.STAFF" is an undefined
SQLSTATE = 42704.
After checking, the STAFF table do exist? What's wrong when using ODBC
to access DB2 ?
Thank you
Frank _________________ franklin |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Wed Feb 11, 2004 6:23 am Post subject: |
|
|
Frank jiang,
A table is qualified by a schema name ... If you do not mention anything, then the default schema (userid of the connected user) is used.I guess you logged into the DB2 server as Administrator when you you ran the scripts it created a schema called ADMINISTRATOR. But the application connects to the DB2 server as a user named db2admin and is looking for a schema called DB2ADMIN.
Run this query to find out the schema.
Code: |
select tabschema
,tabname
from syscat.tables
where tabname='staff'
|
Once you have the schema, then use that in your select statement. Let us say the schema returned from the query is "schema1"
The change your sql statement to the following.
Code: |
select * from schema1.staff
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Frankjiang Beginner
Joined: 10 Jan 2004 Posts: 17 Topics: 10 Location: england
|
Posted: Wed Feb 11, 2004 8:51 am Post subject: |
|
|
Hello Kolusu:
You always give me a important clue to solve a problem.
I really appreciate your help.
Regards
Frank _________________ franklin |
|
Back to top |
|
|
|
|