Running SQL Query in unattended mode

Hello All, I have an automation that connects to a SQL server database, runs query and returns the output as expected in attended mode (on my laptop). However, when I run the automation in an unattended mode on a virtual machine with a service account, the activity that runs the query fails with the below error.

‘Login failed for user XYZ’

I ensured the service account has access to the database, was able to verify in SQL Server Management Studio (SSMS). But, I am not sure why when it runs in unattended mode I get the above error. Can someone please help? Are there any prerequisites (like drivers, SSMS, etc that need to be installed on the virtual machine where this automation is running in unattended mode). I am using Windows authentication to connect to the database (below screenshot)

@ASRG

You do need drivers for connecting to sql server…

I believe on dev you would have installed ssms so with that the drivers would have been installed…

Try installing the drivers or ssms on the target machine
Cheers

Hi Anil_G, Thank you for your reply. I was passing an incorrect connection string from the config file and that is the reason why I kept getting an error. Apparently, I do not need the drivers or SQL server installed as the query seems to work just fine.

1 Like