- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
how to configure and connect mysql with nifi and perform some basic sql queries.
- Labels:
-
Apache NiFi
Created ‎01-03-2017 10:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to connect to mysql database through NIFI as I need to access the database and perform some queries. Currently the whole setup is running in my local windows machine and I am getting error with connectivity.
Created on ‎01-03-2017 02:51 PM - edited ‎08-19-2019 04:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What error are you getting and what approach are you using (and what version of NiFi/HDF)? I recommend setting up a DBCPConnectionPool controller service. Your settings for the controller service will depend on your MySQL instance, here is an example of one I use to connect to a local MySQL running on Docker, using test_schema as the database:
The "Database Driver Location(s)" property is set to a URL pointing at my mysql-connector-java-5.1.38-bin.jar. As of NiFi 1.0.0 (via NIFI-2604), this property can include a comma-separated list of folders and/or JARs, and need not be URLs (i.e. you can use relative path names, although according to this post I don't think having the Windows drive letter at the front will work).
Created on ‎01-03-2017 02:51 PM - edited ‎08-19-2019 04:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What error are you getting and what approach are you using (and what version of NiFi/HDF)? I recommend setting up a DBCPConnectionPool controller service. Your settings for the controller service will depend on your MySQL instance, here is an example of one I use to connect to a local MySQL running on Docker, using test_schema as the database:
The "Database Driver Location(s)" property is set to a URL pointing at my mysql-connector-java-5.1.38-bin.jar. As of NiFi 1.0.0 (via NIFI-2604), this property can include a comma-separated list of folders and/or JARs, and need not be URLs (i.e. you can use relative path names, although according to this post I don't think having the Windows drive letter at the front will work).
Created ‎01-05-2017 04:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matt,
Thanks for the solution. The dataflow has started working!! 🙂
Regards,
Aditya Hegde
Created ‎02-22-2017 09:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Aditya Hegde could you please tell me how did you perform the connection of mysql with nifi? I have to do the same. please provide the details of processor used by you.
Created ‎02-23-2017 11:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Find the attached files as a reference. If your nifi application and mysql server both are running in two different scopes, than look into port configuration. There should be proper connectivity.
Created ‎10-18-2017 08:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks this was useful, i just wanted to add one more point. Since i was new to nifii, ever after creating the controller, i was not sure why the processor could not be started. Then i figured out that controller needs to be enabled, so that the processor shows the "Start" option.
,This may be non trivial, but thought would help someone since I was struggling with the processor not being active even after creating the controller. You need to enable the controller service after creating them, so that you can start the processor.
Created ‎04-27-2018 01:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To learn why a process will not start, hover your cursor over the yellow triangle with exclamation mark and an error message will pop up to explain why it will not start. Then you will instantly know the problem.
Created ‎10-11-2018 05:50 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm following the instructions here, but I still can't seem to get it working.
I'm pointing to the same driver with the same driver class name.
However, my URL is a bit different.
I'm trying to connect to an AWS Aurora instance.
If I use a connection string like this:
jdbc:mysql://my-url.us-east-1.rds.amazonaws.com:1433;databaseName=my_db_name
I get the error below.
If I remove the port and db name, I get an error that says "Unable to execute SQL ... due to org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure"
Any ideas?
ExecuteSQL[id=df4d1531-3056-1f5a-9d32-fa30462c23ba] Unable to execute SQL select query <query> for StandardFlowFileRecord[uuid=7d70ed35-ae97-47e8-a860-0a2fa75fa2ef,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1538684794331-5, container=default, section=5], offset=939153, length=967],offset=0,name=properties.json,size=967] due to org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "1433;databaseName=my_db_name"'.); routing to failure: org.apache.nifi.processor.exception.ProcessException: org.apache.commons.dbcp.SQLNestedException...
Created ‎07-29-2020 04:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you get a solution to this . I am also getting a communication error . My Nifi Instance and Mysql are on the same linux server .
