MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL0204N ERROR WHEN USING ODBC TO ACCESS DB2

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Frankjiang
Beginner


Joined: 10 Jan 2004
Posts: 17
Topics: 10
Location: england

PostPosted: Tue Feb 10, 2004 11:06 pm    Post subject: SQL0204N ERROR WHEN USING ODBC TO ACCESS DB2 Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Wed Feb 11, 2004 6:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Frankjiang
Beginner


Joined: 10 Jan 2004
Posts: 17
Topics: 10
Location: england

PostPosted: Wed Feb 11, 2004 8:51 am    Post subject: Reply with quote

Hello Kolusu:

You always give me a important clue to solve a problem.
I really appreciate your help.

Regards

Frank
_________________
franklin
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group