1

I am looking for a library which allows to run an in-process database like SQLJet, but it has to be accessible from multiple vms (on the same machine) simultaneously like an independent database server. At best something like this: You create a new file-system database, then open a connection to it from one vm. If you then try to do the same thing from a different vm, it checks if theres already a connection to it and syncs with it. If there's no such thing, any ideas how i can run a in-process database server in java? Doesnt have to be sql, mongoDB or any database system will do. The important part is, that i do not have to run a seperate database engine, but it has to be accessible from multiple vms.

Christian P
  • 12,032
  • 6
  • 60
  • 71

1 Answers1

2

Use the H2 in TCP server mode. In one of your VMs start it like so:

 Server server = Server.createTcpServer(args).start();

Other VM can connect using JDBC:

JDBC driver class: org.h2.Driver
Database URL: jdbc:h2:tcp://localhost/~/test 
Stefan
  • 12,108
  • 5
  • 47
  • 66