Consider the following scenario:
- Database server: DBServer
- R Server: RServer
- Orchestrator Server: Server1
We have following R Script (DB.r):
lib.directory = "D:\\RTest"
install.packages("RODBC", repos = "http://cran.us.r-project.org", lib = lib.directory)
library(RODBC, lib.loc = lib.directory)
db.string <- "driver={ODBC Driver 13 for SQL Server};server=DBServer;database=Databse1;trusted_connection=Yes;"
db.channel <- odbcDriverConnect(db.string)
close(db.channel)
Server1 executs the R script remotely on R Server using the following code:
PsExec.exe \\RServer "C:\Program Files\R\R-3.4.3\bin\Rscript.exe" "D:\RTest\DB.r"
I get the following error:
[RODBC] ERROR: state 28000, code 18456, message [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
How can we resolve this error without sending username and password as part of PsExec?
We are open to use any alternative way to replace PsExec.