-- I am posting here as well as the Development Forum as I realized this is more of an administration issue...hope that's OK
We are using SQL Server 2016 with R Services (In Database) and are having issues trying to load an R script from a location on our network. For example: source("\\MyServer\MyRDirectory\HelloWorld.R").
We get this error: cannot open file 'V:\HelloWorld.R': No such file or directory
We believe it is a permissions issue as we have no problems accessing this file if copied to a local drive. My understanding is when using sp_execute_external_script, the code runs under the context of one of the local R users residing in the local SQLRUserGroup. As it is a local account, we had to play around with permissions to figure out a way around this. Essentially you have create a share and add the Everyone group to the share. You may also need to create an user account with the same name on the server that hosts the share. To test that the local R account could gain access to the share, we reset the password for the account and then logged onto the SQL server as that user. I then accessed the share and had no problems (initially i was being prompted for credentials but fixed this by creating an account with the same name on the server hosting the share). However, even though i can connect to the share when logged in the user, when running my script, it still fails with the SAME error
Has anyone experienced this and found a resolution?? We are pulling our hair out with this issue!
P.S. I have also tried mapping a local drive to the share under this local user account just in case there is an issue with accessing files via UNC, but still get the same error!
EDIT: Running the following R script in SQL Server 2016 (SSMS):
DECLARE @rscript AS NVARCHAR(250)
SET @rscript = '
@language = N'R'
,@script = @rscript