diversicon-kb / divmaker

Quick and dirty Java program to create UBY LMF XMLs
http://diversicon-kb.eu/tools
GNU General Public License v3.0
0 stars 0 forks source link

Generated database is not closed properly #2

Open DavidLeoni opened 7 years ago

DavidLeoni commented 7 years ago

DB generation executes SHUTDOWN COMPACT, but it seems that it doesn't close appropriately the DB: if later you try to open it in read-only mode with URLs like jdbc:h2:~/Da/prj/diversicon-core/dumps/div-wn31;ACCESS_MODE_DATA=r it gives error

org.h2.jdbc.JdbcSQLException: The database is read only [90097-160]

Opening it in rw mode works fine (because writing mode allows the db to recover from the issue)

DavidLeoni commented 7 years ago

To close the db manually with the H2 Shell tool, enter user=root and password=pass

da@da-HP-ProBook-6560b:~/Da/prj/diversicon-core/dumps$ java -cp   ~/Da/bin/h2-1.3/bin/h2-1.3.176.jar  org.h2.tools.Shell

Welcome to H2 Shell 1.3.176 (2014-04-05)
Exit with Ctrl+C
[Enter]   jdbc:h2:~/Da/prj/diversicon-core/dumps/smart  
// NOTICE THE ABOVE IS PROPOSED BY THE SYSTEM MORE OR LESS AT RANDOM, YOU HAVE TO SPECIFY THE RIGHT DB LIKE SO:
URL       jdbc:h2:div-wn31
[Enter]   org.h2.Driver
Driver    
[Enter]   root
User      
[Enter]   Hide
Password  pass
Connected
Commands are case insensitive; SQL statements end with ';'
help or ?      Display this help
list           Toggle result list / stack trace mode
maxwidth       Set maximum column width (default is 100)
autocommit     Enable or disable autocommit
history        Show the last 20 statements
quit or exit   Close the connection and exit

sql> SELECT * FROM INFORMATION_SCHEMA.TABLES;
TABLE_CATALOG | TABLE_SCHEMA       | TABLE_NAME                       | TABLE_TYPE   | STORAGE_TYPE | SQL                                                                                                  | REMARKS | LAST_MODIFICATION   | ID  | TYPE_NAME | TABLE_CLASS               | ROW_COUNT_ESTIMATE
****  REDACTED *****
DIV-WN31      | PUBLIC             | SEMANTICPREDICATE                | TABLE        | CACHED       | CREATE CACHED TABLE PUBLIC.SEMANTICPREDICATE(
    SEMANTICPREDICATEID VARCHAR(255) NOT NULL,
    LAB |         | 0                   | 112 | null      | org.h2.table.RegularTable | 33
****  REDACTED *****
(data is partially truncated)
(81 rows, 29 ms)
sql> SHUTDOWN COMPACT;
Error: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-176]
sql> exit
Connection closed
da@da-HP-ProBook-6560b:~/Da/prj/diversicon-core/dumps$ 

# Compacting:
zip div-wn31.h2.db.zip div-wn31.h2.db
xz -k div-wn31.h2.db