Hello,
Q/ Is it possible to create a DBMS connection automatically on startup of R? 
(Making sure of course that the db server has been started...)
I am running MySQL on Mac OS X 10.4.2 with R2.4.1.

I have tried to write a function using the RMySQL commands (below) and place 
them in .First of .RProfile:

drv <- dbDriver("MySQL")
dbcon <- dbConnect(drv, {other parameters present in my.cnf file} 
dbname="mydbName")

DOES create a connection when entered into my R console individually but NOT 
when I place them in a function, i.e.,

condb <- function() {
        drv <- dbDriver("MySQL")
        dbcon <- dbConnect(drv, dbname="mydbName")
        dbGetInfo(db)
        }

When the function is called, the dbGetInfo(dbcon) does return connection info 
but no connection object is present.

I would be ver grateful for any guidance on where I have gone wrong. Thank you.

Mark Ruddy
PhD student
Geography Dept., Royal Holloway (University of London)
Egham, UK.


        [[alternative HTML version deleted]]

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to