SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Permissions required to access network share when executing R code via sp_execute_external_script


Permissions required to access network share when executing R code via sp_execute_external_script

Author
Message
doodlingdba
doodlingdba
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2074 Visits: 666
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 Sad

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

Joe Torre
Joe Torre
SSCertifiable
SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)

Group: General Forum Members
Points: 6635 Visits: 1210
Are you running on a Windows Domain?
doodlingdba
doodlingdba
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2074 Visits: 666
Yes - i am running in a windows domain (the share is running on a file server in the domain). But the SQL R account is a local account on the server

Thanks
Doodles
Joe Torre
Joe Torre
SSCertifiable
SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)

Group: General Forum Members
Points: 6635 Visits: 1210
You need to run it under a domain account with adequate permissions to access the required share on the domain.
doodlingdba
doodlingdba
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2074 Visits: 666
You can't run it under a domain account. R security is configured under the scenes - it uses a local windows account (sets it up automatically when you install R Services (In-Database). I have managed to grant permissions to the share to the Everyone group, and create a local account with the same name on the server that hosts the network share - this gives the local account on my SQL server access to the share without problems - i have tested it by logging in as that local user on the SQL server. But the sp_execute_external_script command still fails with 'No such directory'. I think this is 'by design' or just overlooked by Microsoft. Other people have posted about the same issue without posing resolutions. Maybe SQL 2017 is different. For now i have resorted to using a local share....
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search