ohdsi-studies / Covid19SubjectsAesiIncidenceRate

Extending on our previous work by Li et al. in understanding the incidence rates of adverse events of special interest (AESI) for COVID-19, this work will look at the rates of these AESIs in patients who had COVDI-19 disease.
https://ohdsi-studies.github.io/Covid19SubjectsAesiIncidenceRate/Protocol.html
2 stars 4 forks source link

USE statement is not supported to switch between databases. #23

Closed ericaVoss closed 2 years ago

ericaVoss commented 2 years ago
rJava   .jcheck Error in rJava::.jcall(resultSet, "Z", "next") :    
com.microsoft.sqlserver.jdbc.SQLServerException: 
USE statement is not supported to switch between databases. Use a new connection to connect to a different database. 

https://forums.ohdsi.org/t/connecting-to-azure-sql-database-from-achillesweb/3337/6

For ZC/DD

ericaVoss commented 2 years ago

To get a more informative error, let's try running just the line that failed.

install.packages("renv")
setwd("D:/Projects/Covid19SubjectsAesiIncidenceRate")
download.file("https://raw.githubusercontent.com/ohdsi-studies/Covid19SubjectsAesiIncidenceRate/master/renv.lock", "renv.lock")
renv::init()

connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "postgresql",
                                                                server = "some.server.com/ohdsi",
                                                                user = "joe",
                                                                password = "secret")
cohortDatabaseSchema <- "scratch.dbo"
connection <- DatabaseConnector::connect(connectionDetails)
tables <- DatabaseConnector::getTableNames(connection, cohortDatabaseSchema)
ericaVoss commented 2 years ago

Issue with connection string caused the error.