Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Error while executing SQLR\Campaign_Optimization.ps1 #15

Description

I tried to execute the powershell script SQLR\Campaign_Optimization.ps1 on MSSQL 2017. In the step 3b, I'm getting this error

Invoke-Sqlcmd : A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
An external script error occurred:
During startup - Warning message:
In setJsonDatabasePath(system.file("extdata/capabilities.json", :
bytecode version mismatch; using eval
[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied.
[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Connect()).
Could not open data source.
Error in doTryCatch(return(expr), name, parentenv, handler) :
Could not open data source.
Calls: source ... tryCatch -> tryCatchList -> tryCatchOne -> doTryCatch -> .Call
Error in execution. Check the output for more information.
Error in eval(expr, envir, enclos) :
Error in execution. Check the output for more information.
Calls: source -> withVisible -> eval -> eval -> .Call
Execution halted
STDOUT message(s) from external script:
[Microsoft][ODBC Driver Manager] Connection not open
ODBC Error in SQLDisconnect
At D:\mssql-r\r-server-campaign-optimization\SQLR\Campaign_Optimization.ps1:79 char:5

  • Invoke-Sqlcmd -ServerInstance $ServerName  -Database $DBName -Use ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
    • FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

The user I used for this execution is the DB owner and I granted script execution permissions as mentioned here
https://docs.microsoft.com/en-us/sql/advanced-analytics/security/user-permission?view=sql-server-ver15

Can you help me with a work around ?

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions