2

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.

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks its giving a little more useful info.
2

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.

1 Comment

Thanks, I have used STRSQL. The "copy and paste the SQL into the AS/400's green screen" is not as easy as you make it out. For longer statements you need to copy multiple "chunks" of code. And editing with out an "Undo" button is not for me. (Another option would be RUNSQLSTM and looking at the DSPJOBLOG and then maybe SPLF)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.