H2数据库特点:
1、免费、开源、快速;
2、嵌入式的数据库服务器,支持集群;
3、有比较好的兼容性,支持相当标准的sql标准;
4、提供基于web的数据库管理界面。H2数据库有好几种运行方式,你说的这种应该就是“嵌入式"运行方式,它限制只能有一个客户端进行 *** 作,优点是性能好。
除了嵌入式 ,还有 服务器 运行方式(就是像oracle/ sqlserver一样的),但除此以外,还提供了混合模式,这种模式比较常用,和嵌入式的唯一区别就是写jdbc url时,这样写:
jdbc:h2:<数据库文件路径名>;AUTO_SERVER=TRUEAccording to documentation, closing the last connection closes the database and when closing the database, the database is automatically compacted for up to 200 milliseconds
I guess these together may cause data loss & corruption when a
single connection is repeatedly created, data altered, connection
closed, new connection created, etc - eventually resulting in
exception such as "Block not found in id [1, -128, 8, 42] [14186/50]"
when trying to access the DB Version 13176 (last stable) works fine with this, version 14186 crashes and corrupts data
The
behavior can be fixed by appending ";DB_CLOSE_DELAY=-1" to the DB URL,
ie disabling autoclosing DB when last connection is closed I though
it might have had something to do with 14's new "FS" file locking
protocol, but changing that to old "FILE" doesn't seem to help
Of
course this is not how a DB connection is typically used - when using a
connection pool, this would go unnoticed - and I found this purely by
accident But it's a bug anyway, isn't it
Best Regards,
Joonas
狗哥找的查看数据可以通过MVCC=TRUE这样的方式,MVCC(Multi-Version Concurrent Control) 多版本并发控制模式,如不开启,好像则只能单链接数据库文件。打开idea软件
点击右下角的database按钮
接下来单击+按钮
点击Data Source按钮
在依次点击H2按钮
下载驱动,填写连接信息,点击测试连接,测试成功之后,,之后点击OK按钮
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)