Apache NiFi DBCPConnectionPool ORA-00933: SQL 命令未正确结束 'select 1 from dual;'

Apache NiFi DBCPConnectionPool ORA-00933: SQL command not properly ended for 'select 1 from dual;'

我是 运行 在 NiFi 上使用 ExecuteSQL 对 Oracle 12c 进行简单查询:

SELECT 1 FROM DUAL; https://pasteboard.co/JCkMVmR.png

配置 - DBCPConnectionPool 1.11.4: https://pasteboard.co/JCkiOnr.png

并出现以下错误:

https://pasteboard.co/JCjGreC.png

org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: Cannot create PoolableConnectionFactory (ORA-00933: SQL command not properly ended
)
    at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:444)
    at org.apache.nifi.dbcp.DBCPService.getConnection(DBCPService.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)
    at com.sun.proxy.$Proxy138.getConnection(Unknown Source)
    at org.apache.nifi.processors.standard.AbstractExecuteSQL.onTrigger(AbstractExecuteSQL.java:236)
    at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
    at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1176)
    at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
    at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent.run(TimerDrivenSchedulingAgent.java:117)
    at org.apache.nifi.engine.FlowEngine.run(FlowEngine.java:110)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (ORA-00933: SQL command not properly ended
)
    at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:669)
    at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:544)
    at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
    at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:440)
    ... 20 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)

NiFi nifi-1.11.4-RC1
甲骨文 12.2.0.1.0
ojdbc8.jar (12.2.0.1)
DBCPConnectionPool 1.11.4

对此有何建议?提前致谢!

编辑

按照评论中的建议,尝试了 没有 分号 ; 的版本并得到了不同的错误: org.apache.nifi.processor.exception.ProcessException: org.apach e.avro.SchemaParseException: Illegal initial character: 1

要使用 dual,您需要为返回值设置一个名称,以便结果可以映射到有效的 avro 模式。例如

select 1 as test from dual

which returns test: 1 而不仅仅是 1.