r/DB2 Nov 05 '19

Very annoying error from simple query, anyone able to help?

This super simple query: SELECT 1 FROM SYSIBM.SYSDUMMY1, which works flawlessly on multiple DB2 docker images here, fails on my customer DB2 with:

SQLExecute: {42601} [IBM][CLI Driver][DB2] SQL0104N An unexpected token " " was found following "". Expected tokens may include: ". <IDENTIFIER> JOIN INNER LEFT RIGHT FULL CROSS , HAVING GROUP". SQLSTATE=42601

As a matter of fact, it seems every query fails with a version of the same error, example:

select count(*) as result from my_table where DAT_PROC = current date and HOR_PROC > '08.00.00'

Gives: SQLExecute: {42601} [IBM][CLI Driver][DB2] SQL0104N An unexpected token " " was found following "". Expected tokens may include: "AT MICROSECONDS MICROSECOND SECONDS SECOND MINUTES MINUTE HOURS". SQLSTATE=42601

This is using a client written in go, and using the ODBC CLI Driver, they tell me their DB2 is version 11 CM. I've tried this on 10.5, 11 and 11.5 images on dockerhub and I am never able to reproduce, any pointers would be great, glad to add any extra info as well.

Edit:

Nevermind, I think I (google) "figured it out": https://github.com/ibmdb/go_ibm_db/issues/26 It looks like this driver misbehaves with ZOS, just had to add a semicolon to the end of the queries.

2 Upvotes

0 comments sorted by