[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

DB2, JDBC and SELECT SUM

Posted on 2014-07-11
3
Medium Priority
?
420 Views
Last Modified: 2014-07-13
I have a table with 2 rows in it.

Within the Command Line Processor, I can perform the following:

SELECT SUM(AMT) FROM TABLEA

Open in new window


and from the Command Line Processor, this command will result in providing the sum of the 2 rows

However, from within a JDBC connection, I only get the sum of the first tow

What can be done to resolve this ?  Is this normative within JDBC

Thanks
0
Comment
Question by:Anthony Lucia
3 Comments
 
LVL 18

Expert Comment

by:Dave Ford
ID: 40190854
When you say "the sum of the first row", what exactly do you mean?
0
 

Author Comment

by:Anthony Lucia
ID: 40191078
The sum only includes the first tow number, but does not include the number contained on the second row
0
 
LVL 26

Accepted Solution

by:
Tomas Helgi Johannsson earned 2000 total points
ID: 40193179
Hi!

Depending on your CLP config. Did you insert the second row and issue the select sum(...  query immediatly afterwards ? If so then your CLP config doesn't do a automatic commit after the insert so the second row is not available to other sessions only previously commited rows.
What do you get if you issue
     SELECT SUM(AMT) FROM TABLEA WITH UR

is  the second row added to the sum ? Then the second row is uncommited and your CLP config not configured with autocommit. In that case you will either need to issue commit or set the config to autocommit to let the data be immediately available to other sessions.

Regards,
    Tomas Helgi
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question