Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated database is not closed properly #2

Open
DavidLeoni opened this issue Nov 3, 2016 · 1 comment
Open

Generated database is not closed properly #2

DavidLeoni opened this issue Nov 3, 2016 · 1 comment
Labels

Comments

@DavidLeoni
Copy link
Member

DavidLeoni commented Nov 3, 2016

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 DavidLeoni added the bug label Nov 3, 2016
DavidLeoni added a commit to diversicon-kb/diversicon-wordnet-3.1 that referenced this issue Nov 3, 2016
@DavidLeoni
Copy link
Member Author

DavidLeoni commented Feb 2, 2017

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 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant