none
How to use ADO.NET with R? RRS feed

  • Question

  • I am using ADO.NET instead of the SQL native client in all my PowerShell scripts. Now looking for a way using ADO.NET with R as well. Currently, I am using the RODBC package using the SQL native client with R. Is there a way to access .NET functions from R?
    Thursday, January 9, 2020 8:55 AM

Answers

  • I am using ADO.NET instead of the SQL native client in all my PowerShell scripts. Now looking for a way using ADO.NET with R as well. Currently, I am using the RODBC package using the SQL native client with R. Is there a way to access .NET functions from R?

    I assume you are asking if you can connect from R to SQL Server using ADO.NET, not if you can call some R method from ADO.NET?

    If it is the former, (from R to SQL Server), how do you connect today; do you use the dbConnect function:

    library(odbc)
    
    con <- dbConnect(driver, some arguments)
    
    //do something with con

    If so, no - you cannot use ADO.NET as the library you use, (odbc for example), has to be DBI compliant, and ADO.NET is not, (AFAIK).

    Why would you want to use ADO.NET, or rather - what does ADO.NET give you that RODBC does not? Depending on the Microsoft R framework you run in you can potentially also look at the RevoScaleR framework.


    http://www.nielsberglund.com | @nielsberglund

    Friday, January 10, 2020 3:46 AM

All replies

  • I am using ADO.NET instead of the SQL native client in all my PowerShell scripts. Now looking for a way using ADO.NET with R as well. Currently, I am using the RODBC package using the SQL native client with R. Is there a way to access .NET functions from R?

    I assume you are asking if you can connect from R to SQL Server using ADO.NET, not if you can call some R method from ADO.NET?

    If it is the former, (from R to SQL Server), how do you connect today; do you use the dbConnect function:

    library(odbc)
    
    con <- dbConnect(driver, some arguments)
    
    //do something with con

    If so, no - you cannot use ADO.NET as the library you use, (odbc for example), has to be DBI compliant, and ADO.NET is not, (AFAIK).

    Why would you want to use ADO.NET, or rather - what does ADO.NET give you that RODBC does not? Depending on the Microsoft R framework you run in you can potentially also look at the RevoScaleR framework.


    http://www.nielsberglund.com | @nielsberglund

    Friday, January 10, 2020 3:46 AM
  • Thx for clarifying. My intend to use ADO.NET was to be independent of the SQL driver. Understood that I'd better stick with RODBC.
    Friday, January 10, 2020 8:36 AM