title: How to connect Ms SQL server with R on Ubuntu 16.04?
body: <p>I am unable to connect R with MS sql using RODBC as well as RJDBC</p>
  
  <p><strong>With RODBC</strong></p>
  
  <pre><code>library(RODBC)
  dbhandle &lt;- odbcDriverConnect(paste("driver={SQL Server};server=", sname, ";database=", 
                                        dbname, ";uid=", user,";pwd=",password, sep = ""))
  
  res &lt;- sqlFetch(dbhandle, client.table_name) 
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <pre><code>Warning messages:
  1: In odbcDriverConnect(paste("driver=SQL Server;server=", sname, ";database=",  :
    [RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found
  2: In odbcDriverConnect(paste("driver=SQL Server;server=", sname, ";database=",  :
    ODBC connection failed 
  </code></pre>
  
  <p>Also I have tried with <strong>RJDBC</strong></p>
  
  <pre><code>library(rJava)
  library(RJDBC)
  
  drv &lt;- JDBC(driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver",
                    classPath="/home/****/sqljdbc_4.2/enu/jre8/sqljdbc42.jar")
  conn &lt;- dbConnect(drv, paste0("jdbc:sqlserver://",client.hostname),
                          user=client.username , password=client.password, dbname = client.dbName)
  </code></pre>
  
  <p>The error is</p>
  
  <pre><code>Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 
    com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:253fd8d2-8e60-40fb-96b0-220745818166".
  </code></pre>