This package is a dbj extension to conveniently access H2 data stores.
It ships with the latest stable version of H2 (1.3.x). See usage section, if you want a different version.
devtools::install_github("hoesler/dbj.h2")
library(DBI)
con <- dbConnect(dbj.h2::driver(), "mem:")
con <- dbConnect(dbj.h2::driver(), "~/database.h2.db", user = 'me', password = 'some')
To use a different H2 driver version, make sure to add the H2 jar to the classpath before loading dbj.h2:
library(DBI)
library(dbj)
jdbc_register_driver(
'org.h2.Driver',
resolve(
module('com.h2database:h2:1.4.192'),
repositories = list(maven_local, maven_central)
)
)
con <- dbConnect(dbj.h2::driver(), url = "mem:")
dbGetInfo(con)$jdbc_driver_version
# [1] "1.4.192 (2016-05-26)"
The development of dbj.h2 was hugely inspired by the RH2 package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.