Error While reading JSON data in SQL Server 2017

0

I need to use JSON data as source for my SSRS report. Before that I wanted to convert the data so i followed below steps , post that also I am getting error.

  1. Enable external scripts in SQL Server.
  2. Install Jsonlite package for SQL Server R Service.

I am using SQL Server 2017

Sample Code:

EXEC sp_execute_external_script
        @language = N'R'
       ,@script = N'library(jsonlite) 
  mydata <- fromJSON("https://jsonplaceholder.typicode.com/posts"  rel="nofollow")'
  , @output_data_1_name = N'mydata'
  WITH RESULT SETS ((userId int ,Id int , title varchar(max),body varchar(max)))

Error:

Msg 39004, Level 16, State 20, Line 0
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 0
An external script error occurred:
Error in open.connection(con, "rb") : Couldn't connect to server
Calls: source ... fromJSON_string -> parseJSON -> parse_con -> open -> open.connection

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

sql
json
sql-server
reporting-services
sql-server-2017
asked on Stack Overflow Mar 20, 2019 by user3498113 • edited Mar 20, 2019 by jarlh

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0