2

所以我在 Windows 2012 服务器上安装了 Adob​​e 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)  

以下是表中字段的列表:

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 上找到直接适用的东西;那里的大多数结果似乎都是使用派生表或SELECT *在查询中处理的。

4

1 回答 1

3

TL;DR:这是 Jaybird 中的一个错误。我创建了错误JDBC-391,这已在Jaybird 2.2.8中修复。

在堆栈跟踪中调用的execute方法execute(String, int)通常只在更新/插入时调用,它应该返回生成的键。看起来 Cold Fusion 总是这样称呼它(带有 value Statement.RETURN_GENERATED_KEYS)。

在 Jaybird 中处理生成的键的实现假定其内部语句解析器在遇到SELECT语句时会抛出异常;如果发生这种情况,则应不加修改地处理查询。不幸的是,没有对这个假设进行测试,当解析过程中发生错误时,解析器实际上不会抛出异常(它们以不同的方式发出信号)。结果,SELECT通过附加一个RETURNING子句来修改查询,当查询随后被发送到服务器时,这是一个语法错误。

我不确定是否有解决此问题的方法,除了可能恢复到 Jaybird 2.1.6,因为自 Jaybird 2.2.0 的初始实施以来,此问题一直存在。您还可以检查 Cold Fusion 是否有任何配置会修改其执行查询的方式。

这已在 Jaybird 2.2.8 中修复。

披露:我是 Jaybird 的开发人员之一。

于 2015-04-20T18:45:48.187 回答