[R] Query about RODBC to access MySQL from Windows

lalitha viswanath lalithaviswanath at yahoo.com
Wed May 2 17:31:28 CEST 2007


Hi
I am trying to use RODBC in R installed on Windows to
access MySQL database (on a linux box).
I set up a DSN and specified this DSN in R as follows
library(RODBC);
channel <- odbcConnect("mysqldsn");
RODB Connection 5
Details:
  case=nochange
  PORT=3306
........
Although this seems to connect properly, running any
command yields NO results.
i.e. sqlQuery(channel, "show tables") yields 0 rows
when there are close to 500 tables in the database.
Ditto with any other query. It does not cause an
error, but it returns 0 rows.

The USER DSN "mysqldsn" is set up as follows :-
host : zion.xxx.xxx.xxx
default database : default_db
port : 3306
username : uname
password : pwd

Running " use default_db; show tables;" command from
the command prompt on the db server returns 500 rows.

I find this problem while running any query. 
Running "select * from tname limit 100" returns 0 rows
whereas tname has around a million records.

In the past, I have used MySQL clients for Windows to
access  the database without encountering any such
problem

I even tried setting up the "mysqldsn" DSN as a system
DSN instead of a user DSN.

I would like to know
a) whether this is a permissions issue at some level
b) whether there is any solution for this problem in R



Thanks
Lalitha



More information about the R-help mailing list