aspose file tools*
The moose likes JDBC and the fly likes Expected token error while running this query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Expected token error while running this query" Watch "Expected token error while running this query" New topic
Author

Expected token error while running this query

madhava ram
Greenhorn

Joined: Feb 23, 2009
Posts: 9
Hi All,

When I run the below query in DB2 I get the expected results. But when I try to run the same query from java I get the error as expected token error.

Below is my query.

SELECT appTrans.application_id, appTrans.trans_ts, appTrans.trans_status FROM APPLICATIONS_TRANS_DETAILS appTrans INNER JOIN (SELECT appTrans2.application_id, max(appTrans2.trans_ts) AS Column2 FROM APPLICATIONS_TRANS_DETAILS appTrans2 GROUP BY appTrans2.application_id) AS appTrans3 ON appTrans.application_id = appTrans3.application_id AND appTrans.trans_ts = appTrans3.Column2 where appTrans.application_id in(select App.APPLICATION_ID from APPLICATIONS As App where App.SKILL_ID in(121024, 121025, 121026, 121027, 121028, 121029) and App.USER_CNUM_ID='072725744' and App.LEVEL_ID in (1, 2, 3) order by skill_id) ORDER BY appTrans.application_id;

Thanks in advance
Madhava
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

First off, be careful which forum you post to. This is more of a JDBC issue than a Object-Relational Mapping.

Second, we really can't answer your question without having a copy of your database schema (we don't need all the table definitions though). My best advice is to cut down the size of the query eliminating items until you find out why java and non-java access returns different results. Just general debugging skills will help.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Expected token error while running this query