I am trying to use RODBC to connect to a SQL Server database from R under cygwin.
I installed libiobbc and libiodbc-devel , which, as I understand it, provide the driver manager who needs the RODBC package.
I installed freetds , which, as I understand it, provides an ODBC driver that can connect to the MS SQL server database. I used my tsql command-line tsql to confirm that I can connect to SQL Server.
Now I understand the task of pointing the driver manager (iODBC) to the driver (freeTDS) so that I can connect to the SQL Server database from the R RODBC library
The freeTDS user guide indicates that the driver that freeTDS provides should be in /usr/local/freetds/lib/libtdsodbc.so , and something like the following should define this driver for idobc:
But I don't have libtdsodbc.so on my system and it seems that the cygwin freetds package freetds not provide it ( list of installed binaries and support files )
How to configure idobc to use the freeTDS driver to connect to MS SQL?
EDIT
A colleague located /lib/cygtdsodbc.dll and /usr/lib/cygtdsodbc.dll on my system. Perhaps this is the equivalent of cygwin libtdsodbc.so ?
I created an odbcinst.ini file with the following contents to determine the driver:
[ODBC Drivers] FreeTDS = Installed [FreeTDS] Driver = /usr/lib/cygtdsodbc.dll
and the odbc.ini file that defines the my_db data my_db using the driver above:
[ODBC Data Sources] my_db = FreeTDS [my_db] Driver = /usr/lib/cygtdsodbc.dll Database = db_name Host = server_dns_name Port = 1433
running iodbctest to check something gives
$ iodbctest iODBC Demonstration program This program shows an interactive SQL processor Driver Manager: 03.52.0812.0326 Enter ODBC connect string (? shows list): ? DSN | Driver ------------------------------------------------------------------------------ my_db | FreeTDS Enter ODBC connect string (? shows list): my_db 1: SQLDriverConnect = [iODBC][Driver Manager]Driver SQLAllocEnv() failed (0) SQLSTATE=IM004 1: ODBC_Connect = [iODBC][Driver Manager]Driver SQLAllocEnv() failed (0) SQLSTATE=IM004