Update dataset from SQL trigger

Hi Dears,

 

I´m trying to update my dataset with this instrunction inside a trigger:

EXEC @result = xp_CMDShell 'C:\"Program Files"\"ABBYY FlexiCapture 12 Servers"\FlexiBrSvc.exe please update dataset "http://localhost/20/TestSinProveedorSociedad" "Invoice ES" "BusinessUnits"'

But it returns as follows:

Access denied. Contact your Administrator.

I have checked Windows Event Viewer and I see the nex error:

ABBYY FlexiCapture Web Services
Access denied. Contact your Administrator.
 
If I execute this command in cmd windows it works fine, but not from SQL trigger.
 
Can you help me?
 
Thanks in advance!

Was this article helpful?

0 out of 0 found this helpful

Comments

2 comments

  • Avatar
    Scott Chau

    This is probably an issue with account you're running the shell command under and not related to FlexiCapture.

    https://stackoverflow.com/questions/10822464/access-denied-for-enabled-xp-cmdshell-for-the-admin-user/10823070

    0
  • Avatar
    Fernando Yubero

    Hi Scott,

    Thanks for your help.

    Finally I could to execute the trigger adding the user to FlexiCapture. But now, I can see the task finish in error state. a time out error:

    This is the trigger:

    /****** Object: Trigger [dbo].[UPDATE_DATASET_BUSINESSUNITS] Script Date: 08/10/2021 12:07:50 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER TRIGGER [dbo].[UPDATE_DATASET_BUSINESSUNITS]
    ON [dbo].[NLP_UNIDADES_NEGOCIO]
    AFTER INSERT
    AS
    BEGIN
    DECLARE @result int;
    DECLARE @log nvarchar(50);
    --EXEC @result = xp_CMDShell '\\localhost\Users\km\TestSinProveedorSociedad\"Update datasets"\update_business_units.bat';
    EXEC @result = xp_CMDShell 'cd..';
    if(@result = 0)
    SET @log = 'Success'
    else
    SET @log = 'Error';
    INSERT INTO NLP_UPDATE_LOG (LOG) VALUES (@log);
    END

    And the .bat file is like follows:

    cd C:\Program Files\ABBYY FlexiCapture 12 Servers
    FlexiBrSvc.exe please update dataset "http://localhost/20/TestSinProveedorSociedad" "Invoice ES" "BusinessUnits"

    Have you any idea about what is wrong?

    Thanks!

    0

Please sign in to leave a comment.