none
Argument is not an open RODBC channel RRS feed

  • Question

  • I am getting "Error in odbcGetInfo(myconn) : argument is not an open RODBC channel" error when I execute  

    following code...

    remoteLogin("http://SERVER11:12800", username = "admin",password = "MYPWD")
    library(RODBC)
    query <- "select top 10 * from sysobjects"

    myconn <- odbcDriverConnect("driver={SQL Server};server=DBSEWRVER;
    database=Dev_DB;trusted_connection=true")
    odbcGetInfo(myconn)

    pundat <- sqlQuery(myconn, query)
    close(myconn)


    satyaganti

    Friday, April 21, 2017 11:39 AM

Answers

  • The problem was with the owner of RServer 9.0.0 service and under which credentials it was running. Modified the credentials and above code started working


    satyaganti

    • Marked as answer by Satyaganti Thursday, May 11, 2017 10:06 AM
    Thursday, May 11, 2017 10:06 AM

All replies

  • The problem was with the owner of RServer 9.0.0 service and under which credentials it was running. Modified the credentials and above code started working


    satyaganti

    • Marked as answer by Satyaganti Thursday, May 11, 2017 10:06 AM
    Thursday, May 11, 2017 10:06 AM
  • Dear Satyaganti,

    How did you modify the credentials. Please help out . My code works fine when invoked from R but not from SSMS.

    The code I am trying to run from SQL is 

    EXECUTE sp_execute_external_script
          @language = N'R'
        , @script = N'
            library(qmR);
            mydata<-spr_utl_compute_correlations(stockList = ''db_Cushing.dbo.TEMP_AAA'', yearsOfAnalysis = ''2'', frequencyOfAnalysis = ''W'', runParallel = ''YES'');
            OutputDataSet <- as.data.frame(mydata);'
        , @input_data_1 = N' ;'
    WITH RESULT SETS (([Col1] varchar(max) not null,[Col2] varchar(max) not null,[Col3] varchar(max) not null,[Col4] varchar(max) not null ));

    The Error I am getting is 

    Error in sqlQuery(con, sqlText) : 

    Msg 39019, Level 16, State 2, Line 0
    An external script error occurred: 
      first argument is not an open RODBC channel
    Calls: source ... eval -> eval -> spr_utl_compute_correlations -> sqlQuery
    In addition: Warning messages:
    1: In odbcDriverConnect(connString) :
      [RODBC] ERROR: state 28000, code 18456, message [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'SWCADEV01\QMDBDEV01'.
    2: In odbcDriverConnect(connString) : ODBC connection failed

    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

    Please note that there is no user like SWCADEV01\QMDBDEV01. The closest to this name is the sql server name SWCADEV01\QMDBDEV

    Many thanks. 

    Tuesday, July 23, 2019 11:55 PM
  • Hello Abhijat,

    It looks like you probably have not enabled the implied authentication for the R worker accounts. Please see the documents below for more information:

    Implied authentication (loop back requests)

    Create a login for SQLRUserGroup - In your case this should be 'SQLUserGroupQMDBDEV'

    Hope this helps.

    Monday, July 29, 2019 8:37 PM