- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Execute Stored Procedure of MSSQL in Nifi
- Labels:
-
Apache NiFi
-
Apache Spark
Created ‎06-20-2017 03:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
I am trying to configure nifi Execute Process to connect to MSSQL and execute the store procedure .
I followed this link https://community.hortonworks.com/questions/26170/does-executesql-processor-allow-to-execute-stored.... where in @M. Mashayekhi has provided the steps how he connected to MSSQL and executed the Stored Procedure.
@Mashayekhi , I wanted to know how your execute process configuration screen looks like and also please let me know if any additional client tools are required to be installed so that I can execute the stored procedure.
Thank you.
Created ‎06-20-2017 07:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to the approach (sqlplus with ExecuteProcess / ExecuteStreamCommand) mentioned in the other post, you could also connect via a scripting language using ExecuteScript, calling Connection.prepareCall() and such as described here. I have an example on how to interact with SQL using Groovy and ExecuteScript here.
Created on ‎06-18-2021 05:28 PM - edited ‎06-18-2021 05:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very old question, but since googling led me here I'd like to share my own perspective with others who arrive later.
The simplest solution is using the PutFile processor.
You can simply enter your EXEC or EXECUTE statement, see screenshot and T-SQL code below:
I used this sample code to test it:
USE [your database configured in the JDBC Connection Pool];
SELECT GETDATE() AS currentdate
INTO dbo.testtable;
GO
--procedure used in NiFi PutFile processor
CREATE PROCEDURE dbo.insertdate
AS
BEGIN
INSERT INTO dbo.testtable
SELECT GETDATE();
END
GO
Created on ‎03-09-2022 11:32 PM - edited ‎03-09-2022 11:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help.
Please, are you talking about PutSQL Processor.
I have a procedure to run in a DB against an incoming flow files.
Please, are you saying i will call the procedure name using the EXEC command.
Thanks
Created ‎12-02-2022 05:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I meant PutSQL
Created ‎12-02-2022 05:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@dominikschauer : I tried to use PutSQL processor to run a Postgres procedure. Unfortunately, i ended up with an error. I have given the details in the below thread
Could you please help.
Thanks
Mareena
Created on ‎09-13-2023 05:58 AM - edited ‎09-13-2023 05:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can we capture the output parameter values from the MSSQL stored procedure using PUTSQL? like?
Created ‎09-13-2023 06:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I dont think you can use PutSQL for this. Try ExecuteSQL or you might have to use ExecuteScript processor as other posts suggest:
https://stackoverflow.com/questions/72348844/get-output-of-stored-procedure-using-putsql-in-nifi
If that helps please accept solution.
Thanks
