Question

How do I go about debugging a SQL statement in SQuirrel-sql?

I keep getting "unhelpful" errors like:

Error: [SQL0104] Token , was not valid. Valid tokens: ) OR.
SQLState:  42601
ErrorCode: -104

I would love to be able to see the line number where I made the error, or some other way of guiding me to where the problem is.

I am working with the JDBC driver on a IBMi DB2 database.

Was it helpful?

Solution

You can add the "errors=full" property for more detailed error messages although it will still require some interpretation to locate the precise syntax issue.

See the IBM Toolbox for Java JDBC properties for more information.

As Tracy mentioned if you want interactive syntax checking you will have to use one of the native SQL interfaces such as the green screen Start SQL Interactive Session (STRSQL) command or the IBM i Access Run SQL scripts tool.

OTHER TIPS

For such errors where the problem isn't obvious, I like to copy and paste the SQL into the AS/400's green screen interactive SQL tool. (I'm assuming your database server is an AS/400 based on your tag and the mention of IBMi DB2.) The command is STRSQL. When there's an error, it will put your cursor right where the problem is. Or, more specifically, where it thinks the problem is. It does require green screen access to the AS/400.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top