× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Your right it is odd... we have had similar problems with stored procs that
once in a blue moon return the data in a different order that it is stored
in the physical.

I have 2 theories

1) Its something deep down in the bowls of multithreading etc (i.e one
thread is doing one group and another thread is doing a different group, and
the order is determined by which thread finishes first)

Your machines that always return the same result might not be multi thread
enabled (this is just rambling so probably way of the mark!!!! )

2) It's IBM keeping us developers on our toes, as after all the golden rule
of select statements is if there is no ORDER BY clause the Order of the
result set is undefined.

Neill

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Mike Burdette
Sent: 04 May 2009 17:29
To: java400-l@xxxxxxxxxxxx
Subject: Re: SQL works from green screen, but not in WAS with JDBC...

Thanks for your suggestion, Neill. We will try including an ORDER BY clause
after the GROUP BY clause to sort the data.

It will take some time to test this, however as we will have to promote it
to our QA environment (paperwork, etc...).

_The odd thing is, this query works on the SQL command line (STRSQL) on both
DEV and QA as well as from the web service in WAS on our development box.
It just does not return the data sorted as desired from the web service in
WAS on QA.

Thank you for your suggestion...we'll let you know how it goes.

Mike


----------------------------------------------------------------------------
---------

message: 7

date: Fri, 1 May 2009 22:38:19 +0100

from: "Neill Harper" <neill.harper@xxxxxxxx>

subject: RE: SQL works from green screen, but not in WAS with JDBC...



Ahh I see to be fair you have stated that you want ascending order.. .sorry

:-)



This might help.



Unlike the ORDER BY clause, the GROUP BY clause does not order data. Include

an ORDER BY clause after your GROUP BY clause if you want to sort data in a

particular order or sort on an aggregate in the projection list.





-----Original Message-----

From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]

On Behalf Of Mike Burdette

Sent: 01 May 2009 22:02

To: java400-l@xxxxxxxxxxxx

Subject: SQL works from green screen, but not in WAS with JDBC...



All:



We have an issue where an SQL statement from a Java application (web

service) running in WAS Express 6.1, JDK 1.5, returns different results

than when the statement is run in the green screen using STRSQL on the same

iSeries. The statement runs correctly from green screen. To complicate the

matter, the statement will run on another WAS Express 6.0 App server, using

JDK 1.4, as well as on the green screen for this iSeries.



Here is the statement:



SELECT FLD2, FLD3, MIN(MINFLD) AS MINFLD, FROM LIB.FILENAME where ....

GROUP BY MINFLD, FLD2, FLD3, ... fetch first 100 rows only (statement has

been altered to change the field names and for brevity).



The GROUP BY does not seem to work on the 6.1 server. We want the records

returned in ascending order by MINFLD.



Any thoughts would be appreciated.



Thanks


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.