I have an R6 class with a method where I connect to a mariadb database. It look something like this:
Data <- R6::R6Class(
classname = "Data",
public = list(
db = NULL,
connect = function() {
print("Connecting to database ...")
self$db <- DBI::dbConnect(RMariaDB::MariaDB(), group = "factset")
print("Connected to database!")
}}
When I try to connect I get this error:
"Error: Failed to connect: Lost connection to MySQL server at 'handshake: reading initial communication packet', system error: 2"
The strange thing is that when I connect without the class I dont get the error and the connection get established.
This works:
db <- DBI::dbConnect(RMariaDB::MariaDB(), group = "factset")
Hi,
I have an R6 class with a method where I connect to a mariadb database. It look something like this:
Data <- R6::R6Class( classname = "Data", public = list(
db = NULL,
connect = function() { print("Connecting to database ...") self$db <- DBI::dbConnect(RMariaDB::MariaDB(), group = "factset") print("Connected to database!") }}
When I try to connect I get this error: "Error: Failed to connect: Lost connection to MySQL server at 'handshake: reading initial communication packet', system error: 2"
The strange thing is that when I connect without the class I dont get the error and the connection get established. This works:
db <- DBI::dbConnect(RMariaDB::MariaDB(), group = "factset")
Any ideas what could cause this?