简体   繁体   English

在SQuirrel-sql中调试SQL查询

[英]Debug SQL queries in SQuirrel-sql

How do I go about debugging a SQL statement in SQuirrel-sql? 如何在SQuirrel-sql中调试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. 我正在使用IBMi DB2数据库上的JDBC驱动程序。

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. 您可以添加“ errors = full”属性以获取更详细的错误消息,尽管仍然需要一些解释才能找到确切的语法问题。

See the IBM Toolbox for Java JDBC properties for more information. 有关更多信息,请参阅IBM Toolbox for Java JDBC属性

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. 正如Tracy提到的,如果要进行交互式语法检查,则必须使用本机SQL接口之一,例如绿屏的“ 启动SQL交互式会话(STRSQL)”命令IBM i Access Run SQL脚本工具。

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. 对于此类问题不明显的错误,我喜欢将SQL复制并粘贴到AS / 400的绿屏交互式SQL工具中。 (I'm assuming your database server is an AS/400 based on your tag and the mention of IBMi DB2.) The command is STRSQL. (我假设您的数据库服务器是基于您的标签并提及IBMi DB2的AS / 400。)命令是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. 它确实需要对AS / 400进行绿屏访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM