简体   繁体   中英

Apache NiFi not able to connect to Oracle 12c using ojdbc6.jar or ojdbc8.jar

We are trying to connect to an Oracle 12c database from Apache NiFi. But it simply does not work: We get the following error:

bdc2314a-669e-1e85-875c-73b035db9ba5
ExecuteSQL[id=bdc2314a-669e-1e85-875c-73b035db9ba5] Unable to execute SQL select query select * from ETSETTRA.APB where rownum < 10 due to java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@//osiXXXX:1521/UTSOFTP'. No FlowFile to route to failure: org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@//osiXXXX:1521/UTSOFTP

The configuration is as follow,. and I have tried a lot of other combination

驱动程式设定

This should be straight forward?

Full stack trace

org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@osi3454:1521/UTSOFTP'
    at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:474)
    at org.apache.nifi.dbcp.DBCPService.getConnection(DBCPService.java:49)
    at sun.reflect.GeneratedMethodAccessor701.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)
    at com.sun.proxy.$Proxy126.getConnection(Unknown Source)
    at org.apache.nifi.processors.standard.AbstractExecuteSQL.onTrigger(AbstractExecuteSQL.java:222)
    at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
    at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1162)
    at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:209)
    at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
    at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@osi3454:1521/UTSOFTP'
    at org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2224)
    at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2104)
    at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
    at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:470)
    ... 19 common frames omitted
Caused by: java.sql.SQLException: No suitable driver
    at org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2216)
    ... 22 common frames omitted

I think the driver name is not correct:

oracle.jdbc.driver.OracleDriver

vs.

oracle.jdbc.OracleDriver

Difference between Oracle jdbc driver classes?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM