473,774 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQLCODE -204 using a jdbc-driver to UDB DB2 v8.2


Hi -

I just installed the express-edition of DB2 server (on a Win-XP
machine),
and then I setup a client JDBC driver to access it. The query is a
simple
'select * from EMPLOYEE' against their SAMPLE database.

(This query works fine from within 'Control Center'...there is data in
this table, etc.)

The 'connect' using JDBC works fine. It is just the SQL-query that
gives the error.
(I'm using what appears to be the latest 'type-4' (thin) driver, with
'fix patch 11'.)

So, since I'm a novice at the DB2 server, I have no CLUE where to find
a list
of SQLCODEs. (e.g. to look up value -204). Or, maybe I should be
learning
how to examine the server's log files?!?

Please advise.

TIA...

Dave

May 2 '06 #1
11 9328
David H. Cook wrote:

Hi -

I just installed the express-edition of DB2 server (on a Win-XP
machine),
and then I setup a client JDBC driver to access it. The query is a
simple
'select * from EMPLOYEE' against their SAMPLE database.

(This query works fine from within 'Control Center'...there is data in
this table, etc.)

The 'connect' using JDBC works fine. It is just the SQL-query that
gives the error.
(I'm using what appears to be the latest 'type-4' (thin) driver, with
'fix patch 11'.)

So, since I'm a novice at the DB2 server, I have no CLUE where to find
a list
of SQLCODEs. (e.g. to look up value -204). Or, maybe I should be
learning
how to examine the server's log files?!?


Take the SQLCODE value (-204), remove the sign and prepend a SQL. This will
give you the message number. Then do this:

$ db2 "? <msgnum>"

$ db2 "? SQL204"

gives:

SQL0204N "<name>" is an undefined name.
Most probably the issue is that you have not provided the proper schema
name/qualifier for the EMPLOYEE table. Note that _all_ objects in DB2 are
placed in a schema and if you don't include the schema name explicitly
(which is my general recommendation to avoid problems), various rules apply
to find an object.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 2 '06 #2
Thanks, Knut. I finally figured it out.

Another older thread had the 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 'fix' was to change my query from:
select * from employee
to the form:
select * from yaker.employee

where 'yaker' just happens to be my user-ACCOUNT name on Win-XP.

[I don't fully understand WHY one needs to add these 'schema'
named things, but I also encountered similar concepts under
OTHER vendor's DB servers. So, I'll blindly henceforth learn to
prepend this 'schema-name-thing' onto my table names, when
using DB2 server. Luckily, I'm done with my evaluation of the
various most-common database-SERVERS, so I'll go back to
mostly just using my favorite 'MySQL' server now, and mostly
forget about this little tweak.]

Cheers and thanks again...

Dave

May 2 '06 #3
David H. Cook wrote:
[I don't fully understand WHY one needs to add these 'schema'
named things,
A schema as a namespace. It is essential to uniquely identify an object
like a table.

If you don't provide the schema name, DB2 will use some defaults.
so I'll go back to
mostly just using my favorite 'MySQL' server now, and mostly
forget about this little tweak.]


One could also say that you just leave such (quite useful) features
behind. ;-)

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 2 '06 #4
David H. Cook wrote:
Luckily, I'm done with my evaluation of the
various most-common database-SERVERS, so I'll go back to
mostly just using my favorite 'MySQL' server now, and mostly
forget about this little tweak.]


Why driving VW when you can afford a Porsche? :-)

Bernd
May 2 '06 #5
Oh, the light dawns a little brighter!

Now I think I understand a bit BETTER what is going on.
(And, it seems like maybe the 'DB2' server's and tool's
approach is unnecessarily complicating things!?)

Among the FOUR db-servers I've been evaluating, there
are certainly others that also follow this '<schema.dbname >'
way of architecting things. M$'s SQLServer also comes to
mind, and I think Oracle does this too.

But, the Oracle and M$ products seem to do a much BETTER
job of 'automagically' doing the right thing.

It seems noteworthy that DB2 was the ONLY vendor that
auto-creates a 'user-ACCT' (named DB2ADMIN) on the server
(Win-XP in my case).

But, I did NOT choose to fully switch over and login under the
DB2ADMIN when I did the 'create SAMPLE' database in the
tutorial steps. Instead, I authenticated (or so I thought) as
DB2ADMIN when I did do the tutorial 'create SAMPLE database'
step. Yet, seemingly 'behind my back', DB2 grabbed my underlying
user name of 'yaker' and then created a schema of that name
OVER the top of the SAMPLE database. Hence my later
confusion.

If I'm understanding this all correctly, this seems mis-guided.
To me, this is analogous to becoming 'root' on Linux or becoming
'administrator privs' on Win-NT/XP while still remaining logged
in from a user-name different from that. Once I authenticate
somehow (e.g. using Linux's SU cmd-line pgm), the OS then
names/associates all created objects with the identity of 'root',
as we want.

So, I'd argue that DB2 could/should do the same. Forget that
(underneath) I am in an acct named 'yaker'...once I authenticate
in Control Center as 'DB2ADMIN', it should use THAT identity
for all the created stuff.

Or, maybe I'm missing something. At any rate, it SEEMS to
me that the associated DB2 software is (unnecessarily) making
the 'hole' larger so that it becomes too easy to fall into, and then
the 'automagical' doesn't happen, and we instead have to learn
to pre-pend our acct-named-schema names on the front of
everything (or else learn other 'rules', as Knut mentioned?)

I guess I can say for sure is that _I_ certainly fell into the hole.
(Sigh. Maybe I just should 'fuhgetaboutit' the experience
and move on!?)

My 2-cents...

Dave

May 2 '06 #6
David H. Cook wrote:
It seems noteworthy that DB2 was the ONLY vendor that
auto-creates a 'user-ACCT' (named DB2ADMIN) on the server
(Win-XP in my case).
If you install Oracle on an AIX system, you need a dedicated user. Same
thing for Informix. And DB2 does need an instance owner. Usually, you
don't work as that user on any of those systems.
But, I did NOT choose to fully switch over and login under the
DB2ADMIN when I did the 'create SAMPLE' database in the
tutorial steps. Instead, I authenticated (or so I thought) as
DB2ADMIN when I did do the tutorial 'create SAMPLE database'
step. Yet, seemingly 'behind my back', DB2 grabbed my underlying
user name of 'yaker' and then created a schema of that name
OVER the top of the SAMPLE database. Hence my later
confusion.
I don't know exactly how you created the sample database. If the "db2sampl"
executable was used, then the following sentence from the DB2 documentation
regarding this executable applies:
---------------------------------------------
The qualifiers for the tables in SAMPLE are determined by the user ID
issuing the command.
---------------------------------------------
where qualifiers are the schema names. (I have no clue why a different
terminology was adopted there.)
If I'm understanding this all correctly, this seems mis-guided.
To me, this is analogous to becoming 'root' on Linux or becoming
'administrator privs' on Win-NT/XP while still remaining logged
in from a user-name different from that.
I don't understand you there.

It seems that you were still logged in as "yaker" at the OS level. Given
that DB2 uses the OS for authentication purposes (unless you're using your
own security plugin), the user ID will be "yaker" if you don't specify
anything else during a CONNECT operation. Unfortunately, "db2sampl"
doesn't offer a way to specify different credentials.
Once I authenticate
somehow (e.g. using Linux's SU cmd-line pgm), the OS then
names/associates all created objects with the identity of 'root',
as we want.
No. The schema of the objects depend on the credentials that you used when
you connected to a DB2 database.
So, I'd argue that DB2 could/should do the same. Forget that
(underneath) I am in an acct named 'yaker'...once I authenticate
in Control Center as 'DB2ADMIN', it should use THAT identity
for all the created stuff.
This is what's happening - usually.
Or, maybe I'm missing something. At any rate, it SEEMS to
me that the associated DB2 software is (unnecessarily) making
the 'hole' larger so that it becomes too easy to fall into, and then
the 'automagical' doesn't happen, and we instead have to learn
to pre-pend our acct-named-schema names on the front of
everything (or else learn other 'rules', as Knut mentioned?)
The rules are quite simple:

The CURRENT SCHEMA special register is consulted when an object is created.
At query-time, the CURRENT FUNCTION PATH special register determines which
schemata are to be searched (in which order) to find matching functions. I
think that's about all.
I guess I can say for sure is that _I_ certainly fell into the hole.
(Sigh. Maybe I just should 'fuhgetaboutit' the experience
and move on!?)


You're not the only one. :-(

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 2 '06 #7

"David H. Cook" <Da************ ***@gmail.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
Oh, the light dawns a little brighter!

Now I think I understand a bit BETTER what is going on.
(And, it seems like maybe the 'DB2' server's and tool's
approach is unnecessarily complicating things!?)

Among the FOUR db-servers I've been evaluating, there
are certainly others that also follow this '<schema.dbname >'
way of architecting things. M$'s SQLServer also comes to
mind, and I think Oracle does this too.

But, the Oracle and M$ products seem to do a much BETTER
job of 'automagically' doing the right thing.

It seems noteworthy that DB2 was the ONLY vendor that
auto-creates a 'user-ACCT' (named DB2ADMIN) on the server
(Win-XP in my case).

But, I did NOT choose to fully switch over and login under the
DB2ADMIN when I did the 'create SAMPLE' database in the
tutorial steps. Instead, I authenticated (or so I thought) as
DB2ADMIN when I did do the tutorial 'create SAMPLE database'
step. Yet, seemingly 'behind my back', DB2 grabbed my underlying
user name of 'yaker' and then created a schema of that name
OVER the top of the SAMPLE database. Hence my later
confusion.

If I'm understanding this all correctly, this seems mis-guided.
To me, this is analogous to becoming 'root' on Linux or becoming
'administrator privs' on Win-NT/XP while still remaining logged
in from a user-name different from that. Once I authenticate
somehow (e.g. using Linux's SU cmd-line pgm), the OS then
names/associates all created objects with the identity of 'root',
as we want.

So, I'd argue that DB2 could/should do the same. Forget that
(underneath) I am in an acct named 'yaker'...once I authenticate
in Control Center as 'DB2ADMIN', it should use THAT identity
for all the created stuff.

Or, maybe I'm missing something. At any rate, it SEEMS to
me that the associated DB2 software is (unnecessarily) making
the 'hole' larger so that it becomes too easy to fall into, and then
the 'automagical' doesn't happen, and we instead have to learn
to pre-pend our acct-named-schema names on the front of
everything (or else learn other 'rules', as Knut mentioned?)

I guess I can say for sure is that _I_ certainly fell into the hole.
(Sigh. Maybe I just should 'fuhgetaboutit' the experience
and move on!?)

My 2-cents...

And here's mine.

If you're going to rule out DB2 simply on the grounds of having a slightly
different default behaviour that some of its competitors in one small aspect
and not even consider all the strengths of DB2, then you're not doing a very
thorough evaluation.

It's as if you are testing the world's most exotic sports cars to see which
is the best, then ruling one out simply because you don't like the shape of
the shift knob, even if it is "best of breed" in many categories.

A discerning evaluation would focus on the _important_ aspects of what the
different database servers offer, not the trivial ones, and would note _all_
the strengths and weaknesses of each product, not just dismiss one
categorically over a minor point.

If you are legally liable for the opinion you're rendering, i.e. if you've
been hired by someone to choose the best of the four database servers for
them, you should really rethink your evaluation method. Otherwise, your
customer is like you to sue for your very dubious approach to product
evaluations. I know I'd be pretty unhappy if I bought the product you
recommended and then found out how you'd come up with the "winner". Even if
you are simply an employee delegated to choose the product, you should think
very carefully because your management is not going to be thrilled if they
find out how you chose the best server and that could hurt your prospects
for advancement, even if it doesn't provoke lawsuits against you.

I'm not saying DB2 is unquestionably the best of the products you are
comparing - I have never used some of the databases you are examining - but
it certainly deserves more thorough consideration than you've given it.

--
Rhino
May 2 '06 #8
David H. Cook wrote:
Oh, the light dawns a little brighter!

Now I think I understand a bit BETTER what is going on.
(And, it seems like maybe the 'DB2' server's and tool's
approach is unnecessarily complicating things!?) It works just like your any Unix OS (and nearly like DOS)
good company.
It seems noteworthy that DB2 was the ONLY vendor that
auto-creates a 'user-ACCT' (named DB2ADMIN) on the server
(Win-XP in my case). No it doesn't. When you installed DB2 proposed DB2ADMIN and you
apparently hit the OK button. On my laptop DB2 is owned by my normal ID
because I typed in my id at install.

Or, maybe I'm missing something.

Yes you are CURRENT SCHEMA = current working directory.
The SCHEMA is as orthogonal from your id as your directory.
You can cd into any directory as long as you have permissions.
The ONLY correlation between USER and SCHEMA is that after you connect
by default the schema is equal to the user under which you authenticated.
This default can be overridden with connection properties that are
client specific.

Now before you create your first function please look up PATH.
Hint: It works just like PATH in your OS.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 2 '06 #9
Ah, I guess that I inadvertently mis-led, when I
mentioned that I was 'evaluating' DB2.

What I was IN FACT doing was installing versions
of 4 DB packages (Oracle, SQLServer, DB2, and MySQL)
so that I could TEST a Java JDBC application against
each of them. As you may know, each JDBC driver
interface has slightly different URL syntax, etc, etc,
and I wanted to make sure my Java app would talk
to each DB server. (So, my goal was NOT to see
which DB server I perfer.) Thus, I am NOT
accepting or rejecting DB2...rather, just commenting
on some aspects that seemed different or troublesome
as I setup to carry out my tests.

Cheers...
Dave

May 3 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7895
by: Tborn2b | last post by:
DB2 V 7, Z/OS: I receive an SQLCODE -104 for the following trigger : CREATE TRIGGER TRSERED1 NO CASCADE BEFORE INSERT ON SEMINAR REFERENCING NEW AS ZUGANG
5
45911
by: Jean-Marc Blaise | last post by:
Dear all, Could you explain why some SQL messages do not possess a SQLSTATE ? Why not transmitting the SQLSTATE of the original <sqlcode>, for example if you get a -911 on a RUNSTATS ? SQL2310N The utility could not generate statistics. Error "<sqlcode>" was returned.
1
3051
by: Kim Bundgaard | last post by:
Hi I got a sqlcode=-843 (SQL0843N) in my PL/I-program running against DB2 z/OS V7, when I issue RELEASE CURRENT. I can't see why I get this error - and I can't reproduce it. My program only do the implicit connect to local db2 subsystem, but it issue a RELEASE CURRENT and get the SQL0843N/sqlcode=-843.
4
12049
by: prasad | last post by:
I am getting sql error during binding a program which access a temporary table. The temporary table declaration and access methods are given below. EXEC SQL DECLARE GLOBAL TEMPORARY TABLE TEM88 LIKE SYSIBM.SYSDUMMY1 END-EXEC. EXEC SQL INSERT INTO TEM88 SELECT * FROM SYSIBM.SYSDUMMY1 END-EXEC.
1
1787
by: peteh | last post by:
Hi All; We have 2 open PMRs - one for AIX, one for DB2 relating to this problem, but I thought I'd see if I could make any progress in the group. We just upgraded a 4 node/36 processor configuration to AIX 5.2. We are at DB2 v8.1 (FP 5). We upgraded AIX one node at a time and began seeing periodic SQLCode -1225 and swapping issues. All nodes are now upgraded and we get more and more bouts where processes end in sqlcode -1225. Clearly,...
5
14521
by: misterutterbag | last post by:
Stack trace below. Only happens in WebSphere 6.0. DB2 v 8.2. FP12. Only against 1 database. I have other databases in this database instance, but they don't seem to have this problem. Looked up SQLCODE: -805. It said either a) the client and server versions don't match (which doesn't make
1
23786
by: amarhegde | last post by:
When u perform the SELECT operation, Sometimes u get this error Code java.rmi.RemoteException: ; nested exception is: javax.ejb.EJBException: nested exception is: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null
7
5076
by: Gregor =?UTF-8?B?S292YcSN?= | last post by:
Hi! I was searching through DB2 InfoCenter, but didn't find an answer to my question: When I get an SQLCODE from an SQL command (ADMIN_CMD for example) when I want to know what this code means; is it a warning, error, .... Best regards, Kovi
2
8198
by: APP1MVF | last post by:
Question: I come from a COBOL/DB2 environment so I am use to being able to display the current SQLSTATE or SQLCODE following the issuing of a DB2 command, now I have move over to a LINUX/DB2 shell scripting environment and I am looking to see if it is possible for me to do the same in a shell script. So is it possible to display the current sqlcode or sqlstate and only the sqlcode or sqlstate? Could someone please give me an example? ...
3
7349
by: lenygold via DBMonster.com | last post by:
Thank you very much SERGE for your help. I found example in Graeme Birchall COOKBOOK wich i think exactly what i need for SQL check in triggers: • User query joins to table function - sends DML or DDL statement to be executed. • Table function calls stored procedure - sends statement to be executed. • Stored procedure executes statement. • Stored procedure returns SQLCODE of statement to the table function.
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.