DB2

This is a discussion on DB2 within the databases forums in Other Databases category; I have been writing a program to manage a database of SQL interfaced to DB2. The problem is,that when I run the program I get a massege,error: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=Name.NUMBERS, DRIVER=3. 50.152 where Name is my userid Name (The real name is classified). I have already seen your answer to someone else about that error: his question: This is my first time starting a topic here so I hope this is the right place. I am having problems running SQL queries on a Version 8 DB2 database for Windows ...

Go Back   Database Forum > Other Databases > databases

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-24-2008, 05:25 AM
Default DB2

I have been writing a program to manage a database of SQL interfaced to DB2.
The problem is,that when I run the program I get a massege,error:
DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=Name.NUMBERS, DRIVER=3.
50.152

where "Name" is my userid Name (The real name is classified).
I have already seen your answer to someone else about that error:

his question:
This is my first time starting a topic here so I hope this is the right
place. I am having problems running SQL queries on a Version 8 DB2
database for Windows Server using the type 4 driver. I get a connection
but when I run a query, I get this error:

DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704

For example if my query was "SELECT * from TABLE" , I would get the
error:

"DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704 DB2ADMIN.TABLE" [SELECT
* FROM IDSC.TABLE]

I looked at the error codes online and they do not provide me with any
information I did not already know. Any help would be greatly
appreciated.

Kindest Regards,

Tony

your answer:
If the userid you are using is db2admin, and you don't supply a high level
qualifier on the table name, the DB2 assumes that DB2ADMIN is the qualifier
(schema) name. You can use the SET SCHEMA statement before hand, use an
alias, or use the a userid with the same name as your schema.

My question is about terminology:
1)What is a high level qualifier?
2)When using SET SCHEMA,what are parameters and what do they mean?
3)What is alias?
4)When I use userid with same name as my schema,how do I know the name of my
schema?

Thanks in advanced,
Yoav

Reply With Quote
  #2  
Old 08-24-2008, 12:02 PM
Default Re: DB2

On Aug 24, 10:25*am, "yoav" wrote:
> I have been writing a program to manage a database of SQL interfaced to DB2.
> The problem is,that when I run the program I get a massege,error:
> DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=Name.NUMBERS,DRIVER=3.
> 50.152 *
>
> where "Name" is my userid Name (The real name is classified).
> I have already seen your answer to someone else about that error:
>
> his question:
> This is my first time starting a topic here so I hope this is the right
> place. *I am having problems running SQL queries on a Version 8 DB2
> database for Windows Server using the type 4 driver. I get a connection
> but when I run a query, I get this error:
>
> DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704
>
> For example if my query was "SELECT * from TABLE" , I would get the
> error:
>
> "DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704 DB2ADMIN.TABLE" [SELECT
> * FROM IDSC.TABLE]
>
> I looked at the error codes online and they do not provide me with any
> information I did not already know. *Any help would be greatly
> appreciated. *
>
> Kindest Regards,
>
> Tony
>
> your answer:
> If the userid you are using is db2admin, and you don't supply a high level
> qualifier on the table name, the DB2 assumes that DB2ADMIN is the qualifier
> (schema) name. You can use the SET SCHEMA statement before hand, use an
> alias, or use the a userid with the same name as your schema.
>


You will probably get more answers in:

comp.databases.ibm-db2

> My question is about terminology:
> 1)What is a high level qualifier?


Given the description above it is the schema that your table resides
in. Every DBMS I know (except mysql) have a concept schema. You can
find out what schema your table belong to by:

select tabschema from syscat.tables where tabname = ''

> 2)When using SET SCHEMA,what are parameters and what do they mean?


If you don't qualify your table with a schema DB2 assume the schema to
be the name of the user asking the query. Say your query looks like:

select * from users

and that you are logged in as db2admin. DB2 thinks this query is:

select * from db2admin.users

You can prevent this by either specifying the schema as (assuming yoav
as schema):

select * from yoav.users

or by setting the default schema as in:

set schema = yoav

Personally I think it is a good idea to always specify the schema in
the query.


/Lennart

[...]
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 04:47 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.