Find

Digest
· Dec 2, 2024

Nuevas publicaciones en la Comunidad de InterSystems, 25 noviembre - 1 diciembre

Digest
· Dec 2, 2024

【週間ダイジェスト】 11/25 ~ 12/01 の開発者コミュニティへの投稿

記事
お知らせ
質問
#その他
11/25 ~ 12/01Week at a GlanceInterSystems Developer Community
Digest
· Dec 2, 2024
Question
· Dec 1, 2024

HELP --- When using JDBC to connect to the Iris , SQL statements containing double quotes cannot be executed.

Hi everyone

   when I use JDBC(Version:intersystems-jdbc-3.8.0.jar) to connect to the Iris(Version: 2021.1.2.338 xDBC Protocol Version 63)

    I’m trying to execute SQL statements that include double quotes, but unfortunately, they’re failing.

For example:

[this query]

         SELECT count(*) AS "_pfgnrtd_0" FROM "BILL_COM_PO"."PrintLog"

[Error ]

     Exception in thread "main" java.sql.SQLException: [SQLCODE: <-1>:<Invalid SQL statement>]
     [Location: <Prepare>]
     [%msg: < IDENTIFIER expected, : found^SELECT COUNT ( * ) AS :%qpar(1) FROM :%qpar>]
        at com.intersystems.jdbc.IRISConnection.getServerError(IRISConnection.java:989)
        at com.intersystems.jdbc.IRISConnection.processError(IRISConnection.java:1134)
        at com.intersystems.jdbc.InStream.readMessageInternal(InStream.java:319)
        at com.intersystems.jdbc.InStream.readMessage(InStream.java:208)
        at com.intersystems.jdbc.InStream.readMessage(InStream.java:183)
        at com.intersystems.jdbc.IRISPreparedStatement.prepareInternal(IRISPreparedStatement.java:589)
        at com.intersystems.jdbc.IRISPreparedStatement.prepare(IRISPreparedStatement.java:550)
        at com.intersystems.jdbc.IRISPreparedStatement.<init>(IRISPreparedStatement.java:25)
        at com.intersystems.jdbc.IRISConnection.getOrCreatePossiblyShardedIRISPreparedStatement(IRISConnection.java:1904)
        at com.intersystems.jdbc.IRISConnection.prepareStatement(IRISConnection.java:1435)
        at com.intersystems.jdbc.IRISConnection.prepareStatement(IRISConnection.java:271)
        at IrisJDBCExample.main(IrisJDBCExample.java:39)

But if it is connected to other versions of iris( Version: 2024.1.0.267.2 xDBC Protocol Version 67), it can execute correctly.

If anyone has encountered a similar issue or has any tips on how to handle double quotes in SQL statements with JDBC, I would really appreciate your insights!

Thanks so much for your help!

3 Comments
Discussion (3)4
Log in or sign up to continue
Article
· Dec 1, 2024 3m read

第三十八章 终端输入 输出 - USER命令

第三十八章 终端输入 输出 - USER命令

USER命令

使指定终端成为当前设备。在编程器模式下,同一行代码上的所有后续 I/O 命令都引用该设备。在应用程序模式下,您在USE命令中命名的设备将一直保留为当前设备,直到下一个USE命令为止。

USE 语法

USE命令采用以下参数:

USE terminal:(margin:protocols:terminator):"mnespace"

终端参数可以是一个表达式,其值为终端设备的名称。零 (0) 是该进程的主要设备。 $IO是当前设备。终端的最大长度为 256 个字符。

参数由冒号 (:) 分隔。如果省略参数,则必须指定冒号。命令或其参数列表不得以冒号结束。

Discussion (0)1
Log in or sign up to continue