使用Firebird RDBMS和ColdFusion 11查询错误

时间:2015-04-20 15:32:33

标签: coldfusion firebird coldfusion-11 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)  

以下是表格中的字段列表:

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 *来处理的。

1 个答案:

答案 0 :(得分:3)

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

stacktrace中调用的execute方法是execute(String, int),通常只调用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的开发者之一。