To run a rather lengthy SQL query on Logic App, I saved it as a Stored Procedure in my database and then created jobs and steps to run the stored procedure as well as an owner and a target group for my job. I see my job, credentials, and target group on the Elastic Job Agent that I created to get my job to work.
When I run the query directly on the database, it runs successfully and takes about 28 minutes.
I run the job on my logic app. This means that I do not directly run the query, rather the created job that runs the stored procedure as a step.
But when I look in the Elastic Job Agent to see the result, I notice that it immediately times out. The query does not seem to execute. This I know because at the beginning of the query I empty a table and I do not see that take place.
As I mentioned, the Logic app is quite simple and it only runs this job.
The reason that I am doing all this is because of the time-out problem Logic App has for lengthy SQL queries. But now I get a timeout on Elastic Job Agent even faster than the 2-minute limit of the Logic App.
UPDATE:
When I look at the steps I went through to create credentials, I realize that I might have overlooked this step: Credentials for running jobs.
Does this mean that I should create a separate database for my jobs? There is only one database we are dealing with, which is the same that contains my tables.
UPDATE 2:
The Elastic Job agent I have created has my database assigned as Job database. So everything is apparently on the same db.
exec jobs.sp_start_job '<Your_Job_Name>'; SELECT * FROM jobs.job_executions WHERE is_active = 1 ORDER BY start_time DESC
and show us thelast_message
? Like this.