Hi to all. I have a problem to connect to an Excel database using RODBC. Namely, I am using 64-bit R 2.14.0, under Windows 7 and I tried following: library(RODBC)> channel <- odbcConnectExcel("results.xlsx")Error in odbcConnectExcel("results.xlsx") : odbcConnectExcel is only usable with 32-bit Windows # ok this is clear why it doesn't work> channel <- odbcConnectExcel2007("results.xlsx") # this wasone of proposals from old R help posts, but it doesn't work for me Warning messages: 1: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 2: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : ODBC connection failed After that as it suggested in R data import/export manual I installed AccessDatabaseEngine.exe. Also I used ODBC in c:\Windows\SysWOW64\odbcad32 to create data source called result. I check if it is created:> odbcDataSources()dBASE Files "Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)" MS Access Database "Microsoft Access Driver (*.mdb, *.accdb)" Excel file "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" * results* "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" and tried again but it doesn't work:> channel <- odbcDriverConnect()Warning messages: 1: In odbcDriverConnect() : [RODBC] ERROR: state IM014, code 0, message [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application 2: In odbcDriverConnect() : ODBC connection failed Could someone guide me what should I try next to fix a problem? Is this some problem with Drivers or not? Thanks in advance Andrija [[alternative HTML version deleted]]
R. Michael Weylandt <michael.weylandt@gmail.com>
2011-Dec-04 18:41 UTC
[R] RODBC connect to Excel (64-bit Windows 7)
Do you need to use RODBC specifically? I've been using XLConnect quite a lot recently and have been quite pleased with it. Michael On Dec 4, 2011, at 9:40 AM, andrija djurovic <djandrija at gmail.com> wrote:> Hi to all. > I have a problem to connect to an Excel database using RODBC. > Namely, I am using 64-bit R 2.14.0, under Windows 7 and I tried following: > library(RODBC) >> channel <- odbcConnectExcel("results.xlsx") > Error in odbcConnectExcel("results.xlsx") : > odbcConnectExcel is only usable with 32-bit Windows # ok this is > clear why it doesn't work >> channel <- odbcConnectExcel2007("results.xlsx") # this was > one of proposals from old R help posts, but it doesn't work for me > Warning messages: > 1: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : > [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver > Manager] Data source name not found and no default driver specified > 2: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : > ODBC connection failed > > After that as it suggested in R data import/export manual I > installed AccessDatabaseEngine.exe. Also I used ODBC in > c:\Windows\SysWOW64\odbcad32 to create data source called result. I check > if it is created: >> odbcDataSources() > dBASE Files > "Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)" > MS Access Database > "Microsoft Access Driver (*.mdb, *.accdb)" > Excel file > "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" > * results* > "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" > > and tried again but it doesn't work: > >> channel <- odbcDriverConnect() > Warning messages: > 1: In odbcDriverConnect() : > [RODBC] ERROR: state IM014, code 0, message [Microsoft][ODBC Driver > Manager] The specified DSN contains an architecture mismatch between the > Driver and Application > 2: In odbcDriverConnect() : ODBC connection failed > > > Could someone guide me what should I try next to fix a problem? Is this > some problem with Drivers or not? > > Thanks in advance > > Andrija > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
andrija djurovic <djandrija <at> gmail.com> writes:> > Hi to all. > >...... > > Thanks in advance > > AndrijaI am having the exact same problem. Any luck with this yet?
On Sun, Dec 4, 2011 at 9:40 AM, andrija djurovic <djandrija at gmail.com> wrote:> Hi to all. > ?I have a problem to connect to an Excel database using RODBC.There are tips for RODBC as well as some alternatives listed here: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com