Closed maXXis253 closed 1 year ago
Hi @maXXis253, could you please try granting ALL APPLICATION PACKAGES
read permissions to the file Test.txt
.
From an admin command prompt, run:
icacls "C:\TestDir\Test.txt" /grant *S-1-15-2-1:(OI)(CI)RX /T
Thanks @Aniruddh25, it did not work when I granted ALL APPLICATION PACKAGES to the file. But it did work when I granted the permission to the folder containing the file. This is great, thank you for you help.
I have registered external language myR in SQL2019 following tutorial using R v1.1 connector from R-lang-extension-windows-release.zip. When I execute script below, I'm getting Permission Denied error from R. If I run the same R script from R console, no problems reading file. Both Sql Server and Sql Server Launchpad accounts have full Read/Write access to folder and file. R version is 4.0.5
Similar file access works for SQL-Python connector.
EXEC sp_execute_external_script @language =N'myR', @script=N' myData = read.delim("C:\TestDir\Test.txt", header = FALSE) print(myData);'
Msg 39004, Level 16, State 20, Line 8 A 'myR' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004. STDOUT message(s) from external script: Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'C:\TestDir\Test.txt': Permission denied 2022-10-07 16:54:35.50 Exception occurred: Error evaluating: tryCatch( {
myData = read.delim("C:\TestDir\Test.txt", header = FALSE) print(myData); }, error = function(err) { stop(err); } );