System i Access ODBC-Treiber][DB2 für i5/OS]SQL0104 - Token . ungültig.
Hello, unfortunately, the SQL query to IBM DB2 fails:
Error in SQL statement: ODBC-call returned [-1] : [42000][-104][IBM][System i Access ODBC-Treiber][DB2 für i5/OS]SQL0104 - Token . ungültig. Gültige Token: FOR USE SKIP WAIT WITH FETCH LIMIT ORDER UNION EXCEPT OFFSET.
SELECT * FROM TEST.TABLE
ODBC Info:

Isn't DB2 supported?
regards J.Immel
Hello J.Immel,
Wel certainly it is.
As you can see in the info tree the ODBC driver is recognized and working.
The nasty snare with the ODBC “42000” state is that the ‘official description’ from the standard states
42000: Syntax error or access violation
And as I can see the SQL0104: invalid token error (German Gültige Token) I suspect that the problem
Here does not lie in the syntax of your select statement (SELECT * FROM
Hello Edwig,
thank a lot for the fast response. It's not because of the permissions - the user has admin rights to the database and tables. It works with other SQL query tools.
The last version of ODBC Query Tool that worked with DB2 was 1.04xx if I remember correctly :).
It may also be due to the IBM Access ODBC driver. Thanks for your help.
Best regards
Jürgen Immel
Hello Jürgen,
To verify I installed the community version 11.5.8 of DB2. During installment I selected to NOT use the OS integrated security but local database security. Alsoo I opted to install the standard "SAMPLE" database and the DB2 ODBC drivers.
Firing up Sthe ODBCQuerytool showed all tables in the table tree when using the standard "db2admin" account. But no SELECT could be run. This resulted in a strange error, namely:
[42501][-551][IBM][CLI Driver][DB2/NT64] SQL0551N The statement failed because the authorization ID does not have the required authorization or privilege to perform the operation. Authorization ID: "DB2ADMIN". Operation: "SELECT". Object: "CUSTOMER". SQLSTATE=42501
So I retried using my MS-Windows account and Ho Presto! Lo and behold! Everything worked fine! SELECT, UPDATE, everything.
The standard installation of the latstest version and ODBC drivers led to a working situation with the current ODBC Querytool. I am afraid that in your situation a different approach may be needed to find a working combination, but I think it is hereby proven that the standard software (DB2, ODBC-Driver, ODBC Querytool) is not to blame.
But do check out this post: https://www.sqlservercentral.com/forums/topic/as400-as-linked-server The error message that you reported can be found on the internet, with a root cause that people are trying to connect to, and use, a linked server.
For now, I will not further investigate in this matter, unless you can give me some more clues. Sorry.
Best regards, Edwig Huisman.