mercredi 13 juillet 2016

RMySQL does not work as part of a script

When I run

library(RMySQL)
mydb = dbConnect(MySQL(), user = "XX", password = "XX", dbname = "XX", host = "XX")

on the R console it works,

however when I put save it as a yy.R file and run it as R CMD BATCH yy.R, or as source("yy.R") it says

Error in mysqlNewConnection(drv, ...) : RS-DBI driver: (Failed to connect to database: Error: Can't connect to MySQL server on 'XX' (111) ) Calls: dbConnect -> dbConnect -> mysqlNewConnection -> .Call Execution halted

could I check if RMySQL only runs on the console? Thanks!

Aucun commentaire:

Enregistrer un commentaire