Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 953533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:04:02+00:00 2026-05-16T00:04:02+00:00

This is probably going to be an underspecified question, as I’m not looking for

  • 0

This is probably going to be an underspecified question, as I’m not looking for a specific fix:

I want to run a machine learning algorithm on some data in a SQL Server database. I’d like to use R to do the calculations — which would involve using R to connect to the database, process the data, and write a table of results back to the database.

Is this possible? My guess is yes. Shouldn’t be a problem using a client…

however, would it be possible to set this up on a linux box as a cron job?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:04:03+00:00Added an answer on May 16, 2026 at 12:04 am

    Yes to all!

    Your choices for scripting are either Rscript or littler as discussed in this previous post.

    Having struggled with connecting to MSSQL databases from Linux, my recommendation is to use RJDBC for database connections to MSSQL. I used RODBC to connect from Windows but I was never able to get it working properly in Linux. To get RJDBC working you will need to have Java installed properly on your Linux box and may need to change some environment variables (seems I always have SOMETHING mis-configured with rJava). You will also need to download and install the JDBC drivers for Linux which you can get directly from Microsoft.

    Once you get RJDBC installed and the drivers installed, the code for pulling data from the database will look something like the following template:

    require(RJDBC)
    drv <- JDBC("com.microsoft.sqlserver.jdbc.SQLServerDriver",
                "/etc/sqljdbc_2.0/sqljdbc4.jar")
    conn <- dbConnect(drv, "jdbc:sqlserver://mySqlServer", "userId", "Password")
    sqlText <- paste("
      SELECT  * 
      FROM SomeTable
           ;")
    myData  <- dbGetQuery(conn, sqlText)
    

    You can write a table with something like

    dbWriteTable(conn, "myData", SomeTable, overwrite=TRUE)
    

    When I do updates to my DB I generally use dbWriteTable() to create a temporary table on my database server then I issue a dbSendUpdate() that appends the temp table to my main table then a second dbSendUpdate() that drops the temporary table. You might find that pattern useful.

    The only “gotcha” I ran into was that I could never get a Windows domain/username to work in the connection sequence. I had to set up an individual SQL Server account (like sa).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably going to be a really simple fix... I just can't figure
Im sorry for this probably dumm question, but I want to simply open modals
This is probably going to be more of a discussion or hypothetical question, but
I'm probably going to get abuse for this question but here goes. Oh but
This is probably going to boil down to a philosophical question more than anything,
It's a theoretical question at this point in time, but something I'm probably going
this is probably going to seem like a daft question but please bear with
I know this question is probably going to get alot of Duplicate question comments
This is a question that's probably going to incur the wrath of some DBA
This is probably going to end up as a stupid question, but countless research

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.