February 1, 2018 at 5:26 am
-- I am posting here as well as the Development Forum as I realized this is more of an administration issue...hope that's OK
Hi there
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 = '
source("V:\\HelloWorld.R")'
EXECUTE sys.sp_execute_external_script
@language = N'R'
,@script = @rscript
February 8, 2018 at 10:51 am
You should setup a local share and have all the scripts saved there instead of UNC.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply