DB_CLOSE_DELAY:要求最后一个正在连接的连接断开后,不要关闭数据库 MODE=MySQL:兼容模式,H2兼容多种数据库,该值可以为:DB2、Derby、HSQLDB、MSSQLServer、MySQL、Oracle、PostgreSQL AUTO_RECONNECT=TRUE:连接丢失后自动重新连接 AUTO_SERVER=TRUE:启动自动混合模式,允许开启多个连接,该参数不支持在内存中运行模式 TRACE_LEVEL_SYSTEM_OUT、TRACE_LEVEL_FILE:输出跟踪日志到控制台或文件, 取值0为OFF,1为ERROR(默认值),2为INFO,3为DEBUG SET TRACE_MAX_FILE_SIZE mb:设置跟踪日志文件的大小,默认为16M
连接参数是这样用的:
1 2 3
jdbc:h2:mem:DBName;DB_CLOSE_DELAY=-1;MODE=MySQL
jdbc:h2:file:~/.h2/DBName;AUTO_SERVER=TRUE
文档里,这一段也要看看哦
1 2 3 4
To access anin-memory database from another processorfrom another computer, you need tostarta TCP server inthe same processasthein-memory database was created. The other processes then need to access the database over TCP/IP or SSL/TLS, usinga database URL such as: jdbc:h2:tcp://localhost/mem:db1.
By default, closing thelast connection toa database closes the database. For anin-memory database, this means the content is lost. To keep the database open, add ;DB_CLOSE_DELAY=-1tothe database URL. To keep the content ofanin-memory database aslongasthe virtual machine is alive, use jdbc:h2:mem:test;DB_CLOSE_DELAY=-1.