If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > sql 100 warnings in sqlj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-20-04, 13:05
zarnold zarnold is offline
Registered User
 
Join Date: Apr 2004
Posts: 3
sql 100 warnings in sqlj

I'm trying to capture SQL 100 warnings with SQLJ. I've tried both of the below methods:

SQLWarning sqlw = getConnectContext().getConnection().getWarnings();

SQLwarning sqlw = getConnectContext().getExecutionContext().getWarni ngs();

which return null.


Warnings are correctly returned in the JDBC environment with this statement:

SQLWarning sqlw = stmt.getWarnings();


Were using version 8.1.3. Is there something I'm missing in my SQLJ environment?
Reply With Quote
  #2 (permalink)  
Old 04-20-04, 14:53
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
This ConnectionContext / ExecutionContext stuff can get pretty hairy.

Are you explicitly specifying which context to use on the statement?

ie. #sql [ctx, ectx] { SELECT ... }

then do ectx.getWarnings()?

I'm not sure if it works if you're just using the default.
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #3 (permalink)  
Old 04-21-04, 16:57
zarnold zarnold is offline
Registered User
 
Join Date: Apr 2004
Posts: 3
I was not explicitly setting the context, but I am now with the same results - SQLWarning is returning as null.
Reply With Quote
  #4 (permalink)  
Old 04-22-04, 07:49
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Quote:
Originally posted by zarnold
I was not explicitly setting the context, but I am now with the same results - SQLWarning is returning as null.
I'm out of ideas, it really should be populated if the statement is generating a warning, perhaps a call to IBM support is in order.
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #5 (permalink)  
Old 05-04-04, 09:19
zarnold zarnold is offline
Registered User
 
Join Date: Apr 2004
Posts: 3
SQL 100 Warnings

IBM says that the driver is working as implemented and that no warnings are generated on a update when rows are not found.

The work around is to check the numer of rows updated with something like this:

getConnectContext().getExecutionContext().getUpdat eCount();
Reply With Quote
  #6 (permalink)  
Old 05-04-04, 15:06
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
That propably only works for insert, update, or delete statements. DB2 provides the following information in the SQLCA data item sqlerrd(3), which I assume is where getUpdateCount() comes from.

If PREPARE is invoked and successful, contains an estimate of the number of rows that will be returned. After INSERT, UPDATE, and DELETE, contains the actual number of rows that qualified for the operation. If compound SQL is invoked, contains an accumulation of all sub-statement rows. If CONNECT is invoked, contains 1 if the database can be updated; 2 if the database is read only.

If CREATE PROCEDURE for an SQL procedure is invoked and an error is encountered parsing the SQL procedure body, contains the line number where the error was encountered. The sixth byte of sqlcaid must be ’L’ for this to be a valid line number.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On