Connecting to MS SQL Server from R on Mac/Linux

前端 未结 6 970
北海茫月
北海茫月 2020-12-31 08:26

I\'m trying to connect to a Microsoft SQL Server from R on Mac/Linux, and I have problems with RJDBC. When I\'ve downloaded both Microsoft\'s driver and JTDS, but none of th

6条回答
  •  执念已碎
    2020-12-31 09:03

    I had the exact same problem. This is a jTDS solution:

    1. Download jTDS 1.2.8 and unzip it. Say it is saved at ~/Downloads/jtds-1.2.8-dist/jtds-1.2.8.jar. Note: Other versions may not work!
    2. From R, set up driver: drv <- JDBC("net.sourceforge.jtds.jdbc.Driver", "~/Downloads/jtds-1.2.8-dist/jtds-1.2.8.jar").
    3. Set connection object: conn <- dbConnect(drv, "jdbc:jtds:sqlserver://servername:port;DatabaseName=databasename", domain="windows domain", user="user", password="pwd").

    Here the field domain was messing things up. You can't put domain\username as your user. You have to define them separately according to the jTDS driver implementation.

提交回复
热议问题