Re: [R] RMySQL...Can't initialize driver???

From: Stephane Cruveiller <scruveil_at_genoscope.cns.fr>
Date: Wed 28 Jun 2006 - 00:41:22 EST

Rainer M Krug wrote:
> Stephane Cruveiller wrote:
>

>> Duncan Murdoch wrote:
>>     
>>> On 6/27/2006 8:51 AM, Stephane Cruveiller wrote:
>>>       
>>>> Dear R users,
>>>>
>>>> I would like to query a MySQL database through R. I have installed
>>>> the latest required packages (RMySQL and DBI) in R (v2.3.1). A MySQL
>>>> server (v5.0.22) is running on my local machine but I can't
>>>> initialize MYSQL
>>>> driver:
>>>> ------------------------------------------------------------------------------------
>>>>
>>>>  > library("RMySQL")
>>>> Loading required package: DBI
>>>>  > MySQL(max.con = 10, fetch.default.rec = 500, force.reload = F)
>>>> Error in new("MySQLDriver", Id = drvId) : unused argument(s) (Id ...)
>>>> -------------------------------------------------------------------------------------
>>>>
>>>>
>>>> Could somebody tell me what I have missed?
>>>>         
>

> I am running R 2.3.0 under Linux and connect to a MySQl 4.1 server.
>

> You have to create a file in your home directory which has the
> connection infos. It should look like that:
>

>
> [renpatch]
> user = UserName
> password = PassWord
> database = ...
> host = ...
>

> [renpatch_renosterbos]
> user = UserName
> password = PassWord
> database = ...
> host = ..
>

> and be called .my.conf

>
>

I followed your instruction. Here is my .my.cnf:

[client]
user=steff
password=XXXXXX
database=justforfun

with it, I can connect to my MYSQL server without problem and then I try to connect through R:

 > library(RMySQL)
Loading required package: DBI
 > m <- dbDriver("MySQL")
Error in new("MySQLDriver", Id = drvId) : unused argument(s) (Id ...)

It still produces the error. I really do not know what is going on here...

> Then you do:

>
>

> library("RMySQL")
> m <- dbDriver("MySQL")
> con <- dbConnect(m, group = "renpatch")
> q <- TheSQLQuery
> rs <- dbSendQuery(con, q)
> TheResults <- fetch(rs, n = -1)
> dbDisconnect(con)
> rm(con)
>
>

> and it should work - at least that is what it is doing for me.
>

> Rainer

>
>

Stephane.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 28 00:54:08 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 28 Jun 2006 - 18:12:33 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.