[Rd] How to connect R to Mysql?

David Scott d.scott at auckland.ac.nz
Sat Sep 18 15:22:04 CEST 2010


On 18/09/2010 4:47 a.m., Spencer Graves wrote:
>    Hi, Thomas:
>
>
>         You use RODBC to connect to MySQL?
>
>
>         Thanks, Spencer
>
>

I also use RODBC to connect to MySQL. That is in part because it is 
useful for other connections as well. I am using it for connecting to 
Microsoft SQL Server in a current project, and it is one of two 
approaches I commonly use to read Excel files (along with xlsReadWrite).

While I am at it, I would like to say thanks to Brian Ripley for his 
work on RODBC.

David Scott




> On 9/17/2010 9:26 AM, Thomas Etheber wrote:
>> I also had problems connecting via RMysql on Windows several weeks ago.
>> I decided to skip the package and now use RODBC, which runs stable out
>> of the box. Perhaps you should have a look at this package.
>>
>> Hth
>> Thomas
>>
>> Am 17.09.2010 17:50, schrieb Spencer Graves:
>>>
>>>
>>>        I've recently been through that with some success.  I don't
>>> remember all the details, but I first looked at "help(pac=RMySQL)".
>>> This told me that the maintainer was Jeffrey Horner.  Google told me
>>> he was at Vanderbilt.  Eventually I found
>>> "http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL", which told me
>>> that I needed to build the package myself so it matches your version
>>> of MySQL, operating system, etc.  I did that.
>>>
>>>
>>>        Does the MySQL database already exist?  I created a MySQL
>>> database and tables using MySQL server 5.1.50-win32.  (Which version
>>> of MySQL do you have?)
>>>
>>>
>>>        help('RMySQL-package') includes "A typical usage".  That helped
>>> me get started, except that I needed to write to that database, not
>>> just query it.  For this, I think I got something like the following
>>> to work:
>>>
>>>
>>> d<- dbReadTable(con, "WL")
>>> dbWriteTable(con, "WL2", a.data.frame)  ## table from a data.frame
>>> dbWriteTable(con, "test2", "~/data/test2.csv") ## table from a file
>>>
>>>
>>>        Hope this helps.
>>>        Spencer
>>>
>>>
>>> On 9/17/2010 7:55 AM, Arijeet Mukherjee wrote:
>>>> I installed the RMySql package in R 2.11.1 64 bit
>>>> Now how can I connect R with MySql?
>>>> I am using a windows 7 64 bit version.
>>>> Please help ASAP.
>>>>
>>>
>>>
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
>


-- 
_________________________________________________________________
David Scott	Department of Statistics
		The University of Auckland, PB 92019
		Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:	d.scott at auckland.ac.nz,  Fax: +64 9 373 7018

Director of Consulting, Department of Statistics



More information about the R-devel mailing list