H2 Database URL & File Layout

いつも忘れるので、本家よりリファレンスをメモ。

 

Database URL Overview

Topic URL Format and Examples
Embedded (local) connection jdbc:h2:[file:][<path>]<databaseName>
jdbc:h2:~/test
jdbc:h2:file:/data/sample
jdbc:h2:file:C:/data/sample (Windows only)
In-Memory (private) jdbc:h2:mem:
In-Memory (named) jdbc:h2:mem:<databaseName>
jdbc:h2:mem:test_mem
Remote using TCP/IP jdbc:h2:tcp://<server>[:<port>]/<databaseName>
jdbc:h2:tcp://localhost/~/test
jdbc:h2:tcp://dbserv:8084/~/sample
Remote using SSL/TLS jdbc:h2:ssl://<server>[:<port>]/<databaseName>
jdbc:h2:ssl://secureserv:8085/~/sample;
Using Encrypted Files jdbc:h2:<url>;CIPHER=[AES|XTEA]
jdbc:h2:ssl://secureserv/~/testdb;CIPHER=AES
jdbc:h2:file:~/secure;CIPHER=XTEA
File Locking Methods jdbc:h2:<url>;FILE_LOCK={NO|FILE|SOCKET}
jdbc:h2:file:~/quickAndDirty;FILE_LOCK=NO
jdbc:h2:file:~/private;CIPHER=XTEA;FILE_LOCK=SOCKET
Only Open if it Already Exists jdbc:h2:<url>;IFEXISTS=TRUE
jdbc:h2:file:~/sample;IFEXISTS=TRUE
Don't Close the Database when the VM Exits jdbc:h2:<url>;DB_CLOSE_ON_EXIT=FALSE
User Name and/or Password jdbc:h2:<url>[;USER=<username>][;PASSWORD=<value>]
jdbc:h2:file:~/sample;USER=sa;PASSWORD=123
Log Index Changes jdbc:h2:<url>;LOG=2
jdbc:h2:file:~/sample;LOG=2
Debug Trace Settings jdbc:h2:<url>;TRACE_LEVEL_FILE=<level 0..3>
jdbc:h2:file:~/sample;TRACE_LEVEL_FILE=3
Ignore Unknown Settings jdbc:h2:<url>;IGNORE_UNKNOWN_SETTINGS=TRUE
Custom File Access Mode jdbc:h2:<url>;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws
In-Memory (private) jdbc:h2:mem:
Database in or Zip File jdbc:h2:zip:<zipFileName>!/<databaseName>
jdbc:h2:zip:~/db.zip!/test
Changing Other Settings jdbc:h2:<url>;<setting>=<value>[;<setting>=<value>...]
jdbc:h2:file:~/sample;TRACE_LEVEL_SYSTEM_OUT=3

 

 

 

Database File Layout

 

File Name Description Number of Files
test.data.db Data file
Contains the data for all tables
Format: <database>.data.db
1 per database
test.index.db Index file
Contains the data for all (btree) indexes
Format: <database>.index.db
1 per database
test.0.log.db Log file
The log file is used for recovery
Format: <database>.<id>.log.db
0 or more per database
test.lock.db Database lock file
Exists only if the database is open
Format: <database>.lock.db
1 per database
test.trace.db Trace file
Contains trace information
Format: <database>.trace.db
If the file is too big, it is renamed to <database>.trace.db.old
1 per database
test.14.15.lob.db Large object
Contains the data for BLOB or CLOB
Format: <database>.<tableid>.<id>.lob.db
1 per object
test.123.temp.db Temporary file
Contains a temporary blob or a large result set
Format: <database>.<session id>.<object id>.temp.db
1 per object
test.7.hash.db Hash index file
Contains the data for a linear hash index
Format: <database>.<object id>.hash.db
1 per linear hash index

1 コメント:

匿名

2008年9月10日 16:51

H2 Database Engine では、FileEncryptionしたままでアクセスできないのでしょうか?
JDBC-URI の CHIPER オプションには、暗号化鍵の指定はできないのでしょうか?
org.h2.tools.Console の[ツール]オプションで、暗号化/復号化する項目は見つけたのですが・・・