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.

4

1 回答 1

2

TCP 服务器模式下使用H2。在您的一个虚拟机中启动它,如下所示:

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

其他 VM 可以使用 JDBC 连接:

JDBC driver class: org.h2.Driver
Database URL: jdbc:h2:tcp://localhost/~/test 
于 2014-06-24T09:03:30.610 回答