[R] RODBC 1.3-5 under cygwin 1.7.12-1

Dario Buttari dario.buttari at gmail.com
Fri Apr 27 20:30:27 CEST 2012

I am using R 2.14.2-1 under cygwin 1.7.12-1 in Windows 7 Professional
Service Pack 1.

In the past I found very desirable to modify the RODBC package to
access the Windows ODBC connections in R under cygwin:

This enables NTLM authenticated connections to Oracle and sql server
databases using the Windows ODBC drivers.
I would like to propose the patch below to the RODBC 1.3-5 package maintainers.
The patch is pretty much an exact copy of an old patch present in
cygwin-ports: http://cygwin-ports.git.sourceforge.net/git/gitweb.cgi?p=cygwin-ports/R-RODBC;a=summary

I would like to point out that R is now part of the std cygwin
packages: http://cygwin.com/packages/
In using R under cygwin just because I found that combining R to the
unix command line is quite powerful and convenient.
Thanks, Dario

Modify RODBC\src\RODBC.c in RODBC_1.3-5.tar as follows:
--- RODBC.c_bk  2012-03-08 22:01:02.000000000 -0800
+++ RODBC.c     2012-04-22 09:14:54.353868700 -0700
@@ -41,6 +41,12 @@
 #include <string.h>
 #include <limits.h> /* for INT_MAX */

+#ifdef __CYGWIN__
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32
 #define MAX_CHANNELS 1000
 #include <sql.h>
 #include <sqlext.h>

Installation procedure under Cygwin to access the windows ODBC DNSs:
export ac_cv_search_SQLTables="-lodbc32"
R CMD INSTALL RODBC_1.3-5.tar.gz

More information about the R-help mailing list