使用带有 ColdFusion 11 的 Firebird RDBMS 查询错误
Query Error using Firebird RDBMS with ColdFusion 11
所以我在 Windows 2012 服务器上安装了 Adobe ColdFusion 11 Update 5。我使用 Jaybird 2.2.5 JDBC 驱动程序添加了一个 Firebird 数据源。我使用该数据源创建了一个查询,如下所示:
<cfquery name="rawdata" datasource="RSReport">
select * from rptpatientstudy
where statusorder >= 200
and issuer = 'RWHG'
and studydatetime >= '2015-01-01'
and studydatetime < '2015-04-01';
</cfquery>
但是当我 运行 页面时,我收到一个动态 SQL 错误,提及未知标记。
这是堆栈跟踪:
org.firebirdsql.gds.GDSException: Dynamic SQL Error
SQL error code = -104 Token unknown - line 2, column 1 RETURNING
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2092)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2042)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlPrepare(AbstractJavaGDSImpl.java:1465)
at org.firebirdsql.gds.impl.GDSHelper.prepareStatement(GDSHelper.java:190)
at org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(AbstractStatement.java:1441)
at org.firebirdsql.jdbc.AbstractStatement.internalExecute(AbstractStatement.java:1423)
at org.firebirdsql.jdbc.AbstractStatement.execute(AbstractStatement.java:867)
at org.firebirdsql.jdbc.AbstractStatement.execute(AbstractStatement.java:441)
at coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:359)
at coldfusion.sql.Executive.executeQuery(Executive.java:1479)
at coldfusion.sql.Executive.executeQuery(Executive.java:1229)
at coldfusion.sql.Executive.executeQuery(Executive.java:1159)
at coldfusion.sql.SqlImpl.execute(SqlImpl.java:406)
at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:1185)
at coldfusion.tagext.sql.QueryTag.startQueryExecution(QueryTag.java:814)
at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:767)
at cfmarla2ecfm1504149200.runPage(C:\inetpub\WebSites\intranet\marla.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:246)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:736)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:572)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:45)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:466)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:142)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:219)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:422)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:199)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
这是 table 中的字段列表:
STUDYINSTANCEUID
PATIENTID
PATIENTNAME
STUDYDATETIME
STUDYDESCRIPTION
PRIORITY
READINGPHYSICIAN
REFERINGPHYSICIAN
PERFORMINGPHYSICIAN
TECHNOLOGIST
TRANSCRIPTIONIST
ACCESSIONNUMBER
INSTITUTIONNAME
STATUSORDER
SCHEDULEDBODYPARTEXAMINED
SCHEDULEDMODALITY
UTCOFFSET
HL7BILLED
SCHEDULEDEXAMROOM
PATIENTBIRTHDATE
MODALITIES
BODYPARTS
IMAGES
AGE
SEX
CONFLICT
STUDYID
FILESETID
ISSUER
SCHEDULEDLATERALITY
LOCATION
PROCEDURECODE
DATETIMEREAD
DURATION
FILM
BURNCD
MAIL
COURIER
AUTOFAXLIST
AUTOEMAILLIST
SCHEDULEDRESOURCE
ACCOUNTSTATUS
LANGUAGE
FINANCIALTYPE
STATE
INSURANCEPAYERS
INSURANCEEXPIRIES
COMMENTS
ALLERGIES
CANCELLATIONREASON
CELLPHONE
HOMEPHONE
AUTHORIZATIONNUMBER
DATEOFSURGERY
RECEIVEDTIME
INTERNALVISITID
SMOKINGSTATUS
我真的不确定这可能是从哪里来的,而且我似乎找不到直接适用于 Google 的内容;那里的大多数结果似乎都涉及在查询中使用派生的 tables 或 SELECT *
。
TL;DR:这是 Jaybird 中的一个错误。我已经创建了错误 JDBC-391 and this has been fixed in Jaybird 2.2.8。
在堆栈跟踪中调用的 execute
方法是 execute(String, int)
,通常只在应该 return 生成密钥的 update/insert 中调用。好像 Cold Fusion 总是这样称呼它(值 Statement.RETURN_GENERATED_KEYS
)。
在 Jaybird 中处理生成的键的实现假定其内部语句解析器在遇到 SELECT
语句时抛出异常;如果发生这种情况,则应不加修改地处理查询。不幸的是,没有针对此假设的测试,并且当解析过程中发生错误时解析器实际上不会抛出异常(它们以不同的方式发出信号)。结果,SELECT
查询通过附加 RETURNING
子句进行了修改,当查询随后被发送到服务器时,这是一个语法错误。
我不确定是否有解决此问题的方法,除非恢复到 Jaybird 2.1.6,因为这个问题自 Jaybird 2.2.0 最初实施以来就一直存在。您还可以检查 Cold Fusion 是否有任何配置可以修改它执行查询的方式。
这已在 Jaybird 2.2.8 中修复。
披露:我是 Jaybird 的开发者之一。
所以我在 Windows 2012 服务器上安装了 Adobe ColdFusion 11 Update 5。我使用 Jaybird 2.2.5 JDBC 驱动程序添加了一个 Firebird 数据源。我使用该数据源创建了一个查询,如下所示:
<cfquery name="rawdata" datasource="RSReport">
select * from rptpatientstudy
where statusorder >= 200
and issuer = 'RWHG'
and studydatetime >= '2015-01-01'
and studydatetime < '2015-04-01';
</cfquery>
但是当我 运行 页面时,我收到一个动态 SQL 错误,提及未知标记。
这是堆栈跟踪:
org.firebirdsql.gds.GDSException: Dynamic SQL Error
SQL error code = -104 Token unknown - line 2, column 1 RETURNING
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2092)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2042)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlPrepare(AbstractJavaGDSImpl.java:1465)
at org.firebirdsql.gds.impl.GDSHelper.prepareStatement(GDSHelper.java:190)
at org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(AbstractStatement.java:1441)
at org.firebirdsql.jdbc.AbstractStatement.internalExecute(AbstractStatement.java:1423)
at org.firebirdsql.jdbc.AbstractStatement.execute(AbstractStatement.java:867)
at org.firebirdsql.jdbc.AbstractStatement.execute(AbstractStatement.java:441)
at coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:359)
at coldfusion.sql.Executive.executeQuery(Executive.java:1479)
at coldfusion.sql.Executive.executeQuery(Executive.java:1229)
at coldfusion.sql.Executive.executeQuery(Executive.java:1159)
at coldfusion.sql.SqlImpl.execute(SqlImpl.java:406)
at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:1185)
at coldfusion.tagext.sql.QueryTag.startQueryExecution(QueryTag.java:814)
at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:767)
at cfmarla2ecfm1504149200.runPage(C:\inetpub\WebSites\intranet\marla.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:246)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:736)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:572)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:45)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:466)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:142)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:219)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:422)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:199)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
这是 table 中的字段列表:
STUDYINSTANCEUID
PATIENTID
PATIENTNAME
STUDYDATETIME
STUDYDESCRIPTION
PRIORITY
READINGPHYSICIAN
REFERINGPHYSICIAN
PERFORMINGPHYSICIAN
TECHNOLOGIST
TRANSCRIPTIONIST
ACCESSIONNUMBER
INSTITUTIONNAME
STATUSORDER
SCHEDULEDBODYPARTEXAMINED
SCHEDULEDMODALITY
UTCOFFSET
HL7BILLED
SCHEDULEDEXAMROOM
PATIENTBIRTHDATE
MODALITIES
BODYPARTS
IMAGES
AGE
SEX
CONFLICT
STUDYID
FILESETID
ISSUER
SCHEDULEDLATERALITY
LOCATION
PROCEDURECODE
DATETIMEREAD
DURATION
FILM
BURNCD
MAIL
COURIER
AUTOFAXLIST
AUTOEMAILLIST
SCHEDULEDRESOURCE
ACCOUNTSTATUS
LANGUAGE
FINANCIALTYPE
STATE
INSURANCEPAYERS
INSURANCEEXPIRIES
COMMENTS
ALLERGIES
CANCELLATIONREASON
CELLPHONE
HOMEPHONE
AUTHORIZATIONNUMBER
DATEOFSURGERY
RECEIVEDTIME
INTERNALVISITID
SMOKINGSTATUS
我真的不确定这可能是从哪里来的,而且我似乎找不到直接适用于 Google 的内容;那里的大多数结果似乎都涉及在查询中使用派生的 tables 或 SELECT *
。
TL;DR:这是 Jaybird 中的一个错误。我已经创建了错误 JDBC-391 and this has been fixed in Jaybird 2.2.8。
在堆栈跟踪中调用的 execute
方法是 execute(String, int)
,通常只在应该 return 生成密钥的 update/insert 中调用。好像 Cold Fusion 总是这样称呼它(值 Statement.RETURN_GENERATED_KEYS
)。
在 Jaybird 中处理生成的键的实现假定其内部语句解析器在遇到 SELECT
语句时抛出异常;如果发生这种情况,则应不加修改地处理查询。不幸的是,没有针对此假设的测试,并且当解析过程中发生错误时解析器实际上不会抛出异常(它们以不同的方式发出信号)。结果,SELECT
查询通过附加 RETURNING
子句进行了修改,当查询随后被发送到服务器时,这是一个语法错误。
我不确定是否有解决此问题的方法,除非恢复到 Jaybird 2.1.6,因为这个问题自 Jaybird 2.2.0 最初实施以来就一直存在。您还可以检查 Cold Fusion 是否有任何配置可以修改它执行查询的方式。
这已在 Jaybird 2.2.8 中修复。
披露:我是 Jaybird 的开发者之一。