|
# In Windows, need add the RMySQL.dll to PATH, like this
# Sys.putenv(PATH = paste(Sys.getenv("PATH"),
# "C:/PROGRA~1/R/rw1071/library/RMySQL/libs/", sep = ";"))
library(methods)
library(DBI)
library(RMySQL)
db <- NULL
db$info <- list(driver = "MySQL", user = "yourname",
password = "yourpassword", host = "yourdbhost",
port = "yourdbport")
db$drv <- dbDriver(db$info$driver)
db$con <- dbConnect(db$drv, user = db$info$user,
password = db$info$password,
host = db$info$host, port = db$info$port,
dbname = "whatyouwant")
tb <- NULL
tb$get <- dbGetQuery(db$con,
paste("select * from table where field = \"",
value, sep = ""))
dbDisconnect(db$con)
dbUnloadDriver(db$drv)
|