Make sure you have all dependencies installed: sudo apt-get install libssl1.0.0 libkrb5-3 glibc-2.13-1 e2fsprogs openssl libkrb5-3
Also check that you have wget (sudo apt-get install wget).
To update you unixodbc version (through the repositories you will have an older version installed) run the command as sudo bash build_dm.sh. I have no clue why it does not seem to work with the ./ prefix, for some reason I need to give the full reference to bash. The installer gives further instructions to make install unixodbc 2.3.
Now install the actual driver: sudo bash install.sh install --accept-license --force
the --force flag is important because otherwise it will complain that there is no rpm installed on the system (which there is not on Ubuntu). This was a tip from Andrew K again.
The installer updated the /etc/odbcinst.ini file to include the driver like so it should now include:
[ODBC Driver 11 for SQL Server]
Description=Microsoft ODBC Driver 11 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2270.0
Threading=1
UsageCount=2
Seeing this is a check that installation went through correctly.
Now another tip from
onefinepub is required otherwise it will not work:
sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.10
sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.10
Now make sure that you configure you odbc.ini to make a DSN that connects using the new driver. It will contain the following:
[ConnectionName]
Driver = ODBC Driver 11 for SQL Server
Description = ODBC connection to MSSQL Database via the Microsoft Driver
Trace = No
Server = xxx
Servername = xxxx
Database = xxx
Trace = No
But it will not contain a username and password. You will have to pass that through to the database server when making the connection (
see this post).
Having done all this your R will look like:
> library(RODBC)
> sqlconnection <- odbcConnect(dsn="DBNAME", uid="UserName", pwd="Pass")