查找

问题
· 八月 12, 2024

Error consultando foreign table en MySQL

¡Hola estimados miembros de la comunidad!

En esta ocasión no vengo con ningún artículo sino con un problema que me he encontrado al definir una conexión a una tabla ubicada en una base de datos externa en MySQL.

Estoy haciendo algunas pruebas con la funcionalidad de las Foreign Tables incluidas en IRIS que permite incluir tablas externas en modo consulta como si fueran propias de IRIS y he visto que funciona perfectamente con una tabla ubicada en PostgreSQL, el problema ha sido al intentar hacer lo mismo con una tabla de MySQL, he seguido los siguiente pasos como indica la documentación:

  • Paso 1: He creado la conexión a la base de datos de MySQL desde la configuración de SQL Gateway connection: **AVISO** si el nombre del fichero que contiene el driver es demasiado largo IRIS no podrá cargarlo.
  • Paso 2: He creado el Foreign Server:
    CREATE FOREIGN SERVER Test.MySQLDB FOREIGN DATA WRAPPER JDBC CONNECTION 'MySQL'
  • Paso 3: He creado la Foreign Table:
    CREATE FOREIGN TABLE Test.PatientMySQL SERVER Test.MySQLDB TABLE 'patient'
  • Paso 4: He lanzado al consulta a Test.PatientMySQL:
    SELECT * FROM Test.PatientMySQL

Y este ha sido el error:

[SQLCODE: <-230>:<Foreign table query Execute() failed>]

[%msg: <Foreign Tables - ERROR #8104: Gateway Exception: <GATEWAY> java.sql.SQLSyntaxErrorException com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:112) Remote database reported error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"patient" T1' at line 1>]

Como podéis ver, el problema son las dobles comillas que aparecen en el nombre de la tabla en la consulta que IRIS está ejecutando, MySQL es incapaz de reconocerlo y nos devuelve ese error. Por si acaso he revisado la versión de MySQL y el driver utilizado y ambas son la versión 9, así que no parece que sea eso.

¿Es un bug para MySQL? ¿He configurado algo erroneamente?

¡Gracias por adelantado!

1 Comment
讨论 (1)1
登录或注册以继续
摘要
· 八月 12, 2024

Nuevas publicaciones en la Comunidad de InterSystems, 5-11 agosto

5-11 agostoWeek at a GlanceInterSystems Developer Community
问题
· 八月 12, 2024

Error querying foreign table on MySQL

Hi community members!

I'm testing some functionalities about Foreign Tables and it works smoothly with PostgreSQL database, but I found out an issue with MySQL database, I followed the documentation:

  • Step 1: I've created my SQL Gateway connection to my MySQL database: **WARNING** if the name of the driver file is too long IRIS won't be able to get it.

  • Step 2: Create foreign server:
    CREATE FOREIGN SERVER Test.MySQLDB FOREIGN DATA WRAPPER JDBC CONNECTION 'MySQL'
  • Step 3: Create foreign table:
    CREATE FOREIGN TABLE Test.PatientMySQL SERVER Test.MySQLDB TABLE 'patient'
  • Step 4: Query Test.PatientMySQL:
    SELECT * FROM Test.PatientMySQL

And this is the error:

[SQLCODE: <-230>:<Foreign table query Execute() failed>]

[%msg: <Foreign Tables - ERROR #8104: Gateway Exception: <GATEWAY> java.sql.SQLSyntaxErrorException com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:112) Remote database reported error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"patient" T1' at line 1>]

As you can see, the problem is the double quotation used on the query for the table name that IRIS is executing, MySQL doesn't recognize it and throws the error, I've checked the driver and the MySQL versions and they match, version 9.

Is this a bug? Is it a misconfiguration?

Thank you in advance!

4 Comments
讨论 (4)1
登录或注册以继续
摘要
· 八月 12, 2024

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

文章
· 八月 11, 2024 阅读大约需 2 分钟

第七章 解析时使用进程私有全局变量

第七章 解析时使用进程私有全局变量

默认情况下, Web 客户端在解析请求或响应时通常使用本地数组内存。可以强制它改用进程私有全局变量;这使 Web 客户端能够处理非常大的消息。

为此,请指定 Web 服务类的 USEPPGHANDLER 参数,如下所示:

Parameter USEPPGHANDLER = 1;

如果此参数为 1,则 Web 客户端在解析请求或响应时始终使用进程私有全局变量。如果此参数为 0,则 Web 客户端始终使用本地数组内存来实现这些目的。如果未设置此参数,则 Web 客户端使用默认值,通常是本地数组内存。

可以在运行时覆盖此参数。为此,请设置 Web 客户端实例的 UsePPGHandler 属性。

讨论 (0)1
登录或注册以继续