473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SQL0072 ?

Does anyone have a definition for this. I do not see it in any of the
references including the DB2 Info Center website. I am getting this
after a declare cursor. I am not sure what the problem is unless I
know what the error means.

BTW...72 is positive. Running v8.2.2

Feb 1 '06 #1
6 1641
shorti wrote:
Does anyone have a definition for this. I do not see it in any of the
references including the DB2 Info Center website. I am getting this
after a declare cursor. I am not sure what the problem is unless I
know what the error means.


Could you possibly provide us with the complete error message? A SQL0072
does not exist and should not be returned by DB2. So either something is
wrong in DB2 or some sort of application you are running interferes.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Feb 1 '06 #2
hmm...I was hoping it was just a missed sqlcode. I dont think you are
going to be able to determine much by the info I have. This is just
what is being logged from sqlca.sqlcode after statement:

EXEC SQL
DECLARE c1 CURSOR FOR stmt;

sprintf(logstr, "Error from DECLARE, SQLCODE %d ",
(short)sqlca.sqlcode);

the logs says:
2006.02-01.10:14:14.681992 c0v0 XDB Error from DECLARE, SQLCODE 72

Just after logging it does a: if (sqlca.sqlcode == 0){
it does not go in here so I know it is returning a non-zero sqlcode.
The logging has always been correct in the past so I have reason to
believe it is correct.

There is nothing between the EXEC, sprintf and the 'if'. logstr is
also plenty long enough.

I will have to try using the debugger on it to see if the memory space
is being overwritten by something else running or if db2 is, in fact,
sending back a 72. This is currently being run on a test machine where
there is very little running.

Feb 1 '06 #3
shorti wrote:
EXEC SQL
DECLARE c1 CURSOR FOR stmt;

sprintf(logstr, "Error from DECLARE, SQLCODE %d ",
(short)sqlca.sqlcode);


sqlcode is defined as sqlint32 - why are you truncating this field to 16 bits?

Jan M. Nelken
Feb 1 '06 #4
The sqlcode is 72 regardless of the truncation.

Feb 2 '06 #5
shorti wrote:
hmm...I was hoping it was just a missed sqlcode. I dont think you are
going to be able to determine much by the info I have. This is just
what is being logged from sqlca.sqlcode after statement:

EXEC SQL
DECLARE c1 CURSOR FOR stmt;

sprintf(logstr, "Error from DECLARE, SQLCODE %d ",
(short)sqlca.sqlcode);
You should fix this line.
(1) %d expects an "int" value, not a short (gcc will complain about this
rightfully if you have -Wall turned on).
(2) you should truncate the sqlcode in the first place.

You are right, the truncation is not a problem _today_ as the largest
absolute sqlcode in DB2 is -30108.
the logs says:
2006.02-01.10:14:14.681992 c0v0 XDB Error from DECLARE, SQLCODE 72
There is obviously a but more to the "logging" than you have shown us.
Could you possibly provide some more code?
There is nothing between the EXEC, sprintf and the 'if'. logstr is
also plenty long enough.


You could collect a DB2 trace as you will see the complete SQLCA structure
in there.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Feb 2 '06 #6
Knut Stolze wrote:
(2) you should truncate the sqlcode in the first place.


should not!!

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

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

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.