Reset Embedded H2 database periodically
问题 I'm setting up a new version of my application in a demo server and would love to find a way of resetting the database daily. I guess I can always have a cron job executing drop and create queries but I'm looking for a cleaner approach. I tried using a special persistence unit with drop-create approach but it doesn't work as the system connects and disconnects from the server frequently (on demand). Is there a better approach? 回答1: H2 supports a special SQL statement to drop all objects: DROP