PDA

View Full Version : Calling CommitCRM API from SQL Agent Job console command step


CraigYellick
May 22nd, 2020, 01:09 PM
I have a .Net console .exe app that runs fine on a SQL Server server. It successfully connects to the CommitCRM API and does what it's supposed to do.

However, if I try the same thing from within a SQL Agent Job, it fails:

Unable to load DLL 'CmtDbEng.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'CmtDbQry.dll': The specified module could not be found.

To make certain this is not a permissions issue, I had the SQL Agent run with the same user account that tested successfully. Obviously the .DLL *does* exist since it works fine outside of the SQL Agent.

Anyone ever done anything like this? I'm stumped.

-- Craig

Support Team
May 25th, 2020, 06:02 AM
Thank you for posting this.

This issue may be related to using older DLLs while running from SQL Agent.

The latest DLLs are located under the ThirdParty\UserDev folder.

It is possible that your custom app is not able to copy the newer DLLs from that folder and you may try copy them manually from ThirdParty\UserDev\

As an alternative, you may consider changing the application to use the files from \ThirdParty\UserDev folder.

Hope this helps.

CraigYellick
May 26th, 2020, 12:55 PM
I am pointing the app at the UserDev folder so that ought to be the latest.

Also, note that the app runs perfectly find from a command window on the SQL Server, so I assume it would get the same error if the DLLs were inaccessible or out of date.

Must be something about the execution context under SQL Agent, but I don't see what that could be since I'm using the same user account that tested fine.

Support Team
May 27th, 2020, 06:00 AM
We may need to review the log files in order to learn more about this issue.
Please zip the folder <installation_folder>\Logs and email it to us (Support@) or share over Drive/Dropbox.

Hope this helps.