0
votes

I am getting the following error when running my QueryDatabaseTableRecord- processor:

Unable to execute sql select query SELECT * FROM example_database due to you have an error in your sql syntax; check the manual that corresponds to your MySQL Server Version for the right syntax to use near example_database at line 1

My processor config looks like this:

processor

I know that the MySQL Connector is configured correctly because I can connect to the database itself. The main issue seems to be the table name. I fear it's because my name includes underscores (which should be alright though, considering general MySQL naming conventions). I've tried substituting underscores with ".", using different quotation marks but nothing works. I am 100% certain that the table name itself (substituted by an example in the picture) is correct.

Can anyone help?

Edit: I've added the config for the MySQL Connector below. Pool config

Edit: I have now also used the DEBUG- Mode and get the following error message:

2021-04-15 12:36:45,758 ERROR [Timer-Driven Process Thread-3] o.a.nifi.processors.standard.ExecuteSQL ExecuteSQL[id=b37c3f9a-6d28-1cf1-8271-58bb0a04c935] Unable to execute SQL select query SELECT * FROM example_table due to java.sql.SQLSyntaxErrorException: Table 'database.example_table' doesn't exist. No FlowFile to route to failure: java.sql.SQLSyntaxErrorException: Table 'database.example_table' doesn't exist
java.sql.SQLSyntaxErrorException: Table 'database.example_table' doesn't exist
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
    at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:370)
    at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
    at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    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:254)
    at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.access$100(StandardControllerServiceInvocationHandler.java:38)
    at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler$ProxiedReturnObjectInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:240)
    at com.sun.proxy.$Proxy155.execute(Unknown Source)
    at org.apache.nifi.processors.standard.AbstractExecuteSQL.onTrigger(AbstractExecuteSQL.java:267)
    at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
    at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1174)
    at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
    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)
2021-04-15 12:36:45,766 INFO [Timer-Driven Process Thread-3] o.a.n.p.store.WriteAheadStorePartition Successfully rolled over Event Writer for Provenance Event Store Partition[directory=./provenance_repository] due to MAX_TIME_REACHED
2021-04-15 12:36:46,449 INFO [NiFi Web Server-432] o.a.n.c.s.StandardProcessScheduler Stopping ExecuteSQL[id=b37c3f9a-6d28-1cf1-8271-58bb0a04c935]
2021-04-15 12:36:46,449 INFO [NiFi Web Server-432] o.a.n.controller.StandardProcessorNode Stopping processor: ExecuteSQL[id=b37c3f9a-6d28-1cf1-8271-58bb0a04c935]
2021-04-15 12:36:46,449 INFO [Timer-Driven Process Thread-10] o.a.n.c.s.TimerDrivenSchedulingAgent Stopped scheduling ExecuteSQL[id=b37c3f9a-6d28-1cf1-8271-58bb0a04c935] to run
2021-04-15 12:36:46,771 INFO [Flow Service Tasks Thread-1] o.a.nifi.controller.StandardFlowService Saved flow controller org.apache.nifi.controller.FlowController@4127e0c // Another save pending = false
2021-04-15 12:36:49,386 INFO [pool-12-thread-1] o.a.n.c.r.WriteAheadFlowFileRepository Initiating checkpoint of FlowFile Repository
2021-04-15 12:36:49,386 INFO [pool-12-thread-1] o.a.n.c.r.WriteAheadFlowFileRepository Successfully checkpointed FlowFile Repository with 0 records in 0 milliseconds
Please provide the connection pool's setup - Ben Yaakobi
@BenYaakobi: I've added the config. I've changed sensitive data into a substitute (marked by []) but that's the gist of it. - Corni
could you check the nifi-app.log file for farther error description? - Ben Yaakobi
Thanks for the suggestion! I added the error message above. - Corni
your db user in pool configuration don't have 'select grant' or 'access right' on 'database.example_table' - yaprak