提交 b94a2268 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 37143363
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -167,7 +167,7 @@ Possible with: read uncommitted, read committed
Table Level Locking
@advanced_1056_p
The database allows multiple concurrent connections to the same database. To make sure all connections only see consistent data, table level locking is used. This mechanism does not allow high concurrency, but is very fast. Shared locks and exclusive locks are supported. Before reading from a table, the database tries to add a shared lock to the table (this is only possible if there is no exclusive lock on the object by another connection). If the shared lock is added successfully, the table can be read. It is allowed that other connections also have a shared lock on the same object. If a connection wants to write to a table (update or delete a row), an exclusive lock is required. To get the exclusive lock, other connection must not have any locks on the object. After the connection commits, all locks are released. This database keeps all locks in memory.
The database allows multiple concurrent connections to the same database. To make sure all connections only see consistent data, table level locking is used by default. This mechanism does not allow high concurrency, but is very fast. Shared locks and exclusive locks are supported. Before reading from a table, the database tries to add a shared lock to the table (this is only possible if there is no exclusive lock on the object by another connection). If the shared lock is added successfully, the table can be read. It is allowed that other connections also have a shared lock on the same object. If a connection wants to write to a table (update or delete a row), an exclusive lock is required. To get the exclusive lock, other connection must not have any locks on the object. After the connection commits, all locks are released. This database keeps all locks in memory.
@advanced_1057_h3
Lock Timeout
......@@ -932,7 +932,7 @@ h2.redoBufferSize
Size of the redo buffer (used at startup when recovering)
@advanced_1311_td
h2.runFinalizers
h2.runFinalize
@advanced_1312_td
true
......@@ -1060,72 +1060,96 @@ Building the Software
@build_1004_a
Using Maven 2
@build_1005_h2
@build_1005_a
Translating
@build_1006_h2
Portability
@build_1006_p
@build_1007_p
This database is written in Java and therefore works on many platforms. It can also be compiled to a native executable using GCJ.
@build_1007_h2
@build_1008_h2
Environment
@build_1008_p
@build_1009_p
A Java Runtime Environment (JRE) version 1.4 or higher is required to run this database.
@build_1009_p
@build_1010_p
To build the database executables, the following software stack was used. Newer version or compatible software works too.
@build_1010_li
@build_1011_li
Windows XP
@build_1011_li
@build_1012_li
Sun JDK Version 1.4 or 1.5
@build_1012_li
@build_1013_li
Apache Ant Version 1.6.5
@build_1013_li
@build_1014_li
Mozilla Firefox 1.5
@build_1014_li
@build_1015_li
Eclipse Version 3.2.2
@build_1015_li
@build_1016_li
YourKit Java Profiler
@build_1016_h2
@build_1017_h2
Building the Software
@build_1017_p
@build_1018_p
On the command line, go to the directory src and execute the following command:
@build_1018_p
@build_1019_p
You will get a list of targets. If you want to build the jar files, execute:
@build_1019_p
@build_1020_p
To create a jar file with the JDBC API and the classes required to connect to a server only, use the target jarClient:
@build_1020_p
@build_1021_p
The other targets may be used as well.
@build_1021_h2
@build_1022_h2
Using Maven 2
@build_1022_h3
@build_1023_h3
Using a Central Repository
@build_1023_p
@build_1024_p
You can include the database in your Maven 2 project as a dependency. Example:
@build_1024_h3
@build_1025_p
New versions of this database are first uploaded to http://hsql.sourceforge.net/m2-repo/ and then automatically synchronized with the main maven repository; however after a new release it may take a few hours before they are available there.
@build_1026_h3
Using Snapshot Version
@build_1025_p
@build_1027_p
To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command:
@build_1026_p
@build_1028_p
Afterwards, you can include the database in your Maven 2 project as a dependency:
@build_1029_h2
Translating
@build_1030_p
The translation of this software is split into the following parts:
@build_1031_li
H2 Console: src/main/org/h2/server/web/res/_text_*.properties
@build_1032_li
Error messages: src/main/org/h2/res/_messages_*.properties
@build_1033_li
Web site: src/docsrc/text/_docs_*.utf8.txt
@build_1034_p
The conversion between UTF-8 and Java encoding (using the \u syntax), as well as the HTML entities (&#..;) is automated by running the tool PropertiesToUTF8. The web site translation is automated as well, using <code>ant docs</code> .
@download_1000_h1
Downloads
......@@ -1313,7 +1337,7 @@ The GCJ version is not as stable as the Java version. When running the regressio
How to Translate this Project?
@faq_1053_p
The following files can be translated at the moment:
For more information, see <a href="build.html#translating">Build/Translating</a> .
@features_1000_h1
Features
......@@ -1322,1269 +1346,1308 @@ Features
Feature List
@features_1002_a
Comparison to Other Database Engines
Limitations
@features_1003_a
H2 in Use
Comparison to Other Database Engines
@features_1004_a
Connection Modes
H2 in Use
@features_1005_a
Database URL Overview
Connection Modes
@features_1006_a
Connecting to a Database with File Encryption
Database URL Overview
@features_1007_a
Database File Locking
Memory-Only Databases
@features_1008_a
Opening a Database Only if it Already Exists
Connecting to a Database with File Encryption
@features_1009_a
Closing the Database
Database File Locking
@features_1010_a
Log Index Changes
Opening a Database Only if it Already Exists
@features_1011_a
Custom File Access Mode
Closing the Database
@features_1012_a
Multiple Connections
Log Index Changes
@features_1013_a
Database File Layout
Custom File Access Mode
@features_1014_a
Logging and Recovery
Multiple Connections
@features_1015_a
Compatibility Modes
Database File Layout
@features_1016_a
Using the Trace Options
Logging and Recovery
@features_1017_a
Read Only Databases
Compatibility
@features_1018_a
Binary and Text Storage Formats
Using the Trace Options
@features_1019_a
Graceful Handling of Low Disk Space Situations
Read Only Databases
@features_1020_a
Computed Columns / Function Based Index
Read Only Databases in Zip or Jar File
@features_1021_a
Multi-Dimensional Indexes
Binary and Text Storage Formats
@features_1022_a
Using Passwords
Graceful Handling of Low Disk Space Situations
@features_1023_a
User Defined Functions and Stored Procedures
Computed Columns / Function Based Index
@features_1024_a
Triggers
Multi-Dimensional Indexes
@features_1025_a
Compacting a Database
Using Passwords
@features_1026_a
Cache Settings
User Defined Functions and Stored Procedures
@features_1027_a
Triggers
@features_1028_a
Compacting a Database
@features_1029_a
Cache Settings
@features_1030_a
Why Java
@features_1028_h2
@features_1031_h2
Feature List
@features_1029_h3
@features_1032_h3
Main Features
@features_1030_li
@features_1033_li
Very fast database engine
@features_1031_li
@features_1034_li
Free, with source code
@features_1032_li
@features_1035_li
Written in Java
@features_1033_li
@features_1036_li
Supports standard SQL, JDBC API
@features_1034_li
@features_1037_li
Embedded and Server mode, Clustering support
@features_1035_li
@features_1038_li
Strong security features
@features_1036_li
@features_1039_li
Experimental native version (GCJ) and ODBC drivers
@features_1037_h3
@features_1040_h3
Additional Features
@features_1038_li
@features_1041_li
Disk based or in-memory databases and tables, read-only database support, temporary tables
@features_1039_li
@features_1042_li
Transaction support (read committed and serializable transaction isolation), 2-phase-commit
@features_1040_li
@features_1043_li
Multiple connections, table level locking
@features_1041_li
@features_1044_li
Cost based optimizer, using a genetic algorithm for complex queries, zero-administration
@features_1042_li
@features_1045_li
Scrollable and updatable result set support, large result set, external result sorting, functions can return a result set
@features_1043_li
@features_1046_li
Encrypted database (AES or XTEA), SHA-256 password encryption, encryption functions, SSL
@features_1044_h3
@features_1047_h3
SQL Support
@features_1045_li
@features_1048_li
Support for multiple schemas, information schema
@features_1046_li
@features_1049_li
Referential integrity / foreign key constraints with cascade, check constraints
@features_1047_li
@features_1050_li
Inner and outer joins, subqueries, read only views and inline views
@features_1048_li
@features_1051_li
Triggers and Java functions / stored procedures
@features_1049_li
@features_1052_li
Many built-in functions, including XML and lossless data compression
@features_1050_li
@features_1053_li
Wide range of data types including large objects (BLOB/CLOB) and arrays
@features_1051_li
@features_1054_li
Sequence and autoincrement columns, computed columns (can be used for function based indexes)
@features_1052_li
@features_1055_li
ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP
@features_1053_li
@features_1056_li
Collation support, users, roles
@features_1054_li
@features_1057_li
Compatibility modes for HSQLDB, MySQL and PostgreSQL
@features_1055_h3
@features_1058_h3
Security Features
@features_1056_li
@features_1059_li
Includes a solution for the SQL injection problem
@features_1057_li
@features_1060_li
User password authenticated uses SHA-256 and salt
@features_1058_li
@features_1061_li
User passwords are never transmitted in plain text over the network (even when using insecure connections)
@features_1059_li
@features_1062_li
All database files (including script files that can be used to backup data) can be encrypted using AES-256 and XTEA encryption algorithms
@features_1060_li
@features_1063_li
The remote JDBC driver supports TCP/IP connections over SSL/TLS
@features_1061_li
@features_1064_li
The built-in web server supports connections over SSL/TLS
@features_1062_li
@features_1065_li
Passwords can be sent to the database using char arrays instead of Strings
@features_1063_h3
@features_1066_h3
Other Features and Tools
@features_1064_li
@features_1067_li
Small footprint (smaller than 1 MB), low memory requirements
@features_1065_li
@features_1068_li
Multiple index types (b-tree, tree, hash, linear hash)
@features_1066_li
@features_1069_li
Support for multi-dimensional indexes
@features_1067_li
@features_1070_li
CSV (comma separated values) file support
@features_1068_li
@features_1071_li
Support for linked tables, and a built-in virtual 'range' table
@features_1069_li
@features_1072_li
EXPLAIN PLAN support, sophisticated trace options
@features_1070_li
@features_1073_li
Database closing can be delayed or disabled to improve the performance
@features_1071_li
@features_1074_li
Web-based Console application (English, German, partially French and Spanish) with autocomplete
@features_1072_li
@features_1075_li
The database can generate SQL script files
@features_1073_li
@features_1076_li
Contains a recovery tool that can dump the contents of the data file
@features_1074_li
@features_1077_li
Automatic re-compilation of prepared statements
@features_1075_li
@features_1078_li
Uses a small number of database files, binary and text storage formats, graceful handling of low disk space situations
@features_1076_li
@features_1079_li
Uses a checksum for each record and log entry for data integrity
@features_1077_li
@features_1080_li
Well tested (high code coverage, randomized stress tests)
@features_1078_h2
@features_1081_h2
Limitations
@features_1082_p
For the list of limitations, please have a look at the road map page at: <a href="http://groups.google.com/group/h2-database/web/roadmap">http://groups.google.com/group/h2-database/web/roadmap</a>
@features_1083_h2
Comparison to Other Database Engines
@features_1079_th
@features_1084_th
Feature
@features_1080_th
@features_1085_th
H2
@features_1081_th
@features_1086_th
Derby
@features_1082_th
@features_1087_th
HSQLDB
@features_1083_th
@features_1088_th
MySQL
@features_1084_th
@features_1089_th
PostgreSQL
@features_1085_td
@features_1090_td
Embedded Mode (Java)
@features_1086_td
@features_1091_td
Yes
@features_1087_td
@features_1092_td
Yes
@features_1088_td
@features_1093_td
Yes
@features_1089_td
@features_1094_td
No
@features_1090_td
@features_1095_td
No
@features_1091_td
@features_1096_td
Pure Java
@features_1092_td
@features_1097_td
Yes
@features_1093_td
@features_1098_td
Yes
@features_1094_td
@features_1099_td
Yes
@features_1095_td
@features_1100_td
No
@features_1096_td
@features_1101_td
No
@features_1097_td
@features_1102_td
Performance (Embedded)
@features_1098_td
@features_1103_td
Fast
@features_1099_td
@features_1104_td
Slow
@features_1100_td
@features_1105_td
Fast
@features_1101_td
@features_1106_td
N/A
@features_1102_td
@features_1107_td
N/A
@features_1103_td
@features_1108_td
Transaction Isolation
@features_1104_td
@features_1109_td
Yes
@features_1105_td
@features_1110_td
Yes
@features_1106_td
@features_1111_td
No
@features_1107_td
@features_1112_td
Yes
@features_1108_td
@features_1113_td
Yes
@features_1109_td
@features_1114_td
Cost Based Optimizer
@features_1110_td
@features_1115_td
Yes
@features_1111_td
@features_1116_td
Yes
@features_1112_td
@features_1117_td
No
@features_1113_td
@features_1118_td
Yes
@features_1114_td
@features_1119_td
Yes
@features_1115_td
@features_1120_td
Clustering
@features_1116_td
@features_1121_td
Yes
@features_1117_td
@features_1122_td
No
@features_1118_td
@features_1123_td
No
@features_1119_td
@features_1124_td
Yes
@features_1120_td
@features_1125_td
Yes
@features_1121_td
@features_1126_td
Encrypted Database
@features_1122_td
@features_1127_td
Yes
@features_1123_td
@features_1128_td
Yes
@features_1124_td
@features_1129_td
No
@features_1125_td
@features_1130_td
No
@features_1126_td
@features_1131_td
No
@features_1127_td
@features_1132_td
Files per Database
@features_1128_td
@features_1133_td
Few
@features_1129_td
@features_1134_td
Many
@features_1130_td
@features_1135_td
Few
@features_1131_td
@features_1136_td
Many
@features_1132_td
@features_1137_td
Many
@features_1133_td
@features_1138_td
Footprint (jar/dll size)
@features_1134_td
@features_1139_td
~ 1 MB
@features_1135_td
@features_1140_td
~ 2 MB
@features_1136_td
@features_1141_td
~ 600 KB
@features_1137_td
@features_1142_td
~ 4 MB
@features_1138_td
@features_1143_td
~ 6 MB
@features_1139_h3
@features_1144_h3
Derby and HSQLDB
@features_1140_p
@features_1145_p
After an unexpected process termination (for example power failure), H2 can recover safely and automatically without any user interaction. For Derby and HSQLDB, there are some manual steps required ('Another instance of Derby may have already booted the database' / 'The database is already in use by another process').
@features_1141_h3
@features_1146_h3
DaffodilDb and One$Db
@features_1142_p
@features_1147_p
It looks like the development of this database has stopped. The last release was February 2006.
@features_1143_h3
@features_1148_h3
McKoi
@features_1144_p
@features_1149_p
It looks like the development of this database has stopped. The last release was August 2004
@features_1145_h2
@features_1150_h2
H2 in Use
@features_1146_p
@features_1151_p
For a list of applications that work with or use H2, see: <a href="http://groups.google.com/group/h2-database/web/h2-in-use">http://groups.google.com/group/h2-database/web/h2-in-use</a>
@features_1147_h2
@features_1152_h2
Connection Modes
@features_1148_p
@features_1153_p
The following connection modes are supported:
@features_1149_li
@features_1154_li
Local connections using JDBC (embedded)
@features_1150_li
@features_1155_li
Remote connections using JDBC over TCP/IP (client/server)
@features_1151_li
@features_1156_li
Remote connections using ODBC over TCP/IP (client/server)
@features_1152_li
@features_1157_li
In-Memory databases (private and shared)
@features_1153_h2
@features_1158_h2
Database URL Overview
@features_1154_p
@features_1159_p
This database does support multiple connection modes and features when connecting to a database. This is achieved using different database URLs. The settings in the URLs are not case sensitive.
@features_1155_th
@features_1160_th
Topic
@features_1156_th
@features_1161_th
URL Format and Examples
@features_1157_td
@features_1162_td
Embedded (local) connection
@features_1158_td
@features_1163_td
jdbc:h2:[file:][&lt;path&gt;]&lt;databaseName&gt;
@features_1159_td
@features_1164_td
jdbc:h2:~/test
@features_1160_td
@features_1165_td
jdbc:h2:file:/data/sample
@features_1161_td
@features_1166_td
jdbc:h2:file:C:/data/sample (Windows only)
@features_1162_td
@features_1167_td
In-Memory (private)
@features_1163_td
@features_1168_td
jdbc:h2:mem:
@features_1164_td
@features_1169_td
In-Memory (named)
@features_1165_td
@features_1170_td
jdbc:h2:mem:&lt;databaseName&gt;
@features_1166_td
@features_1171_td
jdbc:h2:mem:test_mem
@features_1167_td
@features_1172_td
Remote using TCP/IP
@features_1168_td
@features_1173_td
jdbc:h2:tcp://&lt;server&gt;[:&lt;port&gt;]/&lt;databaseName&gt;
@features_1169_td
@features_1174_td
jdbc:h2:tcp://localhost/test
@features_1170_td
@features_1175_td
jdbc:h2:tcp://dbserv:8084/sample
@features_1171_td
@features_1176_td
Remote using SSL/TLS
@features_1172_td
@features_1177_td
jdbc:h2:ssl://&lt;server&gt;[:&lt;port&gt;]/&lt;databaseName&gt;
@features_1173_td
@features_1178_td
jdbc:h2:ssl://secureserv:8085/sample;
@features_1174_td
@features_1179_td
Using Encrypted Files
@features_1175_td
@features_1180_td
jdbc:h2:&lt;url&gt;;CIPHER=[AES|XTEA]
@features_1176_td
@features_1181_td
jdbc:h2:ssl://secureserv/testdb;CIPHER=AES
@features_1177_td
@features_1182_td
jdbc:h2:file:~/secure;CIPHER=XTEA
@features_1178_td
@features_1183_td
File Locking Methods
@features_1179_td
@features_1184_td
jdbc:h2:&lt;url&gt;;FILE_LOCK={NO|FILE|SOCKET}
@features_1180_td
@features_1185_td
jdbc:h2:file:~/quickAndDirty;FILE_LOCK=NO
@features_1181_td
@features_1186_td
jdbc:h2:file:~/private;CIPHER=XTEA;FILE_LOCK=SOCKET
@features_1182_td
@features_1187_td
Only Open if it Already Exists
@features_1183_td
@features_1188_td
jdbc:h2:&lt;url&gt;;IFEXISTS=TRUE
@features_1184_td
@features_1189_td
jdbc:h2:file:~/sample;IFEXISTS=TRUE
@features_1185_td
@features_1190_td
Don't Close the Database when the VM Exits
@features_1186_td
@features_1191_td
jdbc:h2:&lt;url&gt;;DB_CLOSE_ON_EXIT=FALSE
@features_1187_td
@features_1192_td
User Name and/or Password
@features_1188_td
@features_1193_td
jdbc:h2:&lt;url&gt;[;USER=&lt;username&gt;][;PASSWORD=&lt;value&gt;]
@features_1189_td
@features_1194_td
jdbc:h2:file:~/sample;USER=sa;PASSWORD=123
@features_1190_td
@features_1195_td
Log Index Changes
@features_1191_td
@features_1196_td
jdbc:h2:&lt;url&gt;;LOG=2
@features_1192_td
@features_1197_td
jdbc:h2:file:~/sample;LOG=2
@features_1193_td
@features_1198_td
Debug Trace Settings
@features_1194_td
@features_1199_td
jdbc:h2:&lt;url&gt;;TRACE_LEVEL_FILE=&lt;level 0..3&gt;
@features_1195_td
@features_1200_td
jdbc:h2:file:~/sample;TRACE_LEVEL_FILE=3
@features_1196_td
@features_1201_td
Ignore Unknown Settings
@features_1197_td
@features_1202_td
jdbc:h2:&lt;url&gt;;IGNORE_UNKNOWN_SETTINGS=TRUE
@features_1198_td
@features_1203_td
Custom File Access Mode
@features_1199_td
@features_1204_td
jdbc:h2:&lt;url&gt;;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws
@features_1200_td
@features_1205_td
In-Memory (private)
@features_1201_td
@features_1206_td
jdbc:h2:mem:
@features_1202_td
Database in Jar or Zip File
@features_1207_td
Database in or Zip File
@features_1203_td
@features_1208_td
jdbc:h2:zip:&lt;zipFileName&gt;!/&lt;databaseName&gt;
@features_1204_td
@features_1209_td
jdbc:h2:zip:db.zip!/test
@features_1205_td
@features_1210_td
Changing Other Settings
@features_1206_td
@features_1211_td
jdbc:h2:&lt;url&gt;;&lt;setting&gt;=&lt;value&gt;[;&lt;setting&gt;=&lt;value&gt;...]
@features_1207_td
@features_1212_td
jdbc:h2:file:~/sample;TRACE_LEVEL_SYSTEM_OUT=3
@features_1208_h3
@features_1213_h3
Connecting to an Embedded (Local) Database
@features_1209_p
@features_1214_p
The database URL for connecting to a local database is <code>jdbc:h2:[file:][&lt;path&gt;]&lt;databaseName&gt;</code> . The prefix <code>file:</code> is optional. If no or only a relative path is used, then the current working directory is used as a starting point. The case sensitivity of the path and database name depend on the operating system, however it is suggested to use lowercase letters only. The database name must be at least three characters long (a limitation of File.createTempFile). To point to the user home directory, use ~/, as in: jdbc:h2:~/test.
@features_1210_h3
@features_1215_h2
Memory-Only Databases
@features_1211_p
@features_1216_p
For certain use cases (for example: rapid prototyping, testing, high performance operations, read-only databases), it may not be required to persist (changes to) the data at all. This database supports the memory-only mode, where the data is not persisted.
@features_1212_p
@features_1217_p
In some cases, only one connection to a memory-only database is required. This means the database to be opened is private. In this case, the database URL is <code>jdbc:h2:mem:</code> Opening two connections within the same virtual machine means opening two different (private) databases.
@features_1213_p
@features_1218_p
Sometimes multiple connections to the same memory-only database are required. In this case, the database URL must include a name. Example: <code>jdbc:h2:mem:db1</code> . Accessing the same database in this way only works within the same virtual machine and class loader environment.
@features_1214_p
@features_1219_p
It is also possible to access a memory-only database remotely (or from multiple processes in the same machine) using TCP/IP or SSL/TLS. An example database URL is: <code>jdbc:h2:tcp://localhost/mem:db1</code> (using private database remotely is also possible).
@features_1215_h2
@features_1220_p
By default, when the last connection to a in-memory database is closed, the contents are lost. This can be disabled by adding ;DB_CLOSE_DELAY=-1 to the database URL. That means to keep the contents of an in-memory database as long as the virtual machine is alive, use jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
@features_1221_h2
Connecting to a Database with File Encryption
@features_1216_p
@features_1222_p
To use file encryption, it is required to specify the encryption algorithm (the 'cipher') and the file password. The algorithm needs to be specified using the connection parameter. Two algorithms are supported: XTEA and AES. The file password is specified in the password field, before the user password. A single space needs to be added between the file password and the user password; the file password itself may not contain spaces. File passwords (as well as user passwords) are case sensitive. Here is an example to connect to a password encrypted database:
@features_1217_h2
@features_1223_h2
Database File Locking
@features_1218_p
@features_1224_p
Whenever a database is opened, a lock file is created to signal other processes that the database is in use. If database is closed, or if the process that opened the database terminates, this lock file is deleted.
@features_1219_p
@features_1225_p
The following file locking methods are implemented:
@features_1220_li
@features_1226_li
The default method is 'file' and uses a watchdog thread to protect the database file. The watchdog reads the lock file each second.
@features_1221_li
@features_1227_li
The second method is 'socket' and opens a server socket. The socket method does not require reading the lock file every second. The socket method should only be used if the database files are only accessed by the one (and always the same) computer.
@features_1222_li
@features_1228_li
It is also possible to open the database without file locking; in this case it is up to the application to protect the database files.
@features_1223_p
@features_1229_p
To open the database with a different file locking method, use the parameter 'FILE_LOCK'. The following code opens the database with the 'socket' locking method:
@features_1224_p
@features_1230_p
The following code forces the database to not create a lock file at all. Please note that this is unsafe as another process is able to open the same database, possibly leading to data corruption:
@features_1225_p
@features_1231_p
For more information about the algorithms please see in Advanced Topics under File Locking Protocol.
@features_1226_h2
@features_1232_h2
Opening a Database Only if it Already Exists
@features_1227_p
@features_1233_p
By default, when an application calls <code>DriverManager.getConnection(url,...)</code> and the database specified in the URL does not yet exist, a new (empty) database is created. In some situations, it is better to restrict creating new database, and only open the database if it already exists. This can be done by adding <code>;ifexists=true</code> to the URL. In this case, if the database does not already exist, an exception is thrown when trying to connect. The connection only succeeds when the database already exists. The complete URL may look like this:
@features_1228_h2
@features_1234_h2
Closing the Database
@features_1229_h3
@features_1235_h3
Delayed Database Closing
@features_1230_p
@features_1236_p
Usually, the database is closed when the last connection to it is closed. In some situations this slows down the application, for example when it is not possible leave the connection open. The automatic closing of the database can be delayed or disabled with the SQL statement SET DB_CLOSE_DELAY &lt;seconds&gt;. The seconds specifies the number of seconds to keep a database open after the last connection to it was closed. For example the following statement will keep the database open for 10 seconds:
@features_1231_p
@features_1237_p
The value -1 means the database is never closed automatically. The value 0 is the default and means the database is closed when the last connection is closed. This setting is persistent and can be set by an administrator only. It is possible to set the value in the database URL: <code>jdbc:h2:~/test;DB_CLOSE_DELAY=10</code> .
@features_1232_h3
@features_1238_h3
Don't Close the Database when the VM Exits
@features_1233_p
@features_1239_p
By default, a database is closed when the last connection is closed. However, if it is never closed, the database is closed when the virtual machine exits normally. This is done using a shutdown hook. In some situations, the database should not be closed in this case, for example because the database is still used at virtual machine shutdown (to store the shutdown process in the database for example). For those cases, the automatic closing of the database can be disabled in the database URL. The first connection (the one that is opening the database) needs to set the option in the database URL (it is not possible to change the setting afterwards). The database URL to disable database closing on exit is:
@features_1234_h2
@features_1240_h2
Log Index Changes
@features_1235_p
@features_1241_p
Usually, changes to the index file are not logged for performance. If the index file is corrupt or missing when opening a database, it is re-created from the data. The index file can get corrupt when the database is not shut down correctly, because of power failure or abnormal program termination. In some situations, for example when using very large databases (over a few hundred MB), re-creating the index file takes very long. In these situations it may be better to log changes to the index file, so that recovery from a corrupted index file is fast. To enable log index changes, add LOG=2 to the URL, as in jdbc:h2:~/test;LOG=2 This setting should be specified when connecting. The update performance of the database will be reduced when using this option.
@features_1236_h3
@features_1242_h3
Ignore Unknown Settings
@features_1237_p
@features_1243_p
Some applications (for example OpenOffice.org Base) pass some additional parameters when connecting to the database. Why those parameters are passed is unknown. The parameters PREFERDOSLIKELINEENDS and IGNOREDRIVERPRIVILEGES are such examples, they are simply ignored to improve the compatibility with OpenOffice.org. If an application passes other parameters when connecting to the database, usually the database throws an exception saying the parameter is not supported. It is possible to ignored such parameters by adding ;IGNORE_UNKNOWN_SETTINGS=TRUE to the database URL.
@features_1238_h3
@features_1244_h3
Changing Other Settings when Opening a Connection
@features_1239_p
@features_1245_p
In addition to the settings already described (cipher, file_lock, ifexists, user, password), other database settings can be passed in the database URL. Adding <code>setting=value</code> at the end of an URL is the same as executing the statement <code>SET setting value</code> just after connecting. For a list of settings supported by this database please see the SQL grammar documentation.
@features_1240_h2
@features_1246_h2
Custom File Access Mode
@features_1241_p
@features_1247_p
Usually, the database opens log, data and index files with the access mode 'rw', meaning read-write (except for read only databases, where the mode 'r' is used). Also supported are 'rws' and 'rwd'. The access mode used for log files is set via ACCESS_MODE_LOG; for data and index files use ACCESS_MODE_DATA. These settings must be specified in the database URL:
@features_1242_p
@features_1248_p
For more information see <a href="advanced.html#durability_problems">Durability Problems</a> . On many operating systems the access mode 'rws' does not guarantee that the data is written to the disk.
@features_1243_h2
@features_1249_h2
Multiple Connections
@features_1244_h3
@features_1250_h3
Opening Multiple Databases at the Same Time
@features_1245_p
@features_1251_p
An application can open multiple databases at the same time, including multiple connections to the same database. The number of open database is only limited by the memory available.
@features_1246_h3
@features_1252_h3
Multiple Connections to the Same Database: Client/Server
@features_1247_p
@features_1253_p
If you want to access the same database at the same time from different processes or computers, you need to use the client / server mode. In this case, one process acts as the server, and the other processes (that could reside on other computers as well) connect to the server via TCP/IP (or SSL/TLS over TCP/IP for improved security).
@features_1248_h3
@features_1254_h3
Multithreading Support
@features_1249_p
@features_1255_p
This database is multithreading-safe. That means, if an application is multi-threaded, it does not need o worry about synchronizing the access to the database. Internally, most requests to the same database are synchronized. That means an application can use multiple threads all accessing the same database at the same time, however if one thread executes a long running query, the other threads need to wait.
@features_1250_h3
@features_1256_h3
Locking, Lock-Timeout, Deadlocks
@features_1251_p
@features_1257_p
The database uses table level locks to give each connection a consistent state of the data. There are two kinds of locks: read locks (shared locks) and write locks (exclusive locks). If a connection wants to reads from a table, and there is no write lock on the table, then a read lock is added to the table. If there is a write lock, then this connection waits for the other connection to release the lock. If connection cannot get a lock for a specified time, then a lock timeout exception is thrown.
@features_1252_p
@features_1258_p
Usually, SELECT statement will generate read locks. This includes subqueries. Statements that modify data use write locks. It is also possible to lock a table exclusively without modifying data, using the statement SELECT ... FOR UPDATE. The statements COMMIT and ROLLBACK releases all open locks. The commands SAVEPOINT and ROLLBACK TO SAVEPOINT don't affect locks. The locks are also released when the autocommit mode changes, and for connections with autocommit set to true (this is the default), locks are released after each statement. Here is an overview on what statements generate what type of lock:
@features_1253_th
@features_1259_th
Type of Lock
@features_1254_th
@features_1260_th
SQL Statement
@features_1255_td
@features_1261_td
Read
@features_1256_td
@features_1262_td
SELECT * FROM TEST
@features_1257_td
@features_1263_td
CALL SELECT MAX(ID) FROM TEST
@features_1258_td
@features_1264_td
SCRIPT
@features_1259_td
@features_1265_td
Write
@features_1260_td
@features_1266_td
SELECT * FROM TEST WHERE 1=0 FOR UPDATE
@features_1261_td
@features_1267_td
Write
@features_1262_td
@features_1268_td
INSERT INTO TEST VALUES(1, 'Hello')
@features_1263_td
@features_1269_td
INSERT INTO TEST SELECT * FROM TEST
@features_1264_td
@features_1270_td
UPDATE TEST SET NAME='Hi'
@features_1265_td
@features_1271_td
DELETE FROM TEST
@features_1266_td
@features_1272_td
Write
@features_1267_td
@features_1273_td
ALTER TABLE TEST ...
@features_1268_td
@features_1274_td
CREATE INDEX ... ON TEST ...
@features_1269_td
@features_1275_td
DROP INDEX ...
@features_1270_p
@features_1276_p
The number of seconds until a lock timeout exception is thrown can be set separately for each connection using the SQL command SET LOCK_TIMEOUT &lt;milliseconds&gt;. The initial lock timeout (that is the timeout used for new connections) can be set using the SQL command SET DEFAULT_LOCK_TIMEOUT &lt;milliseconds&gt;. The default lock timeout is persistent.
@features_1271_h2
@features_1277_h2
Database File Layout
@features_1272_p
@features_1278_p
There are a number of files created for persistent databases. Other than some databases, not every table and/or index is stored in its own file. Instead, usually only the following files are created: A data file, an index file, a log file, and a database lock file (exists only while the database is in use). In addition to that, a file is created for each large object (CLOB/BLOB), a file for each linear index, and temporary files for large result sets. Then the command SCRIPT can create script files. If the database trace option is enabled, trace files are created. The following files can be created by the database:
@features_1273_th
@features_1279_th
File Name
@features_1274_th
@features_1280_th
Description
@features_1275_th
@features_1281_th
Number of Files
@features_1276_td
@features_1282_td
test.data.db
@features_1277_td
@features_1283_td
Data file
@features_1278_td
@features_1284_td
Contains the data for all tables
@features_1279_td
@features_1285_td
Format: &lt;database&gt;.data.db
@features_1280_td
@features_1286_td
1 per database
@features_1281_td
@features_1287_td
test.index.db
@features_1282_td
@features_1288_td
Index file
@features_1283_td
@features_1289_td
Contains the data for all (btree) indexes
@features_1284_td
@features_1290_td
Format: &lt;database&gt;.index.db
@features_1285_td
@features_1291_td
1 per database
@features_1286_td
@features_1292_td
test.0.log.db
@features_1287_td
@features_1293_td
Log file
@features_1288_td
@features_1294_td
The log file is used for recovery
@features_1289_td
@features_1295_td
Format: &lt;database&gt;.&lt;id&gt;.log.db
@features_1290_td
@features_1296_td
0 or more per database
@features_1291_td
@features_1297_td
test.lock.db
@features_1292_td
@features_1298_td
Database lock file
@features_1293_td
@features_1299_td
Exists only if the database is open
@features_1294_td
@features_1300_td
Format: &lt;database&gt;.lock.db
@features_1295_td
@features_1301_td
1 per database
@features_1296_td
@features_1302_td
test.trace.db
@features_1297_td
@features_1303_td
Trace file
@features_1298_td
@features_1304_td
Contains trace information
@features_1299_td
@features_1305_td
Format: &lt;database&gt;.trace.db
@features_1300_td
@features_1306_td
If the file is too big, it is renamed to &lt;database&gt;.trace.db.old
@features_1301_td
@features_1307_td
1 per database
@features_1302_td
@features_1308_td
test.14.15.lob.db
@features_1303_td
@features_1309_td
Large object
@features_1304_td
@features_1310_td
Contains the data for BLOB or CLOB
@features_1305_td
@features_1311_td
Format: &lt;database&gt;.&lt;tableid&gt;.&lt;id&gt;.lob.db
@features_1306_td
@features_1312_td
1 per object
@features_1307_td
@features_1313_td
test.123.temp.db
@features_1308_td
@features_1314_td
Temporary file
@features_1309_td
@features_1315_td
Contains a temporary blob or a large result set
@features_1310_td
@features_1316_td
Format: &lt;database&gt;.&lt;session id&gt;.&lt;object id&gt;.temp.db
@features_1311_td
@features_1317_td
1 per object
@features_1312_td
@features_1318_td
test.7.hash.db
@features_1313_td
@features_1319_td
Hash index file
@features_1314_td
@features_1320_td
Contains the data for a linear hash index
@features_1315_td
@features_1321_td
Format: &lt;database&gt;.&lt;object id&gt;.hash.db
@features_1316_td
@features_1322_td
1 per linear hash index
@features_1317_h3
@features_1323_h3
Moving and Renaming Database Files
@features_1318_p
@features_1324_p
Database name and location are not stored inside the database names.
@features_1319_p
@features_1325_p
While a database is closed, the files can be moved to another directory, and they can be renamed as well (as long as all files start with the same name).
@features_1320_p
@features_1326_p
As there is no platform specific data in the files, they can be moved to other operating systems without problems.
@features_1321_h3
@features_1327_h3
Backup
@features_1322_p
@features_1328_p
When the database is closed, it is possible to backup the database files. Please note that index files do not need to be backed up, because they contain redundant data, and will be recreated automatically if they don't exist.
@features_1323_p
@features_1329_p
To backup data while the database is running, the SQL command SCRIPT can be used.
@features_1324_h2
@features_1330_h2
Logging and Recovery
@features_1325_p
@features_1331_p
Whenever data is modified in the database and those changes are committed, the changes are logged to disk (except for in-memory objects). The changes to the data file itself are usually written later on, to optimize disk access. If there is a power failure, the data and index files are not up-to-date. But because the changes are in the log file, the next time the database is opened, the changes that are in the log file are re-applied automatically.
@features_1326_p
@features_1332_p
Please note that index file updates are not logged by default. If the database is opened and recovery is required, the index file is rebuilt from scratch.
@features_1327_p
@features_1333_p
There is usually only one log file per database. This file grows until the database is closed successfully, and is then deleted. Or, if the file gets too big, the database switches to another log file (with a higher id). It is possible to force the log switching by using the CHECKPOINT command.
@features_1328_p
@features_1334_p
If the database file is corrupted, because the checksum of a record does not match (for example, if the file was edited with another application), the database can be opened in recovery mode. In this case, errors in the database are logged but not thrown. The database should be backed up to a script and re-built as soon as possible. To open the database in the recovery mode, use a database URL must contain RECOVER=1, as in jdbc:h2:~/test;RECOVER=1. Indexes are rebuilt in this case, and the summary (object allocation table) is not read in this case, so opening the database takes longer.
@features_1329_h2
@features_1335_h2
Compatibility
@features_1336_p
All database engines behave a little bit different. Where possible, H2 supports the ANSI SQL standard, and tries to be compatible to other databases. There are still a few differences however:
@features_1337_p
In MySQL text columns are case insensitive by default, while in H2 they are case sensitive. However H2 supports case insensitive columns as well. To create the tables with case insensitive texts, append IGNORECASE=TRUE to the database URL (example: jdbc:h2:test;IGNORECASE=TRUE).
@features_1338_h3
Compatibility Modes
@features_1330_p
All database engines behave a little bit different. For certain features, this database can emulate the behavior of specific databases. Not all features or differences of those databases are implemented. Currently, this feature is mainly used for randomized comparative testing (where random statements are executed against multiple databases and the results are compared). The mode can be changed by specifying the mode in the database URL, or using the SQL statement SET MODE. To use the HSQLDB mode, you can use the database URL <code>jdbc:h2:~/test;MODE=HSQLDB</code> or the SQL statement <code>SET MODE HSQLDB</code> . Here is the list of currently supported modes and the difference to the regular mode:
@features_1339_p
For certain features, this database can emulate the behavior of specific databases. Not all features or differences of those databases are implemented. Currently, this feature is mainly used for randomized comparative testing (where random statements are executed against multiple databases and the results are compared). The mode can be changed by specifying the mode in the database URL, or using the SQL statement SET MODE. To use the HSQLDB mode, you can use the database URL <code>jdbc:h2:~/test;MODE=HSQLDB</code> or the SQL statement <code>SET MODE HSQLDB</code> . Here is the list of currently supported modes and the difference to the regular mode:
@features_1331_th
@features_1340_th
Mode
@features_1332_th
@features_1341_th
Differences
@features_1333_td
@features_1342_td
PostgreSQL
@features_1334_td
@features_1343_td
Concatenation of a NULL with another value results in NULL. Usually, the NULL is treated as an empty string if only one of the operators is NULL, and NULL is only returned if both values are NULL.
@features_1335_td
@features_1344_td
MySQL
@features_1336_td
@features_1345_td
When inserting data, if a column is defined to be NOT NULL and NULL is inserted, then a 0 (or empty string, or the current timestamp for timestamp columns) value is used. Usually, this operation is not allowed and an exception is thrown.
@features_1337_td
@features_1346_td
HSQLDB
@features_1338_td
@features_1347_td
When converting the scale of decimal data, the number is only converted if the new scale is smaller then current scale. Usually, the scale is converted and 0s are added if required.
@features_1339_h2
@features_1348_h2
Using the Trace Options
@features_1340_p
@features_1349_p
To find problems in an application, it is sometimes good to see what database operations where executed. This database offers the following trace features:
@features_1341_li
@features_1350_li
Trace to System.out and/or a file
@features_1342_li
@features_1351_li
Support for trace levels OFF, ERROR, INFO, and DEBUG
@features_1343_li
@features_1352_li
The maximum size of the trace file can be set
@features_1344_li
@features_1353_li
The Java code generation is possible
@features_1345_li
@features_1354_li
Trace can be enabled at runtime by manually creating a file
@features_1346_h3
@features_1355_h3
Trace Options
@features_1347_p
@features_1356_p
The simplest way to enable the trace option is setting it in the database URL. There are two settings, one for System.out (TRACE_LEVEL_SYSTEM_OUT) tracing, and one for file tracing (TRACE_LEVEL_FILE). The trace levels are 0 for OFF, 1 for ERROR (the default), 2 for INFO and 3 for DEBUG. A database URL with both levels set to DEBUG is:
@features_1348_p
@features_1357_p
The trace level can be changed at runtime by executing the SQL command <code>SET TRACE_LEVEL_SYSTEM_OUT level</code> (for System.out tracing) or <code>SET TRACE_LEVEL_FILE level</code> (for file tracing). Example:
@features_1349_h3
@features_1358_h3
Setting the Maximum Size of the Trace File
@features_1350_p
@features_1359_p
When using a high trace level, the trace file can get very big quickly. The size of the file can be limited by executing the SQL statement <code>SET TRACE_MAX_FILE_SIZE maximumFileSizeInMB</code> . If the log file exceeds the limit, the file is renamed to .old and a new file is created. If another .old file exists, it is deleted. The default setting is 16 MB. Example:
@features_1351_h3
@features_1360_h3
Java Code Generation
@features_1352_p
@features_1361_p
When setting the trace level to INFO or DEBUG, Java source code is generated as well, so that problem can be reproduced more easily. The trace file looks like this:
@features_1353_p
@features_1362_p
You need to filter out the lines without /**/ to get the Java source code. In Windows, a simple way to do that is:
@features_1354_p
@features_1363_p
Afterwards, you need to complete the file Trace.java before it can be compiled, for example with:
@features_1355_p
@features_1364_p
Also, the user name and password needs to be set, because they are not listed in the trace file.
@features_1356_h3
@features_1365_h3
Enabling the Trace Option at Runtime by Manually Creating a File
@features_1357_p
@features_1366_p
Sometimes, you can't or don't want to change the application or database URL. There is still a way to enable the trace mode in these cases, even at runtime (while the database connection is open). You only need to create a special file in the directory where the database files are stored. The database engine checks every 4 seconds if this file exists (only while executing a statement). The file name is the database name plus '.trace.db.start'. This feature is disabled if the database is encrypted.
@features_1358_p
@features_1367_p
Example: if a database is called 'test', then the file to start tracing is 'test.trace.db.start'. The database engine tries to delete this file when it detects it. If trace is enabled using the start file, the trace level is not persistent to the database, and trace is switched back to the level that was set before when connecting to the database. However, if the start file is read only, the database engine cannot delete the file and will always enable the trace mode when connecting.
@features_1359_h2
@features_1368_h2
Read Only Databases
@features_1360_p
@features_1369_p
If the database files are read-only, then the database is read-only as well. It is not possible to create new tables, add or modify data in this database. Only SELECT statements are allowed. To create a read-only database, close the database so that the log file gets smaller. Do not delete the log file. Then, make the database files read-only using the operating system. When you open the database now, it is read-only. There are two ways an application can find out a database is read-only: By calling Connection.isReadOnly() or by executing the SQL statement CALL READONLY().
@features_1361_h2
@features_1370_h2
Read Only Databases in Zip or Jar File
@features_1371_p
To create a read-only database in a zip, first create a regular persistent database, and then create a backup. If you are using a database named 'test', an easy way to do that is using the BACKUP SQL statement:
@features_1372_p
Afterwards, you can log out, and directly open the database in the zip file using the following database URL:
@features_1373_p
Databases in a zip file are read-only. The performance for some queries will be slower than when using a regular database, because random access in zip files is not supported (only streaming). How much this affects the performance depends on the queries and the data. The database is not read in memory, so large databases are supported as well. The same indexes are used than when using a regular database.
@features_1374_h2
Binary and Text Storage Formats
@features_1362_p
@features_1375_p
This database engine supports both binary and text storage formats. The binary format is faster, but the text storage format can be useful as well, for example to debug the database engine. If a database already exists, the storage format is recognized automatically. New databases are created in the binary storage format by default. To create a new database in the text storage format, the database URL must contain the parameter STORAGE=TEXT. Example URL: jdbc:h2:~/test;STORAGE=TEXT
@features_1363_h2
@features_1376_h2
Graceful Handling of Low Disk Space Situations
@features_1364_p
@features_1377_p
The database is able to deal with situations where the disk space available is running low. Whenever the database starts, an 'emergency space' file is created (size is 1 MB), and if there is no more space available, the file will shrink. If the space available is lower than 128 KB, the database will go into a special read only mode, where writing operations are no longer allowed: All writing operations will throw the exception 'No disk space available' from this point on. To go back to the normal operating mode, all connections to the database need to be closed first, and space needs to be freed up.
@features_1365_p
@features_1378_p
It is possible to install a database event listener to detect low disk space situations early on (when only 1 MB if space is available). To do this, use the SQL statement SET DATABASE_EVENT_LISTENER. The listener can also be set at connection time, using an URL of the form jdbc:h2:~/test;DATABASE_EVENT_LISTENER='com.acme.DbListener' (the quotes around the class name are required). See also the DatabaseEventListener API.
@features_1366_h3
@features_1379_h3
Opening a Corrupted Database
@features_1367_p
@features_1380_p
If a database can not be opened because the boot info (the SQL script that is run at startup) is corrupted, then the database can be opened by specifying a database event listener. The exceptions are logged, but opening the database will continue.
@features_1368_h2
@features_1381_h2
Computed Columns / Function Based Index
@features_1369_p
@features_1382_p
Function indexes are not directly supported by this database, but they can be easily emulated by using computed columns. For example, if an index on the upper-case version of a column is required, just create a computed column with the upper-case version of the original column, and index this column:
@features_1370_p
@features_1383_p
When inserting data, it is not required (better: not allowed) to specify a value for the upper-case version of the column, because the value is generated. But you can use the column when querying the table:
@features_1371_h2
@features_1384_h2
Multi-Dimensional Indexes
@features_1372_p
@features_1385_p
A tool is provided to execute efficient multi-dimension (spatial) range queries. This database does not support a specialized spatial index (R-Tree or similar). Instead, the B-Tree index is used. For each record, the multi-dimensional key is converted (mapped) to a single dimensional (scalar) value. This value specifies the location on a space-filling curve.
@features_1373_p
@features_1386_p
Currently, Z-order (also called N-order or Morton-order) is used; Hilbert curve could also be used, but the implementation is more complex. The algorithm to convert the multi-dimensional value is called bit-interleaving. The scalar value is indexed using a B-Tree index (usually using a computed column).
@features_1374_p
@features_1387_p
The method can result in a drastic performance improvement over just using an index on the first column. Depending on the data and number of dimensions, the improvement is usually higher than factor 5. The tool generates a SQL query from a specified multi-dimensional range. The method used is not database dependent, and the tool can easily be ported to other databases. For an example how to use the tool, please have a look at the sample code provided in TestMultiDimension.java.
@features_1375_h2
@features_1388_h2
Using Passwords
@features_1376_h3
@features_1389_h3
Using Secure Passwords
@features_1377_p
@features_1390_p
Remember that weak passwords can be broken no matter of the encryption and security protocol. Don't use passwords that can be found in a dictionary. Also appending numbers does not make them secure. A way to create good passwords that can be remembered is, take the first letters of a sentence, use upper and lower case characters, and creatively include special characters. Example:
@features_1378_p
@features_1391_p
i'sE2rtPiUKtT (it's easy to remember this password if you know the trick)
@features_1379_h3
@features_1392_h3
Passwords: Using Char Arrays instead of Strings
@features_1380_p
@features_1393_p
Java Strings are immutable objects and cannot be safely 'destroyed' by the application. After creating a String, it will remain in the main memory of the computer at least until it is garbage collected. The garbage collection cannot be controlled by the application, and even if it is garbage collected the data may still remain in memory. It might also be possible that the part of memory containing the password is swapped to disk (because not enough main memory is available).
@features_1381_p
@features_1394_p
An attacker might have access to the swap file of the operating system. It is therefore a good idea to use char arrays instead of Strings to store passwords. Char arrays can be cleared (filled with zeros) after use, and therefore the password will not be stored in the swap file.
@features_1382_p
@features_1395_p
This database supports using char arrays instead of String to pass user and file passwords. The following code can be used to do that:
@features_1383_p
@features_1396_p
In this example, the password is hard code in the application, which is not secure of course. However, Java Swing supports a way to get passwords using a char array (JPasswordField).
@features_1384_h3
@features_1397_h3
Passing the User Name and/or Password in the URL
@features_1385_p
@features_1398_p
Instead of passing the user name as a separate parameter as in <code>Connection conn = DriverManager. getConnection("jdbc:h2:~/test", "sa", "123");</code> the user name (and/or password) can be supplied in the URL itself: <code>Connection conn = DriverManager. getConnection("jdbc:h2:~/test;USER=sa;PASSWORD=123");</code> The settings in the URL override the settings passed as a separate parameter.
@features_1386_h2
@features_1399_h2
User Defined Functions and Stored Procedures
@features_1387_p
@features_1400_p
In addition to the built-in functions, this database supports user defined Java functions. In this database, Java functions can be used as stored procedures as well. A function must be declared (registered) before it can be used. Only static Java methods are supported; both the class and the method must be public. Example Java method:
@features_1388_p
@features_1401_p
The Java function must be registered in the database by calling CREATE ALIAS:
@features_1389_p
@features_1402_p
For a complete sample application, see src/test/org/h2/samples/Function.java.
@features_1390_h3
@features_1403_h3
Function Data Type Mapping
@features_1391_p
@features_1404_p
Functions that accept non-nullable parameters such as 'int' will not be called if one of those parameters is NULL. In this case, the value NULL is used as the result. If the function should be called in this case, you need to use 'java.lang.Integer' instead of 'int'.
@features_1392_h3
@features_1405_h3
Functions that require a Connection
@features_1393_p
@features_1406_p
If the first parameter in a Java function is a java.sql.Connection, then the connection to database is provided. This connection does not need to be closed before returning.
@features_1394_h3
@features_1407_h3
Functions throwing an Exception
@features_1395_p
@features_1408_p
If a function throws an Exception, then the current statement is rolled back and the exception is thrown to the application.
@features_1396_h3
@features_1409_h3
Functions returning a Result Set
@features_1397_p
@features_1410_p
Functions may returns a result set. Such a function can be called with the CALL statement:
@features_1398_h3
@features_1411_h3
Using SimpleResultSet
@features_1399_p
@features_1412_p
A function that returns a result set can create this result set from scratch using the SimpleResultSet tool:
@features_1400_h3
@features_1413_h3
Using a Function as a Table
@features_1401_p
@features_1414_p
A function returning a result set can be like a table. However, in this case the function is called at least twice: First while parsing the statement to collect the column names (with parameters set to null where not known at compile time). And then, while executing the statement to get the data (may be repeatedly if this is a join). If the function is called just to get the column list, the URL of the connection passed to the function is jdbc:columnlist:connection. Otherwise, the URL of the connection is jdbc:default:connection.
@features_1402_h2
@features_1415_h2
Triggers
@features_1403_p
@features_1416_p
This database supports Java triggers that are called before or after a row is updated, inserted or deleted. Triggers can be used for complex consistency checks, or to update related data in the database. It is also possible to use triggers to simulate materialized views. For a complete sample application, see src/test/org/h2/samples/TriggerSample.java. A Java trigger must implement the interface org.h2.api.Trigger:
@features_1404_p
@features_1417_p
The connection can be used to query or update data in other tables. The trigger then needs to be defined in the database:
@features_1405_p
@features_1418_p
The trigger can be used to veto a change, by throwing a SQL Exception.
@features_1406_h2
@features_1419_h2
Compacting a Database
@features_1407_p
@features_1420_p
Empty space in the database file is re-used automatically. To re-build the indexes, the most simple way is to delete the .index.db file while the database is closed. However in some situations (for example after deleting a lot of data in a database), one sometimes wants to shrink the size of the database (compact a database). Here is a sample function to do this:
@features_1408_p
@features_1421_p
See also the sample application org.h2.samples.Compact. The commands SCRIPT / RUNSCRIPT can be used as well to create the a backup of a database and re-build the database from the script.
@features_1409_h2
@features_1422_h2
Cache Settings
@features_1410_p
@features_1423_p
The database keeps most frequently used data and index pages in the main memory. The amount of memory used for caching can be changed using the setting CACHE_SIZE. This setting can be set in the database connection URL (jdbc:h2:~/test;CACHE_SIZE=131072), or it can be changed at runtime using SET CACHE_SIZE size.
@features_1411_p
@features_1424_p
This database supports two cache page replacement algorithms: LRU (the default) and 2Q. For LRU, the pages that were least frequently used are removed from the cache if it becomes full. The 2Q algorithm is a bit more complicated, basically two queues are used. The 2Q algorithm is more resistant to table scans, however the overhead is a bit higher compared to the LRU. To use the cache algorithm 2Q, use a database URL of the form jdbc:h2:~/test;CACHE_TYPE=TQ. The cache algorithm can not be changed once the database is open.
@features_1412_p
@features_1425_p
To get information about page reads and writes, and the current caching algorithm in use, call SELECT * FROM INFORMATION_SCHEMA.SETTINGS. The number of pages read / written is listed for the data and index file.
@features_1413_h2
@features_1426_h2
Why Java
@features_1414_p
@features_1427_p
A few reasons using a Java database are:
@features_1415_li
@features_1428_li
Very simple to integrate in Java applications
@features_1416_li
@features_1429_li
Support for many different platforms
@features_1417_li
@features_1430_li
More secure than native applications (no buffer overflows)
@features_1418_li
@features_1431_li
User defined functions (or triggers) run very fast
@features_1419_li
@features_1432_li
Unicode support
@features_1420_p
@features_1433_p
Some people think that Java is still too slow for low level operations, but this is not the case (not any more). In general, the code can be written a lot faster than using C or C++. Like that, it is possible to concentrate on improving the algorithms (that make the application faster) rather than porting the code and dealing with low level stuff (such as memory management or dealing with threads). Garbage collection is now probably faster than manual memory management.
@features_1421_p
@features_1434_p
A lot of features are already built in (for example Unicode, network libraries). It is very easy to write secure code because buffer overflows and such problems can be detected very easily. Some features such as the reflection mechanism can be used for randomized testing.
@features_1422_p
@features_1435_p
Java is also future proof: A lot of companies support Java, and it is now open source.
@features_1423_p
@features_1436_p
This software does not rely on many Java libraries or other software, to increase the portability and ease of use, and for performance reasons. For example, the encryption algorithms and many library functions are implemented in the database instead of using the existing libraries. Libraries that are not available in open source Java implementations (such as Swing) are not used or only used for specific features.
@frame_1000_p
......@@ -2653,6 +2716,9 @@ Antonio Casqueiro, Portugal
@history_1020_li
lumber-mill.co.jp, Japan
@history_1021_li
Oliver Computing LLC, USA
@installation_1000_h1
Installation
......@@ -2735,21 +2801,15 @@ docs/javadoc
Javadoc files
@installation_1027_td
odbc
@installation_1028_td
ODBC drivers and tools
@installation_1029_td
service
@installation_1030_td
@installation_1028_td
Tools to run the database as a Windows Service
@installation_1031_td
@installation_1029_td
src
@installation_1032_td
@installation_1030_td
Source files
@license_1000_h1
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -153,6 +153,7 @@
90130=This method is not allowed for a prepared statement; use a regular statement instead.
90131=Concurrent update in table {0}\: another transaction has updated or deleted the same row
90132=Aggregate {0} not found
90133=Cannot change the setting {0} when the database is already open
HY000=General error\: {0}
HY004=Unknown data type\: {0}
HYC00=Feature not supported
......
......@@ -153,6 +153,7 @@
90130=Diese Methode ist nicht erlaubt f\u00FCr ein PreparedStatement; ben\u00FCtzen Sie ein Statement.
90131=Gleichzeitige \u00C4nderung in Tabelle {0}\: eine andere Transaktion hat den gleichen Datensatz ge\u00E4ndert oder gel\u00F6scht
90132=Aggregat-Funktion {0} nicht gefunden
90133=\#Cannot change the setting {0} when the database is already open
HY000=Allgemeiner Fehler\: {0}
HY004=Unbekannter Datentyp\: {0}
HYC00=Dieses Feature wird unterst\u00FCtzt
......
......@@ -153,6 +153,7 @@
90130=\u30D7\u30EA\u30DA\u30A2\u30C9\u30B9\u30C6\u30FC\u30C8\u30E1\u30F3\u30C8\u306B\u3053\u306E\u30E1\u30BD\u30C3\u30C9\u306F\u8A31\u3055\u308C\u3066\u3044\u307E\u305B\u3093; \u304B\u308F\u308A\u306B\u901A\u5E38\u306E\u30B9\u30C6\u30FC\u30C8\u30E1\u30F3\u30C8\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
90131=\u30C6\u30FC\u30D6\u30EB {0} \u306B\u4E26\u884C\u3057\u3066\u66F4\u65B0\u304C\u884C\u308F\u308C\u307E\u3057\u305F\: \u5225\u306E\u30C8\u30E9\u30F3\u30B6\u30AF\u30B7\u30E7\u30F3\u304C\u3001\u540C\u3058\u884C\u306B\u66F4\u65B0\u304B\u524A\u9664\u3092\u884C\u3044\u307E\u3057\u305F
90132=\#Aggregate {0} not found
90133=\#Cannot change the setting {0} when the database is already open
HY000=\u4E00\u822C\u30A8\u30E9\u30FC\: {0}
HY004=\u4E0D\u660E\u306A\u30C7\u30FC\u30BF\u578B\: {0}
HYC00=\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
......
......@@ -153,6 +153,7 @@
90130=\#This method is not allowed for a prepared statement; use a regular statement instead.
90131=\#Concurrent update in table {0}\: another transaction has updated or deleted the same row
90132=\#Aggregate {0} not found
90133=\#Cannot change the setting {0} when the database is already open
HY000=Blad ogolny\: {0}
HY004=Nieznany typ danyche\: {0}
HYC00=Cecha nie jest wspierana
......
.translator=Eduardo Fonseca Velasques
02000=N\u00e3o h\u00e1 dados dispon\u00edveis
07001=Quantidade de par\u00e2metros errados para {0}, experado\: {1}
02000=N\u00E3o h\u00E1 dados dispon\u00EDveis
07001=Quantidade de par\u00E2metros errados para {0}, experado\: {1}
08000=Erro ao abrir a base de dados
08004=Autentica\u00e7ao inv\u00e1lida, verifique o usu\u00e1rio ou a senha
21S02=A quantidade de colunas n\u00e3o corresponde
22003=Valor n\u00famerico n\u00e3o esta dentro do limite
22012=Divis\u00e3o por zero\: {0}
08004=Autentica\u00E7ao inv\u00E1lida, verifique o usu\u00E1rio ou a senha
21S02=A quantidade de colunas n\u00E3o corresponde
22003=Valor n\u00FAmerico n\u00E3o esta dentro do limite
22012=Divis\u00E3o por zero\: {0}
22025=Erro em LIKE ESCAPE\: {0}
23000=Viola\u00e7\u00e3o da restri\u00e7\u00e3o\: {0}
23001=Viola\u00e7\u00e3o de \u00edndice \u00fanico ou de chave prim\u00e1ria\: {0}
23002=Viola\u00e7\u00e3o da integridade de restri\u00e7\u00e3o\: {0}
23003=Viola\u00e7\u00e3o da integridade de restri\u00e7\u00e3o\: {0}
42000=Erro de sintax na declara\u00e7\u00e3o SQL {0}
42001=Erro de sintax na declara\u00e7\u00e3o SQL {0}; esperado {1}
42S01=Tabela {0} j\u00e1 existe
42S02=Tabela {0} n\u00e3o foi encontrada
42S11=\u00edndice {0} j\u00e1 existe
42S12=\u00edndice {0} n\u00e3o foi encontrado
23000=Viola\u00E7\u00E3o da restri\u00E7\u00E3o\: {0}
23001=Viola\u00E7\u00E3o de \u00EDndice \u00FAnico ou de chave prim\u00E1ria\: {0}
23002=Viola\u00E7\u00E3o da integridade de restri\u00E7\u00E3o\: {0}
23003=Viola\u00E7\u00E3o da integridade de restri\u00E7\u00E3o\: {0}
42000=Erro de sintax na declara\u00E7\u00E3o SQL {0}
42001=Erro de sintax na declara\u00E7\u00E3o SQL {0}; esperado {1}
42S01=Tabela {0} j\u00E1 existe
42S02=Tabela {0} n\u00E3o foi encontrada
42S11=\u00EDndice {0} j\u00E1 existe
42S12=\u00EDndice {0} n\u00E3o foi encontrado
42S21=Nome duplicado da coluna {0}
42S22=Coluna {0} n\u00e3o foi encontrada
42S32=Defini\u00e7\u00e3o {0} n\u00e3o foi encontrada
90000=Fun\u00e7\u00e3o {0} deve retornar algum resultado
90001=O m\u00e9todo n\u00e3o esta h\u00e1bilitado para consulta. Use o execute ou o executeQuery em vez de executeUpdate
90002=O m\u00e9todo \u00e9 apenas para consulta. Use o execute ou o executeUpdate em vez de executeQuery
90003=Sequ\u00eancia Hexadecimal com n\u00famero \u00edmpar de caracteres\: {0}
90004=Sequ\u00eancia Hexadecimal cont\u00eam caracteres inv\u00e1lidos\: {0}
42S22=Coluna {0} n\u00E3o foi encontrada
42S32=Defini\u00E7\u00E3o {0} n\u00E3o foi encontrada
90000=Fun\u00E7\u00E3o {0} deve retornar algum resultado
90001=O m\u00E9todo n\u00E3o esta h\u00E1bilitado para consulta. Use o execute ou o executeQuery em vez de executeUpdate
90002=O m\u00E9todo \u00E9 apenas para consulta. Use o execute ou o executeUpdate em vez de executeQuery
90003=Sequ\u00EAncia Hexadecimal com n\u00FAmero \u00EDmpar de caracteres\: {0}
90004=Sequ\u00EAncia Hexadecimal cont\u00EAm caracteres inv\u00E1lidos\: {0}
90005=Valor muito longo para a coluna {0}
90006=NULL n\u00e3o \u00e9 permitido para a coluna {0}
90007=O objeto est\u00e1 fechado
90008=Valor inv\u00e1lido {0} para o par\u00e2metro {1}
90009=N\u00e3o \u00e9 poss\u00edvel converter {0} para date, causa\: {1}
90010=N\u00e3o \u00e9 poss\u00edvel converter {0} para time, causa\: {1}
90011=N\u00e3o \u00e9 poss\u00edvel converter {0} para timestamp, causa\: {1}
90012=Par\u00e2metro {0} n\u00e3o esta definido
90013=Base de dados {0} n\u00e3o encontrada
90014=Erro na convers\u00e3o {0}
90006=NULL n\u00E3o \u00E9 permitido para a coluna {0}
90007=O objeto est\u00E1 fechado
90008=Valor inv\u00E1lido {0} para o par\u00E2metro {1}
90009=N\u00E3o \u00E9 poss\u00EDvel converter {0} para date, causa\: {1}
90010=N\u00E3o \u00E9 poss\u00EDvel converter {0} para time, causa\: {1}
90011=N\u00E3o \u00E9 poss\u00EDvel converter {0} para timestamp, causa\: {1}
90012=Par\u00E2metro {0} n\u00E3o esta definido
90013=Base de dados {0} n\u00E3o encontrada
90014=Erro na convers\u00E3o {0}
90015=SUM ou AVG com tipo de dados errado para {0}
90016=Coluna {0} tamb\u00e9m deve estar no group by
90017=Tentativa para definir uma segunda chave prim\u00e1ria
90018=A conec\u00e7\u00e3o foi fechada pela aplica\u00e7\u00e3o e retirada da mem\u00f3ria
90019=N\u00e3o pode remover o usu\u00e1rio corrente
90020=A base de dados talvez esteja em uso\: {0}. Solu\u00e7\u00e3o poss\u00edvel\: fechar todas as outras conec\u00e7\u00f5es; use o modo servidor
90021=Erro na convers\u00e3o de dado, convertendo {0}
90022=Fun\u00e7\u00e3o {0} n\u00e3o encontrada
90023=Coluna {0} n\u00e3o deve permitir valor nulo
90016=Coluna {0} tamb\u00E9m deve estar no group by
90017=Tentativa para definir uma segunda chave prim\u00E1ria
90018=A conec\u00E7\u00E3o foi fechada pela aplica\u00E7\u00E3o e retirada da mem\u00F3ria
90019=N\u00E3o pode remover o usu\u00E1rio corrente
90020=A base de dados talvez esteja em uso\: {0}. Solu\u00E7\u00E3o poss\u00EDvel\: fechar todas as outras conec\u00E7\u00F5es; use o modo servidor
90021=Erro na convers\u00E3o de dado, convertendo {0}
90022=Fun\u00E7\u00E3o {0} n\u00E3o encontrada
90023=Coluna {0} n\u00E3o deve permitir valor nulo
90024=Erro ao renomear arquivo {0} para {1}
90025=N\u00e3o pode apagar o arquivo {0}
90026=Serializa\u00e7\u00e3o falhada, causa\: {0}
90027=Deserializa\u00e7\u00e3o falhada, causa\: {0}
90028=Exce\u00e7\u00e3o de IO\: {0}
90029=No momento n\u00e3o \u00e9 poss\u00edvel fazer altera\u00e7\u00f5es nas linhas
90030=Arquivo corrompido durante a leitura\: {0}. Poss\u00edvel solu\u00e7\u00e3o\: use o recovery tool
90031=Exce\u00e7\u00e3o de IO\: {0}; {1}
90032=Usu\u00e1rio {0} n\u00e3o foi encontrado
90033=Usu\u00e1rio {0} j\u00e1 existe
90025=N\u00E3o pode apagar o arquivo {0}
90026=Serializa\u00E7\u00E3o falhada, causa\: {0}
90027=Deserializa\u00E7\u00E3o falhada, causa\: {0}
90028=Exce\u00E7\u00E3o de IO\: {0}
90029=No momento n\u00E3o \u00E9 poss\u00EDvel fazer altera\u00E7\u00F5es nas linhas
90030=Arquivo corrompido durante a leitura\: {0}. Poss\u00EDvel solu\u00E7\u00E3o\: use o recovery tool
90031=Exce\u00E7\u00E3o de IO\: {0}; {1}
90032=Usu\u00E1rio {0} n\u00E3o foi encontrado
90033=Usu\u00E1rio {0} j\u00E1 existe
90034=Erro no arquivo de Log\: {0}, causa\: {1}
90035=Sequ\u00eancia {0} j\u00e1 existe
90036=Sequ\u00eancia {0} n\u00e3o foi encontrada
90037=Vista {0} n\u00e3o foi encontrada
90038=Vista {0} j\u00e1 existe
90039=O valor \u00e9 muito alto para a precis\u00e3o {0}
90040=Direitos de permis\u00f5es do Admin s\u00e3o necess\u00e1rios para est\u00e1 opera\u00e7\u00e3o
90041=Trigger {0} j\u00e1 existe
90042=Trigger {0} n\u00e3o foi encontrada
90043=Erro na cria\u00e7\u00e3o ou inicializa\u00e7\u00e3o da trigger no objeto {0}, classe {1}, causa\: {2}; para maior detalhe veja a raiz da causa
90035=Sequ\u00EAncia {0} j\u00E1 existe
90036=Sequ\u00EAncia {0} n\u00E3o foi encontrada
90037=Vista {0} n\u00E3o foi encontrada
90038=Vista {0} j\u00E1 existe
90039=O valor \u00E9 muito alto para a precis\u00E3o {0}
90040=Direitos de permis\u00F5es do Admin s\u00E3o necess\u00E1rios para est\u00E1 opera\u00E7\u00E3o
90041=Trigger {0} j\u00E1 existe
90042=Trigger {0} n\u00E3o foi encontrada
90043=Erro na cria\u00E7\u00E3o ou inicializa\u00E7\u00E3o da trigger no objeto {0}, classe {1}, causa\: {2}; para maior detalhe veja a raiz da causa
90044=Erro executando trigger {0}, classe {1}, causa \: {2}; para maior detalhe veja a raiz da causa
90045=Restri\u00e7\u00e3o {0} j\u00e1 existe
90046=Erro no formato da URL; deve ser {0} mas est\u00e1 {1}
90047=Vers\u00f5es incompat\u00edveis, vers\u00e3o do driver \u00e9 {0} mas a vers\u00e3o do servidor \u00e9 {1}
90048=Vers\u00e3o do arquivo de base de dados n\u00e3o \u00e9 suportado, ou o cabe\u00e7alho do arquivo \u00e9 inv\u00e1lido, no arquivo {0}
90049=Erro de encripta\u00e7\u00e3o no arquivo {0}
90050=Erro no formato da senha, deveria ser\: arquivo de senha <espa\u00e7o> senha do usu\u00e1rio
90045=Restri\u00E7\u00E3o {0} j\u00E1 existe
90046=Erro no formato da URL; deve ser {0} mas est\u00E1 {1}
90047=Vers\u00F5es incompat\u00EDveis, vers\u00E3o do driver \u00E9 {0} mas a vers\u00E3o do servidor \u00E9 {1}
90048=Vers\u00E3o do arquivo de base de dados n\u00E3o \u00E9 suportado, ou o cabe\u00E7alho do arquivo \u00E9 inv\u00E1lido, no arquivo {0}
90049=Erro de encripta\u00E7\u00E3o no arquivo {0}
90050=Erro no formato da senha, deveria ser\: arquivo de senha <espa\u00E7o> senha do usu\u00E1rio
90051=O Statement foi cancelado
90052=A Subquery n\u00e3o \u00e9 de coluna \u00fanica
90053=A Subquery cont\u00e9m mais de uma linha
90054=Uso inv\u00e1lido da fun\u00e7\u00e3o {0} agregada
90055=Cipher {0} n\u00e3o \u00e9 suportado
90056=Nenhum valor pr\u00e9-definido foi especificado para a coluna {0}
90057=Restri\u00e7\u00e3o {0} n\u00e3o foi encontrada
90058=Tabela {0} duplicada ou o nome alternativo est\u00e1 duplicado
90059=Nome da coluna {0} \u00e9 amb\u00edguo.
90060=N\u00e3o suporta o m\u00e9todo do arquivo de bloqueio {0}
90061=Exce\u00e7\u00e3o ao abrir no porto {0} (provavelmente est\u00e1 em uso), causa\: {1}
90062=Erro na cria\u00e7\u00e3o do arquivo {0}
90063=Savepoint \u00e9 inv\u00e1lido\: {0}
90064=Savepoint n\u00e3o est\u00e1 nomeado
90065=Savepoint est\u00e1 nomeado
90052=A Subquery n\u00E3o \u00E9 de coluna \u00FAnica
90053=A Subquery cont\u00E9m mais de uma linha
90054=Uso inv\u00E1lido da fun\u00E7\u00E3o {0} agregada
90055=Cipher {0} n\u00E3o \u00E9 suportado
90056=Nenhum valor pr\u00E9-definido foi especificado para a coluna {0}
90057=Restri\u00E7\u00E3o {0} n\u00E3o foi encontrada
90058=Tabela {0} duplicada ou o nome alternativo est\u00E1 duplicado
90059=Nome da coluna {0} \u00E9 amb\u00EDguo.
90060=N\u00E3o suporta o m\u00E9todo do arquivo de bloqueio {0}
90061=Exce\u00E7\u00E3o ao abrir no porto {0} (provavelmente est\u00E1 em uso), causa\: {1}
90062=Erro na cria\u00E7\u00E3o do arquivo {0}
90063=Savepoint \u00E9 inv\u00E1lido\: {0}
90064=Savepoint n\u00E3o est\u00E1 nomeado
90065=Savepoint est\u00E1 nomeado
90066=Propriedade {0} duplicada
90067=A conec\u00e7\u00e3o est\u00e1 quebrada
90068=Express\u00e3o order by {0} deve estar na lista neste caso
90069=Regra {0} j\u00e1 existe
90070=Regra {0} n\u00e3o foi encontrada
90071=Usu\u00e1rio ou regra {0} n\u00e3o foram encontrados
90072=Regras e permiss\u00f5es n\u00e3o podem ser combinados
90073=Permiss\u00e3o n\u00e3o encontrada
90074=Regra {0} j\u00e1 foi concedida
90075=A coluna faz parte do \u00edndice {0}
90076=Nome alternativo da fun\u00e7\u00e3o {0} j\u00e1 existe
90077=Nome alternativo da fun\u00e7\u00e3o {0} n\u00e3o foi encontrado
90078=Esquema {0} j\u00e1 existe
90079=Esquema {0} n\u00e3o foi encontrado
90080=Nome do esquema deve ser v\u00e1lido
90067=A conec\u00E7\u00E3o est\u00E1 quebrada
90068=Express\u00E3o order by {0} deve estar na lista neste caso
90069=Regra {0} j\u00E1 existe
90070=Regra {0} n\u00E3o foi encontrada
90071=Usu\u00E1rio ou regra {0} n\u00E3o foram encontrados
90072=Regras e permiss\u00F5es n\u00E3o podem ser combinados
90073=Permiss\u00E3o n\u00E3o encontrada
90074=Regra {0} j\u00E1 foi concedida
90075=A coluna faz parte do \u00EDndice {0}
90076=Nome alternativo da fun\u00E7\u00E3o {0} j\u00E1 existe
90077=Nome alternativo da fun\u00E7\u00E3o {0} n\u00E3o foi encontrado
90078=Esquema {0} j\u00E1 existe
90079=Esquema {0} n\u00E3o foi encontrado
90080=Nome do esquema deve ser v\u00E1lido
90081=Coluna {0} restringe valores nulos
90082=Sequ\u00eancia {0} pertence a uma tabela
90083=A coluna pode ser refer\u00eanciada por {0}
90084=N\u00e3o pode apagar a \u00faltima coluna {0}
90085=\u00edndice {0} pertence a uma restri\u00e7\u00e3o
90086=Classe {0} n\u00e3o foi encontrada
90087=M\u00e9todo {0} n\u00e3o foi encontrado
90082=Sequ\u00EAncia {0} pertence a uma tabela
90083=A coluna pode ser refer\u00EAnciada por {0}
90084=N\u00E3o pode apagar a \u00FAltima coluna {0}
90085=\u00EDndice {0} pertence a uma restri\u00E7\u00E3o
90086=Classe {0} n\u00E3o foi encontrada
90087=M\u00E9todo {0} n\u00E3o foi encontrado
90088=Modo {0} desconhecido
90089=A cole\u00e7\u00e3o n\u00e3o pode ser alterada, porque existe uma tabela de dados\: {0}
90090=Esquema {0} n\u00e3o pode ser apagado
90091=Regra {0} n\u00e3o pode ser apagada
90092=Esta vers\u00e3o do Java n\u00e3o \u00e9 suportada (Java 1.4 \u00e9 requerido no m\u00ednimo)
90093=Erro de clusteriza\u00e7\u00e3o - base de dados rodando no modo standalone no momento
90094=Erro de clusteriza\u00e7\u00e3o - base de dados rodando no modo cluster, lista do servidor\: {0}
90089=A cole\u00E7\u00E3o n\u00E3o pode ser alterada, porque existe uma tabela de dados\: {0}
90090=Esquema {0} n\u00E3o pode ser apagado
90091=Regra {0} n\u00E3o pode ser apagada
90092=Esta vers\u00E3o do Java n\u00E3o \u00E9 suportada (Java 1.4 \u00E9 requerido no m\u00EDnimo)
90093=Erro de clusteriza\u00E7\u00E3o - base de dados rodando no modo standalone no momento
90094=Erro de clusteriza\u00E7\u00E3o - base de dados rodando no modo cluster, lista do servidor\: {0}
90095=Erro no formato da string\: {0}
90096=Permiss\u00f5es insuficientes para o objeto {0}
90097=Base de dados \u00e9 somente leitura
90096=Permiss\u00F5es insuficientes para o objeto {0}
90097=Base de dados \u00E9 somente leitura
90098=Base de dados foi fechada
90099=Erro na defini\u00e7\u00e3o do evento listener {0} da base de dados, causa\: {1}
90100=N\u00e3o h\u00e1 espa\u00e7o em disco suficiente
90099=Erro na defini\u00E7\u00E3o do evento listener {0} da base de dados, causa\: {1}
90100=N\u00E3o h\u00E1 espa\u00E7o em disco suficiente
90101=Formato XID incorreto\: {0}
90102=N\u00e3o \u00e9 suportado as op\u00e7\u00f5es de compress\u00e3o\: {0}
90103=N\u00e3o \u00e9 suportado o algor\u00edtimo de compress\u00e3o\: {0}
90104=Erro na compress\u00e3o
90105=Exce\u00e7\u00e3o na chamada da fun\u00e7\u00e3o definida pelo usu\u00e1rio
90106=N\u00e3o pode fazer o truncate {0}
90107=N\u00e3o pode apagar {0} por que depende de {1}
90108=Stack overflow (consulta ou fun\u00e7\u00e3o recursiva?)
90109=Vista {0} \u00e9 inv\u00e1lida\: {1}
90102=N\u00E3o \u00E9 suportado as op\u00E7\u00F5es de compress\u00E3o\: {0}
90103=N\u00E3o \u00E9 suportado o algor\u00EDtimo de compress\u00E3o\: {0}
90104=Erro na compress\u00E3o
90105=Exce\u00E7\u00E3o na chamada da fun\u00E7\u00E3o definida pelo usu\u00E1rio
90106=N\u00E3o pode fazer o truncate {0}
90107=N\u00E3o pode apagar {0} por que depende de {1}
90108=Stack overflow (consulta ou fun\u00E7\u00E3o recursiva?)
90109=Vista {0} \u00E9 inv\u00E1lida\: {1}
90110={0} out of range
90111=Erro ao acessar a tabela lincada com a instru\u00e7\u00e3o SQL {0}, causa\: {1}
90112=A linha n\u00e3o foi encontrada ao tentar eliminar apartir do \u00edndice {0}
90113=N\u00e3o suporta a defini\u00e7\u00e3o de conec\u00e7\u00e3o {0}
90114=Constante {0} j\u00e1 existe
90115=Constante {0} n\u00e3o foi encontrada
90116=Literais deste tipo n\u00e3o s\u00e3o permitidas
90117=Conec\u00e7\u00f5es remotas para este servidor n\u00e3o est\u00e3o habilitadas, veja -tcpAllowOthers
90118=N\u00e3o pode apagar a tabela {0}
90119=Tipo de dados do usu\u00e1rio {0} j\u00e1 existe
90120=Tipo de dados do usu\u00e1rio {0} n\u00e3o foram encontrados
90121=Base de dados j\u00e1 est\u00e1 fechada (para desabilitar o fechamento autom\u00e1tico quando a VM terminar, addicione \";DB_CLOSE_ON_EXIT\=FALSE\" na url da base de dados)
90122=Opera\u00e7\u00e3o n\u00e3o suportada para a tabela {0} quando existe alguma vista sobre a tabela\: {1}
90123=N\u00e3o pode combinar par\u00e2metros de \u00edndices com n\u00e3o \u00edndices
90124=Arquivo n\u00e3o encontrado\: {0}
90125=Classe inv\u00e1lida, experada {0} mas est\u00e1 {1}
90126=Base de dados n\u00e3o \u00e9 persistente
90127=O resultado definido n\u00e3o \u00e9 atualiz\u00e1vel. A consulta deve selecionar todas as colunas de chave prim\u00e1ria. Somente uma tabela pode ser selecionada.
90128=O resultado n\u00e3o \u00e9 naveg\u00e1vel e n\u00e3o pode ser resetado. Voc\u00ea pode usar conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY).
90129=Transa\u00e7\u00e3o {0} n\u00e3o encontrada
90130=Este m\u00e9todo n\u00e3o \u00e9 permitido para um statement preparado; Utilize um statement instanciado.
90131=Atualiza\u00e7\u00e3o concorrente na tabela {0}\: outra transa\u00e7\u00e3o atualizou ou deletou a mesma linha
90132=Agrega\u00e7\u00e3o {0} n\u00e3o encontrada
90111=Erro ao acessar a tabela lincada com a instru\u00E7\u00E3o SQL {0}, causa\: {1}
90112=A linha n\u00E3o foi encontrada ao tentar eliminar apartir do \u00EDndice {0}
90113=N\u00E3o suporta a defini\u00E7\u00E3o de conec\u00E7\u00E3o {0}
90114=Constante {0} j\u00E1 existe
90115=Constante {0} n\u00E3o foi encontrada
90116=Literais deste tipo n\u00E3o s\u00E3o permitidas
90117=Conec\u00E7\u00F5es remotas para este servidor n\u00E3o est\u00E3o habilitadas, veja -tcpAllowOthers
90118=N\u00E3o pode apagar a tabela {0}
90119=Tipo de dados do usu\u00E1rio {0} j\u00E1 existe
90120=Tipo de dados do usu\u00E1rio {0} n\u00E3o foram encontrados
90121=Base de dados j\u00E1 est\u00E1 fechada (para desabilitar o fechamento autom\u00E1tico quando a VM terminar, addicione ";DB_CLOSE_ON_EXIT\=FALSE" na url da base de dados)
90122=Opera\u00E7\u00E3o n\u00E3o suportada para a tabela {0} quando existe alguma vista sobre a tabela\: {1}
90123=N\u00E3o pode combinar par\u00E2metros de \u00EDndices com n\u00E3o \u00EDndices
90124=Arquivo n\u00E3o encontrado\: {0}
90125=Classe inv\u00E1lida, experada {0} mas est\u00E1 {1}
90126=Base de dados n\u00E3o \u00E9 persistente
90127=O resultado definido n\u00E3o \u00E9 atualiz\u00E1vel. A consulta deve selecionar todas as colunas de chave prim\u00E1ria. Somente uma tabela pode ser selecionada.
90128=O resultado n\u00E3o \u00E9 naveg\u00E1vel e n\u00E3o pode ser resetado. Voc\u00EA pode usar conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY).
90129=Transa\u00E7\u00E3o {0} n\u00E3o encontrada
90130=Este m\u00E9todo n\u00E3o \u00E9 permitido para um statement preparado; Utilize um statement instanciado.
90131=Atualiza\u00E7\u00E3o concorrente na tabela {0}\: outra transa\u00E7\u00E3o atualizou ou deletou a mesma linha
90132=Agrega\u00E7\u00E3o {0} n\u00E3o encontrada
90133=\#Cannot change the setting {0} when the database is already open
HY000=Erro geral\: {0}
HY004=Tipo de dados desconhecido\: {0}
HYC00=Recurso n\u00e3o suportado
HYC00=Recurso n\u00E3o suportado
HYT00=Timeout ao tentar bloquear a tabela {0}
......@@ -24,11 +24,19 @@ import org.h2.util.IOUtils;
import org.h2.util.SortedProperties;
import org.h2.util.StringUtils;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
public class PrepareTranslation {
private static final String MAIN_LANGUAGE = "en";
private static final String DELETED_PREFIX = "~";
private static final boolean AUTO_TRANSLATE = false;
public static void main(String[] args) throws Exception {
new PrepareTranslation().run(args);
}
private void run(String[] args) throws Exception {
String baseDir = "src/docsrc/textbase";
prepare(baseDir, "src/main/org/h2/res");
prepare(baseDir, "src/main/org/h2/server/web/res");
......@@ -368,7 +376,7 @@ public class PrepareTranslation {
prop.setProperty(document, s);
}
private static void prepare(String baseDir, String path) throws IOException {
private void prepare(String baseDir, String path) throws IOException {
File dir = new File(path);
File[] list = dir.listFiles();
File main = null;
......@@ -389,13 +397,13 @@ public class PrepareTranslation {
for (int i = 0; i < translations.size(); i++) {
File trans = (File) translations.get(i);
String language = trans.getName();
// language = language.substring(language.lastIndexOf('_'), language.lastIndexOf('.'));
prepare(p, base, trans);
language = language.substring(language.lastIndexOf('_') + 1, language.lastIndexOf('.'));
prepare(p, base, trans, language);
}
PropertiesToUTF8.storeProperties(p, baseDir + "/" + main.getName());
}
private static void prepare(Properties main, Properties base, File trans) throws IOException {
private void prepare(Properties main, Properties base, File trans, String language) throws IOException {
Properties p = FileUtils.loadProperties(trans.getAbsolutePath());
Properties oldTranslations = new Properties();
for (Iterator it = base.keySet().iterator(); it.hasNext();) {
......@@ -437,7 +445,7 @@ public class PrepareTranslation {
System.out.println(trans.getName() + ": key " + key + " changed, please review; last=" + last
+ " now=" + now);
String old = p.getProperty(key);
t = "#" + now + " #" + old;
t = "#" + autoTranslate(now, language) + " #" + old;
}
p.put(key, t);
}
......@@ -463,4 +471,19 @@ public class PrepareTranslation {
}
PropertiesToUTF8.storeProperties(p, trans.getAbsolutePath());
}
private String autoTranslate(String original, String language) {
String translation = original;
if (!AUTO_TRANSLATE) {
return "#" + translation;
}
if ("de".equals(language)) {
try {
return "#" + Translate.translate(original, Language.ENGLISH, Language.GERMAN);
} catch (IOException e) {
e.printStackTrace();
}
}
return "#" + translation;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论