# Working with MS SQL server on non-windows systems

· by Dmitriy Selivanov · Read in about 1 min · (178 words)

As I know, there are few choices to connect from R to MS SQL Server:

But only second option can be used on mac and linux machines. Here is nice stackoverflow thread.

Most of the people suggest to use microsoft sql java driver. But there is a case when this will not help - windows domain authentification. In this situation I found the only working solution is to use nice jTDS. It not only solve this problem, but also outperform Microsoft JDBC Driver.

So to use it you have to:

1. Install rJava. There are a lot of manuals for diffrent OS on the internet.
2. Install RJDBC.

Now you can easily connect to your source:
(assume jtds-1.3.1, which is unpacked into ~/bin )

drv <- JDBC("net.sourceforge.jtds.jdbc.Driver" ,
"~/bin/jtds-1.3.1-dist/jtds-1.3.1.jar")