Support Questions

Find answers, ask questions, and share your expertise

How to use a MySQL connector in a dockerized instance of NiFi?

avatar
Explorer

I run NiFi on a docker engine (official image). It works fine but now I would like as part of a flow to connect to a MySQL instance.

This requires me to configure a Database Driver Class Name. The value I found in an example on Internet (com.mysql.jdbc.Driver) requires a .jar (sorry, I know nothing about Java).

 

What is the proper way to make this file available to NiFi? (not on a docker level - I have a volume mounted and can put is over there, but on a NiFi level, i.e. how to make NiFi aware of this file)

1 ACCEPTED SOLUTION

avatar

@Wpq To enable nifi to use the mysql driver jar,  you should copy that jar file into the nifi node file system.  Additionally, the file will need to be owned by the same user running nifi.  For example:  usually the "nifi" user.  If you have a multi node cluster, the file should exist in all nodes in the same location.  Once you get into nifi UI. Configure a Database Connection Pool Controller Service referencing your driver.  When the path and permissions are right, you will be able to enable that Controller Service.  Once enabled you can use it with many processors such as ExecuteSQL.  

View solution in original post

2 REPLIES 2

avatar

@Wpq To enable nifi to use the mysql driver jar,  you should copy that jar file into the nifi node file system.  Additionally, the file will need to be owned by the same user running nifi.  For example:  usually the "nifi" user.  If you have a multi node cluster, the file should exist in all nodes in the same location.  Once you get into nifi UI. Configure a Database Connection Pool Controller Service referencing your driver.  When the path and permissions are right, you will be able to enable that Controller Service.  Once enabled you can use it with many processors such as ExecuteSQL.  

avatar
Explorer

@steven-matison thank you! I thought that I needed to somehow inject this jar into NiFi, in addition to providing it.