How to check if a h2 database needs to be upgraded?

爷,独闯天下 提交于 2020-01-15 02:38:17

问题


On H2 download site there is a Database Upgrade Helper File for upgrading from 1.1 to a newer version. I wonder if there a nice and clean way of checking if a database needs to upgraded. What I was doing so far was opening a connection to an old db with a new driver, catching the exception and then doing the migration. I would like to do the check in Java if possible.


回答1:


If you have the Database Upgrade Helper File in your classpath, and the database was created with H2 version 1.1, then the database is automatically upgraded.

Other than that, you don't need to upgrade the database, as the database file didn't change since H2 version 1.2 (databases created with version 1.2.x can be opened with the most recent version). At least, that's the plan. If it doesn't work in some case, then please tell us what the problem is.



来源:https://stackoverflow.com/questions/15094815/how-to-check-if-a-h2-database-needs-to-be-upgraded

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!