0 Replies Latest reply on Jul 20, 2006 2:06 PM by Pink Floyd

    DB2/AS400 select statements not getting generated properly

    Pink Floyd Newbie

      I am using jboss 3.2.3, DB2 on AS400. I wrote a simple entity bean. I setup all the necessary xml files and I am able to connect to the database via jboss. When I invoke the findAll method (implemented by the container), I get an exception from the DB because the statement is not getting generated properly. If you notice, after the SELECT, there is two spaces. Shouldn't it be SELECT * .... instead. As soon as the DB sees the spaces, it thinks it has hit the end of statement. Any help is appreciated.

      Thanks

      Here is the exception,

      2006-07-20 11:57:28,059 INFO [STDOUT] Thu Jul 20 11:57:28 MDT 2006 as400: PreparedStatement STMT0001 (20574010) : Preparing [SELECT FROM LKUP_ACCT_CLSS].
      2006-07-20 11:57:28,091 INFO [STDOUT] Thu Jul 20 11:57:28 MDT 2006 as400: static method Connection DEN9 (23370522) : Throwing exception, id: 1 error class: 1 return code: -104 reason: [SQL0104] Token <END-OF-STATEMENT> was not valid. Valid tokens: , FROM INTO. Cause . . . . . : A syntax error was detected at token <END-OF-STATEMENT>. Token <END-OF-STATEMENT> is not a valid token. A partial list of valid tokens is , FROM INTO. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token <END-OF-STATEMENT>. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause. state: 42601.java.sql.SQLException: [SQL0104] Token <END-OF-STATEMENT> was not valid. Valid tokens: , FROM INTO. Cause . . . . . : A syntax error was detected at token <END-OF-STATEMENT>. Token <END-OF-STATEMENT> is not a valid token. A partial list of valid tokens is , FROM INTO. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token <END-OF-STATEMENT>. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.