Hi,
What you see is a bit strange, but it's not a bug.
This alone doesn't throw the exception:
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "sa");
Statement stat = conn.createStatement();
stat.execute("shutdown compact");
stat.close();
conn.close();
But the H2 Console and other tools do this:
stat.execute("shutdown compact");
stat.getUpdateCount();
The getUpdateCount() method throws an exception because after calling
"shutdown" the database is closed, so calling getUpdateCount() is
technically illegal.
The database doesn't shrink because most likely it is already at it's
minimal size. Whenever the database is closed normally, it is
compressed for up to 1 second by default - see
http://www.h2database.com/javadoc/org/h2/constant/SysProperties.html#h2.maxCompactTime
Of course you can compress it further with tools such as 'zip', but
then the database is no longer usable (random access writes are very
very slow in compressed files).
Regards,
Thomas