OHDSI Home | Forums | Wiki | Github

Problem to use "DatabaseConnector"

Hi,

I am attempting to connect the DatabaseConnector package for R to our mysql server that contains data in CDM v5.

I am currently using a Mac (OS X), RStudio 0.99.903 / R v3.3.2.
R seems to run with Java v1.6

J(“java.lang.System”,“getProperty”,“java.version”)
[1] “1.6.0_65”

When I run the following code:

library(DatabaseConnector)
connectionDetails<-createConnectionDetails(dbms=“mysql”, user=“test”, password=“test”, server=“10.2.4.162”, schema=“alcapone”)
test<-connect(connectionDetails)

The following message appears:

Error in .jcall(drv@jdrv, “Ljava/sql/Connection;”, “connect”, as.character(url)[1], :
java.sql.SQLException: Access denied for user ‘’@‘pharmaco-86.pharmaco.u-bordeaux2.fr’ (using password: NO)

But if I directly use RJDBC, it seems to work:

library(RJDBC)
drv <- JDBC(“com.mysql.jdbc.Driver”, “/etc/jdbc/mysql-connector-java-3.1.14-bin.jar”, identifier.quote="`")
conn <- dbConnect(drv, “jdbc:mysql://10.2.4.162/alcapone”, “test”, “test”)
dbListTables(conn)

I don’t see what I am missing… Do I need to do some configuration to make “DatabaseConnector” work ?

Thank you !

Hi @nthurin!

Sorry about that. There was a bug in the MySQL login code. I just pushed a new version to Github. Please use that. Make sure you close all instances of R, open one instance, and run
install.packages("drat") drat::addRepo("OHDSI") install.packages("DatabaseConnector")
The reason we didn’t notice until now is that nobody uses MySQL. None of the OHDSI tools, including the Methods Library, support MySQL because of fundamental limitations in MySQL. May I recommend you use PostgreSQL instead? That is another excellent open source database platform, and is supported by all OHDSI tools.

Thank you @schuemie !
“DatabaseConnector” is now running with MySQL, but as you said, the other packages don’t…
We are migrating the data to a postgreSQL platform.
Hope everything will go well.

removed

t