In my application, I connect to an H2 database and I've recently being looking into how this database is shutdown.
In my connection string I have set DEFRAG_ALWAYS=true
, which according to H2 doc
Each time the database is closed, it is fully defragmented (SHUTDOWN DEFRAG).
Now I assume that when the JVM is shutting down, the shutdown hook will then shutdown the database and defragment it (as if executing SHUTDOWN DEFRAG
).
But if I was to execute SHUTDOWN COMPACT
before exiting the application, whilst having DEFRAG_ALWAYS=true
applied in the connection string, Which shutdown process would be used?
H2 is an SQL database engine that is written in Java™ that implements the JDBC API. A browser-based console application is included. The H2 database is preinstalled with the Cúram software. After you install the Cúram platform software, the self-contained database is located in the %CURAMSDEJ%\drivers\h2. jar file.
Text comparison in MySQL is case insensitive by default, while in H2 it is case sensitive (as in most other databases). H2 does support case insensitive text comparison, but it needs to be set separately, using SET IGNORECASE TRUE. This affects comparison using =, LIKE, REGEXP.
If you execute shutdown
manually, then this has priority over the setting (defrag_always=true
). So if you execute shutdown compact
, then this is what is done, and the defrag
is not done. If you execute shutdown defrag
, then this is done, no matter what the setting. If you just close the database normally, then the setting defrag_always
is used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With