I'm writing a program that spawns multiple R sessions inside a single JVM. I need to share data between these sessions and I'm writing files (RData/txt) on to the disk for now. I did a bit of reading and found out that an in-memory database is the right way to go, and zeroed in on H2. I downloaded & installed the RH2 package and the documentation said that it includes an H2 instance- I don't need to separately install one.
So I went ahead and tried to create my db:
con <- dbConnect(H2(), "jdbc:h2:mem:test", "sa", " ")
And got an error:
Error in .local(drv, ...) : could not find function ".verify.JDBC.result"
I read this StackOverflow Question, and tried:
> con <- dbConnect(H2(), "jdbc:h2:mem:test")
Error in .local(drv, ...) : could not find function ".verify.JDBC.result"
> con <- dbConnect(H2(), "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1")
Error in .local(drv, ...) : could not find function ".verify.JDBC.result"
> con <- dbConnect(H2(), "jdbc:h2:~/test", "sa", "")
Error in .local(drv, ...) : could not find function ".verify.JDBC.result"
I went through the documentation, but it was not of a lot of help. I checked for my drivers, and it gave:
> H2()
An object of class "H2Driver"
Slot "identifier.quote":
[1] "\""
Slot "jdrv":
[1] "Java-Object{org.h2.Driver@25e01f19}"
How do I go ahead and create a database from within R? Also, is it possible to share this database across different sessions?
Update: I switched to older instances of both RJDBC and RH2, but same result.