# First create a database in a temporary directory
db <- create_db(tempdir(), "mydb.db")
close_db(db)
DBI::dbIsValid(db) # db is closed
# Then re-open it
db2 <- open_db(tempdir(), "mydb.db")
DBI::dbIsValid(db2) # db is opened
# Cleanup
close_db(db2)
file.remove(file.path(tempdir(), "mydb.db"))
Run the code above in your browser using DataLab