@advanced_1000_h1
Advanced

@advanced_1001_a
 Result Sets

@advanced_1002_a
 Large Objects

@advanced_1003_a
 Linked Tables

@advanced_1004_a
 Recursive Queries

@advanced_1005_a
 Transaction Isolation

@advanced_1006_a
 Multi-Version Concurrency Control (MVCC)

@advanced_1007_a
 Clustering / High Availability

@advanced_1008_a
 Two Phase Commit

@advanced_1009_a
 Compatibility

@advanced_1010_a
 Standards Compliance

@advanced_1011_a
 Run as Windows Service

@advanced_1012_a
 ODBC Driver

@advanced_1013_a
 Using H2 in Microsoft .NET

@advanced_1014_a
 ACID

@advanced_1015_a
 Durability Problems

@advanced_1016_a
 Using the Recover Tool

@advanced_1017_a
 File Locking Protocols

@advanced_1018_a
 File Locking Method 'Serialized'

@advanced_1019_a
 Using Passwords

@advanced_1020_a
 Password Hash

@advanced_1021_a
 Protection against SQL Injection

@advanced_1022_a
 Protection against Remote Access

@advanced_1023_a
 Restricting Class Loading and Usage

@advanced_1024_a
 Security Protocols

@advanced_1025_a
 SSL/TLS Connections

@advanced_1026_a
 Universally Unique Identifiers (UUID)

@advanced_1027_a
 Settings Read from System Properties

@advanced_1028_a
 Setting the Server Bind Address

@advanced_1029_a
 Pluggable File System

@advanced_1030_a
 Database Upgrade

@advanced_1031_a
 Limits and Limitations

@advanced_1032_a
 Glossary and Links

@advanced_1033_h2
Result Sets

@advanced_1034_h3
Statements that Return a Result Set

@advanced_1035_p
 The following statements return a result set: <code>SELECT, EXPLAIN, CALL, SCRIPT, SHOW, HELP</code>. All other statements return an update count. 

@advanced_1036_h3
Limiting the Number of Rows

@advanced_1037_p
 Before the result is returned to the application, all rows are read by the database. Server side cursors are not supported currently. If only the first few rows are interesting for the application, then the result set size should be limited to improve the performance. This can be done using <code>LIMIT</code> in a query (example: <code>SELECT * FROM TEST LIMIT 100</code>), or by using <code>Statement.setMaxRows(max)</code>. 

@advanced_1038_h3
Large Result Sets and External Sorting

@advanced_1039_p
 For large result set, the result is buffered to disk. The threshold can be defined using the statement <code>SET MAX_MEMORY_ROWS</code>. If <code>ORDER BY</code> is used, the sorting is done using an external sort algorithm. In this case, each block of rows is sorted using quick sort, then written to disk; when reading the data, the blocks are merged together. 

@advanced_1040_h2
Large Objects

@advanced_1041_h3
Storing and Reading Large Objects

@advanced_1042_p
 If it is possible that the objects don't fit into memory, then the data type CLOB (for textual data) or BLOB (for binary data) should be used. For these data types, the objects are not fully read into memory, by using streams. To store a BLOB, use <code>PreparedStatement.setBinaryStream</code>. To store a CLOB, use <code>PreparedStatement.setCharacterStream</code>. To read a BLOB, use <code>ResultSet.getBinaryStream</code>, and to read a CLOB, use <code>ResultSet.getCharacterStream</code>. When using the client/server mode, large BLOB and CLOB data is stored in a temporary file on the client side. 

@advanced_1043_h3
When to use CLOB/BLOB

@advanced_1044_p
 This database stores large LOB (CLOB and BLOB) objects as separate files. Small LOB objects are stored in-place, the threshold can be set using <a href="grammar.html#set_max_length_inplace_lob" class="notranslate" >MAX_LENGTH_INPLACE_LOB</a>, but there is still an overhead to use CLOB/BLOB. Because of this, BLOB and CLOB should never be used for columns with a maximum size below about 200 bytes. The best threshold depends on the use case; reading in-place objects is faster than reading from separate files, but slows down the performance of operations that don't involve this column. 

@advanced_1045_h3
Large Object Compression

@advanced_1046_p
 CLOB and BLOB values can be compressed by using <a href="grammar.html#set_compress_lob" class="notranslate" >SET COMPRESS_LOB</a>. The LZF algorithm is faster but needs more disk space. By default compression is disabled, which usually speeds up write operations. If you store many large compressible values such as XML, HTML, text, and uncompressed binary files, then compressing can save a lot of disk space (sometimes more than 50%), and read operations may even be faster. 

@advanced_1047_h2
Linked Tables

@advanced_1048_p
 This database supports linked tables, which means tables that don't exist in the current database but are just links to another database. To create such a link, use the <code>CREATE LINKED TABLE</code> statement: 

@advanced_1049_p
 You can then access the table in the usual way. Whenever the linked table is accessed, the database issues specific queries over JDBC. Using the example above, if you issue the query <code>SELECT * FROM LINK WHERE ID=1</code>, then the following query is run against the PostgreSQL database: <code>SELECT * FROM TEST WHERE ID=?</code>. The same happens for insert and update statements. Only simple statements are executed against the target database, that means no joins. Prepared statements are used where possible. 

@advanced_1050_p
 To view the statements that are executed against the target table, set the trace level to 3. 

@advanced_1051_p
 If multiple linked tables point to the same database (using the same database URL), the connection is shared. To disable this, set the system property <code>h2.shareLinkedConnections=false</code>. 

@advanced_1052_p
 The statement <a href="grammar.html#create_linked_table" class="notranslate" >CREATE LINKED TABLE</a> supports an optional schema name parameter. 

@advanced_1053_h2
Transaction Isolation

@advanced_1054_p
 Transaction isolation is provided for all data manipulation language (DML) statements. Most data definition language (DDL) statements commit the current transaction. See the <a href="grammar.html">Grammar</a> for details. 

@advanced_1055_p
 This database supports the following transaction isolation levels: 

@advanced_1056_b
Read Committed

@advanced_1057_li
 This is the default level. Read locks are released immediately after executing the statement, but write locks are kept until the transaction commits. Higher concurrency is possible when using this level.

@advanced_1058_li
 To enable, execute the SQL statement <code>SET LOCK_MODE 3</code>

@advanced_1059_li
 or append <code>;LOCK_MODE=3</code> to the database URL: <code>jdbc:h2:~/test;LOCK_MODE=3</code> 

@advanced_1060_b
Serializable

@advanced_1061_li
 Both read locks and write locks are kept until the transaction commits. To enable, execute the SQL statement <code>SET LOCK_MODE 1</code>

@advanced_1062_li
 or append <code>;LOCK_MODE=1</code> to the database URL: <code>jdbc:h2:~/test;LOCK_MODE=1</code> 

@advanced_1063_b
Read Uncommitted

@advanced_1064_li
 This level means that transaction isolation is disabled.

@advanced_1065_li
 To enable, execute the SQL statement <code>SET LOCK_MODE 0</code>

@advanced_1066_li
 or append <code>;LOCK_MODE=0</code> to the database URL: <code>jdbc:h2:~/test;LOCK_MODE=0</code> 

@advanced_1067_p
 When using the isolation level 'serializable', dirty reads, non-repeatable reads, and phantom reads are prohibited. 

@advanced_1068_b
Dirty Reads

@advanced_1069_li
 Means a connection can read uncommitted changes made by another connection.

@advanced_1070_li
 Possible with: read uncommitted 

@advanced_1071_b
Non-Repeatable Reads

@advanced_1072_li
 A connection reads a row, another connection changes a row and commits, and the first connection re-reads the same row and gets the new result.

@advanced_1073_li
 Possible with: read uncommitted, read committed 

@advanced_1074_b
Phantom Reads

@advanced_1075_li
 A connection reads a set of rows using a condition, another connection inserts a row that falls in this condition and commits, then the first connection re-reads using the same condition and gets the new row.

@advanced_1076_li
 Possible with: read uncommitted, read committed 

@advanced_1077_h3
Table Level Locking

@advanced_1078_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 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. When a lock is released, and multiple connections are waiting for it, one of them is picked at random. 

@advanced_1079_h3
Lock Timeout

@advanced_1080_p
 If a connection cannot get a lock on an object, the connection waits for some amount of time (the lock timeout). During this time, hopefully the connection holding the lock commits and it is then possible to get the lock. If this is not possible because the other connection does not release the lock for some time, the unsuccessful connection will get a lock timeout exception. The lock timeout can be set individually for each connection. 

@advanced_1081_h2
Multi-Version Concurrency Control (MVCC)

@advanced_1082_p
 The MVCC feature allows higher concurrency than using (table level or row level) locks. When using MVCC in this database, delete, insert and update operations will only issue a shared lock on the table. An exclusive lock is still used when adding or removing columns, when dropping the table, and when using <code>SELECT ... FOR UPDATE</code>. Connections only 'see' committed data, and own changes. That means, if connection A updates a row but doesn't commit this change yet, connection B will see the old value. Only when the change is committed, the new value is visible by other connections (read committed). If multiple connections concurrently try to update the same row, the database waits until it can apply the change, but at most until the lock timeout expires. 

@advanced_1083_p
 To use the MVCC feature, append <code>;MVCC=TRUE</code> to the database URL: 

@advanced_1084_p
 MVCC is disabled by default. The MVCC feature is not fully tested yet. The limitations of the MVCC mode are: it can not be used at the same time as <code>MULTI_THREADED=TRUE</code>; the complete undo log must fit in memory when using multi-version concurrency (the setting <code>MAX_MEMORY_UNDO</code> has no effect). It is not possible to enable or disable this setting while the database is already open. The setting must be specified in the first connection (the one that opens the database). 

@advanced_1085_h2
Clustering / High Availability

@advanced_1086_p
 This database supports a simple clustering / high availability mechanism. The architecture is: two database servers run on two different computers, and on both computers is a copy of the same database. If both servers run, each database operation is executed on both computers. If one server fails (power, hardware or network failure), the other server can still continue to work. From this point on, the operations will be executed only on one server until the other server is back up. 

@advanced_1087_p
 Clustering can only be used in the server mode (the embedded mode does not support clustering). The cluster can be re-created using the <code>CreateCluster</code> tool without stopping the remaining server. Applications that are still connected are automatically disconnected, however when appending <code>;AUTO_RECONNECT=TRUE</code>, they will recover from that. 

@advanced_1088_p
 To initialize the cluster, use the following steps: 

@advanced_1089_li
Create a database 

@advanced_1090_li
Use the <code>CreateCluster</code> tool to copy the database to another location and initialize the clustering. Afterwards, you have two databases containing the same data. 

@advanced_1091_li
Start two servers (one for each copy of the database) 

@advanced_1092_li
You are now ready to connect to the databases with the client application(s) 

@advanced_1093_h3
Using the CreateCluster Tool

@advanced_1094_p
 To understand how clustering works, please try out the following example. In this example, the two databases reside on the same computer, but usually, the databases will be on different servers. 

@advanced_1095_li
Create two directories: <code>server1, server2</code>. Each directory will simulate a directory on a computer. 

@advanced_1096_li
Start a TCP server pointing to the first directory. You can do this using the command line: 

@advanced_1097_li
Start a second TCP server pointing to the second directory. This will simulate a server running on a second (redundant) computer. You can do this using the command line: 

@advanced_1098_li
Use the <code>CreateCluster</code> tool to initialize clustering. This will automatically create a new, empty database if it does not exist. Run the tool on the command line: 

@advanced_1099_li
You can now connect to the databases using an application or the H2 Console using the JDBC URL <code>jdbc:h2:tcp://localhost:9101,localhost:9102/~/test</code> 

@advanced_1100_li
If you stop a server (by killing the process), you will notice that the other machine continues to work, and therefore the database is still accessible. 

@advanced_1101_li
To restore the cluster, you first need to delete the database that failed, then restart the server that was stopped, and re-run the <code>CreateCluster</code> tool. 

@advanced_1102_h3
Detect Which Cluster Instances are Running

@advanced_1103_p
 To find out which cluster nodes are currently running, execute the following SQL statement: 

@advanced_1104_p
 If the result is <code>''</code> (two single quotes), then the cluster mode is disabled. Otherwise, the list of servers is returned, enclosed in single quote. Example: <code>'server1:9191,server2:9191'</code>. 

@advanced_1105_h3
Clustering Algorithm and Limitations

@advanced_1106_p
 Read-only queries are only executed against the first cluster node, but all other statements are executed against all nodes. There is currently no load balancing made to avoid problems with transactions. The following functions may yield different results on different cluster nodes and must be executed with care: <code>RANDOM_UUID(), SECURE_RAND(), SESSION_ID(), MEMORY_FREE(), MEMORY_USED(), CSVREAD(), CSVWRITE(), RAND()</code> [when not using a seed]. Those functions should not be used directly in modifying statements (for example <code>INSERT, UPDATE, MERGE</code>). However, they can be used in read-only statements and the result can then be used for modifying statements. 

@advanced_1107_p
 When using the cluster modes, result sets are read fully in memory by the client, so that there is no problem if the server dies that executed the query. Result sets must fit in memory on the client side. 

@advanced_1108_p
 The SQL statement <code>SET AUTOCOMMIT FALSE</code> is not supported in the cluster mode. To disable autocommit, the method <code>Connection.setAutoCommit(false)</code> needs to be called. 

@advanced_1109_h2
Two Phase Commit

@advanced_1110_p
 The two phase commit protocol is supported. 2-phase-commit works as follows: 

@advanced_1111_li
Autocommit needs to be switched off 

@advanced_1112_li
A transaction is started, for example by inserting a row 

@advanced_1113_li
The transaction is marked 'prepared' by executing the SQL statement <code>PREPARE COMMIT transactionName</code> 

@advanced_1114_li
The transaction can now be committed or rolled back 

@advanced_1115_li
If a problem occurs before the transaction was successfully committed or rolled back (for example because a network problem occurred), the transaction is in the state 'in-doubt' 

@advanced_1116_li
When re-connecting to the database, the in-doubt transactions can be listed with <code>SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT</code> 

@advanced_1117_li
Each transaction in this list must now be committed or rolled back by executing <code>COMMIT TRANSACTION transactionName</code> or <code>ROLLBACK TRANSACTION transactionName</code> 

@advanced_1118_li
The database needs to be closed and re-opened to apply the changes 

@advanced_1119_h2
Compatibility

@advanced_1120_p
 This database is (up to a certain point) compatible to other databases such as HSQLDB, MySQL and PostgreSQL. There are certain areas where H2 is incompatible. 

@advanced_1121_h3
Transaction Commit when Autocommit is On

@advanced_1122_p
 At this time, this database engine commits a transaction (if autocommit is switched on) just before returning the result. For a query, this means the transaction is committed even before the application scans through the result set, and before the result set is closed. Other database engines may commit the transaction in this case when the result set is closed. 

@advanced_1123_h3
Keywords / Reserved Words

@advanced_1124_p
 There is a list of keywords that can't be used as identifiers (table names, column names and so on), unless they are quoted (surrounded with double quotes). The list is currently: 

@advanced_1125_code
 CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, DISTINCT, EXCEPT, EXISTS, FALSE, FOR, FROM, FULL, GROUP, HAVING, INNER, INTERSECT, IS, JOIN, LIKE, LIMIT, MINUS, NATURAL, NOT, NULL, ON, ORDER, PRIMARY, ROWNUM, SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP, TODAY, TRUE, UNION, UNIQUE, WHERE 

@advanced_1126_p
 Certain words of this list are keywords because they are functions that can be used without '()' for compatibility, for example <code>CURRENT_TIMESTAMP</code>. 

@advanced_1127_h2
Standards Compliance

@advanced_1128_p
 This database tries to be as much standard compliant as possible. For the SQL language, ANSI/ISO is the main standard. There are several versions that refer to the release date: SQL-92, SQL:1999, and SQL:2003. Unfortunately, the standard documentation is not freely available. Another problem is that important features are not standardized. Whenever this is the case, this database tries to be compatible to other databases. 

@advanced_1129_h2
Run as Windows Service

@advanced_1130_p
 Using a native wrapper / adapter, Java applications can be run as a Windows Service. There are various tools available to do that. The Java Service Wrapper from <a href="http://wrapper.tanukisoftware.org">Tanuki Software, Inc.</a> is included in the installation. Batch files are provided to install, start, stop and uninstall the H2 Database Engine Service. This service contains the TCP Server and the H2 Console web application. The batch files are located in the directory <code>h2/service</code>. 

@advanced_1131_h3
Install the Service

@advanced_1132_p
 The service needs to be registered as a Windows Service first. To do that, double click on <code>1_install_service.bat</code>. If successful, a command prompt window will pop up and disappear immediately. If not, a message will appear. 

@advanced_1133_h3
Start the Service

@advanced_1134_p
 You can start the H2 Database Engine Service using the service manager of Windows, or by double clicking on <code>2_start_service.bat</code>. Please note that the batch file does not print an error message if the service is not installed. 

@advanced_1135_h3
Connect to the H2 Console

@advanced_1136_p
 After installing and starting the service, you can connect to the H2 Console application using a browser. Double clicking on <code>3_start_browser.bat</code> to do that. The default port (8082) is hard coded in the batch file. 

@advanced_1137_h3
Stop the Service

@advanced_1138_p
 To stop the service, double click on <code>4_stop_service.bat</code>. Please note that the batch file does not print an error message if the service is not installed or started. 

@advanced_1139_h3
Uninstall the Service

@advanced_1140_p
 To uninstall the service, double click on <code>5_uninstall_service.bat</code>. If successful, a command prompt window will pop up and disappear immediately. If not, a message will appear. 

@advanced_1141_h3
Additional JDBC drivers

@advanced_1142_p
 To use other databases (for example MySQL), the location of the JDBC drivers of those databases need to be added to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code> before installing the service. Multiple drivers can be set; each entry needs to be separated with a <code>;</code> (Windows) or <code>:</code> (other operating systems). Spaces in the path names are supported. The settings must not be quoted. 

@advanced_1143_h2
ODBC Driver

@advanced_1144_p
 This database does not come with its own ODBC driver at this time, but it supports the PostgreSQL network protocol. Therefore, the PostgreSQL ODBC driver can be used. Support for the PostgreSQL network protocol is quite new and should be viewed as experimental. It should not be used for production applications. 

@advanced_1145_p
 To use the PostgreSQL ODBC driver on 64 bit versions of Windows, first run <code>c:/windows/syswow64/odbcad32.exe</code>. At this point you set up your DSN just like you would on any other system. See also: <a href="http://archives.postgresql.org/pgsql-odbc/2005-09/msg00125.php">Re: ODBC Driver on Windows 64 bit</a> 

@advanced_1146_h3
ODBC Installation

@advanced_1147_p
 First, the ODBC driver must be installed. Any recent PostgreSQL ODBC driver should work, however version 8.2 (<code>psqlodbc-08_02*</code>) or newer is recommended. The Windows version of the PostgreSQL ODBC driver is available at <a href="http://www.postgresql.org/ftp/odbc/versions/msi">http://www.postgresql.org/ftp/odbc/versions/msi</a>. 

@advanced_1148_h3
Starting the Server

@advanced_1149_p
 After installing the ODBC driver, start the H2 Server using the command line: 

@advanced_1150_p
 The PG Server (PG for PostgreSQL protocol) is started as well. By default, databases are stored in the current working directory where the server is started. Use <code>-baseDir</code> to save databases in another directory, for example the user home directory: 

@advanced_1151_p
 The PG server can be started and stopped from within a Java application as follows: 

@advanced_1152_p
 By default, only connections from localhost are allowed. To allow remote connections, use <code>-pgAllowOthers</code> when starting the server. 

@advanced_1153_h3
ODBC Configuration

@advanced_1154_p
 After installing the driver, a new Data Source must be added. In Windows, run <code>odbcad32.exe</code> to open the Data Source Administrator. Then click on 'Add...' and select the PostgreSQL Unicode driver. Then click 'Finish'. You will be able to change the connection properties. The property column represents the property key in the <code>odbc.ini</code> file (which may be different from the GUI). 

@advanced_1155_th
Property

@advanced_1156_th
Example

@advanced_1157_th
Remarks

@advanced_1158_td
Data Source

@advanced_1159_td
H2 Test

@advanced_1160_td
The name of the ODBC Data Source

@advanced_1161_td
Database

@advanced_1162_td
~/test;ifexists=true

@advanced_1163_td
 The database name. This can include connections settings.

@advanced_1164_td
 By default, the database is stored in the current working directory 

@advanced_1165_td
 where the Server is started except when the -baseDir setting is used. 

@advanced_1166_td
 The name must be at least 3 characters. 

@advanced_1167_td
Servername

@advanced_1168_td
localhost

@advanced_1169_td
The server name or IP address.

@advanced_1170_td
By default, only remote connections are allowed

@advanced_1171_td
Username

@advanced_1172_td
sa

@advanced_1173_td
The database user name.

@advanced_1174_td
SSL

@advanced_1175_td
false (disabled)

@advanced_1176_td
At this time, SSL is not supported.

@advanced_1177_td
Port

@advanced_1178_td
5435

@advanced_1179_td
The port where the PG Server is listening.

@advanced_1180_td
Password

@advanced_1181_td
sa

@advanced_1182_td
The database password.

@advanced_1183_p
 To improve performance, please enable 'server side prepare' under Options / Datasource / Page 2 / Server side prepare. 

@advanced_1184_p
 Afterwards, you may use this data source. 

@advanced_1185_h3
PG Protocol Support Limitations

@advanced_1186_p
 At this time, only a subset of the PostgreSQL network protocol is implemented. Also, there may be compatibility problems on the SQL level, with the catalog, or with text encoding. Problems are fixed as they are found. Currently, statements can not be canceled when using the PG protocol. Also, H2 does not provide index meta over ODBC. 

@advanced_1187_p
 PostgreSQL ODBC Driver Setup requires a database password; that means it is not possible to connect to H2 databases without password. This is a limitation of the ODBC driver. 

@advanced_1188_h3
Security Considerations

@advanced_1189_p
 Currently, the PG Server does not support challenge response or encrypt passwords. This may be a problem if an attacker can listen to the data transferred between the ODBC driver and the server, because the password is readable to the attacker. Also, it is currently not possible to use encrypted SSL connections. Therefore the ODBC driver should not be used where security is important. 

@advanced_1190_h3
Using Microsoft Access

@advanced_1191_p
 When using Microsoft Access to edit data in a linked H2 table, you may need to enable the following option: Tools - Options - Edit/Find - ODBC fields. 

@advanced_1192_h2
Using H2 in Microsoft .NET

@advanced_1193_p
 The database can be used from Microsoft .NET even without using Java, by using IKVM.NET. You can access a H2 database on .NET using the JDBC API, or using the ADO.NET interface. 

@advanced_1194_h3
Using the ADO.NET API on .NET

@advanced_1195_p
 An implementation of the ADO.NET interface is available in the open source project <a href="http://code.google.com/p/h2sharp">H2Sharp</a>. 

@advanced_1196_h3
Using the JDBC API on .NET

@advanced_1197_li
Install the .NET Framework from <a href="http://www.microsoft.com">Microsoft</a>. Mono has not yet been tested. 

@advanced_1198_li
Install <a href="http://www.ikvm.net">IKVM.NET</a>. 

@advanced_1199_li
Copy the <code>h2*.jar</code> file to <code>ikvm/bin</code> 

@advanced_1200_li
Run the H2 Console using: <code>ikvm -jar h2*.jar</code> 

@advanced_1201_li
Convert the H2 Console to an <code>.exe</code> file using: <code>ikvmc -target:winexe h2*.jar</code>. You may ignore the warnings. 

@advanced_1202_li
Create a <code>.dll</code> file using (change the version accordingly): <code>ikvmc.exe -target:library -version:1.0.69.0 h2*.jar</code> 

@advanced_1203_p
 If you want your C# application use H2, you need to add the <code>h2.dll</code> and the <code>IKVM.OpenJDK.ClassLibrary.dll</code> to your C# solution. Here some sample code: 

@advanced_1204_h2
ACID

@advanced_1205_p
 In the database world, ACID stands for: 

@advanced_1206_li
Atomicity: transactions must be atomic, meaning either all tasks are performed or none. 

@advanced_1207_li
Consistency: all operations must comply with the defined constraints. 

@advanced_1208_li
Isolation: transactions must be isolated from each other. 

@advanced_1209_li
Durability: committed transaction will not be lost. 

@advanced_1210_h3
Atomicity

@advanced_1211_p
 Transactions in this database are always atomic. 

@advanced_1212_h3
Consistency

@advanced_1213_p
 By default, this database is always in a consistent state. Referential integrity rules are enforced except when explicitly disabled. 

@advanced_1214_h3
Isolation

@advanced_1215_p
 For H2, as with most other database systems, the default isolation level is 'read committed'. This provides better performance, but also means that transactions are not completely isolated. H2 supports the transaction isolation levels 'serializable', 'read committed', and 'read uncommitted'. 

@advanced_1216_h3
Durability

@advanced_1217_p
 This database does not guarantee that all committed transactions survive a power failure. Tests show that all databases sometimes lose transactions on power failure (for details, see below). Where losing transactions is not acceptable, a laptop or UPS (uninterruptible power supply) should be used. If durability is required for all possible cases of hardware failure, clustering should be used, such as the H2 clustering mode. 

@advanced_1218_h2
Durability Problems

@advanced_1219_p
 Complete durability means all committed transaction survive a power failure. Some databases claim they can guarantee durability, but such claims are wrong. A durability test was run against H2, HSQLDB, PostgreSQL, and Derby. All of those databases sometimes lose committed transactions. The test is included in the H2 download, see <code>org.h2.test.poweroff.Test</code>. 

@advanced_1220_h3
Ways to (Not) Achieve Durability

@advanced_1221_p
 Making sure that committed transactions are not lost is more complicated than it seems first. To guarantee complete durability, a database must ensure that the log record is on the hard drive before the commit call returns. To do that, databases use different methods. One is to use the 'synchronous write' file access mode. In Java, <code>RandomAccessFile</code> supports the modes <code>rws</code> and <code>rwd</code>: 

@advanced_1222_code
rwd

@advanced_1223_li
: every update to the file's content is written synchronously to the underlying storage device. 

@advanced_1224_code
rws

@advanced_1225_li
: in addition to <code>rwd</code>, every update to the metadata is written synchronously.

@advanced_1226_p
 A test (<code>org.h2.test.poweroff.TestWrite</code>) with one of those modes achieves around 50 thousand write operations per second. Even when the operating system write buffer is disabled, the write rate is around 50 thousand operations per second. This feature does not force changes to disk because it does not flush all buffers. The test updates the same byte in the file again and again. If the hard drive was able to write at this rate, then the disk would need to make at least 50 thousand revolutions per second, or 3 million RPM (revolutions per minute). There are no such hard drives. The hard drive used for the test is about 7200 RPM, or about 120 revolutions per second. There is an overhead, so the maximum write rate must be lower than that. 

@advanced_1227_p
 Calling <code>fsync</code> flushes the buffers. There are two ways to do that in Java: 

@advanced_1228_code
FileDescriptor.sync()

@advanced_1229_li
. The documentation says that this forces all system buffers to synchronize with the underlying device. This method is supposed to return after all in-memory modified copies of buffers associated with this file descriptor have been written to the physical medium. 

@advanced_1230_code
FileChannel.force()

@advanced_1231_li
 (since JDK 1.4). This method is supposed to force any updates to this channel's file to be written to the storage device that contains it. 

@advanced_1232_p
 By default, MySQL calls <code>fsync</code> for each commit. When using one of those methods, only around 60 write operations per second can be achieved, which is consistent with the RPM rate of the hard drive used. Unfortunately, even when calling <code>FileDescriptor.sync()</code> or <code>FileChannel.force()</code>, data is not always persisted to the hard drive, because most hard drives do not obey <code>fsync()</code>: see <a href="http://hardware.slashdot.org/article.pl?sid=05/05/13/0529252">Your Hard Drive Lies to You</a>. In Mac OS X, <code>fsync</code> does not flush hard drive buffers. See <a href="http://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html">Bad fsync?</a>. So the situation is confusing, and tests prove there is a problem. 

@advanced_1233_p
 Trying to flush hard drive buffers is hard, and if you do the performance is very bad. First you need to make sure that the hard drive actually flushes all buffers. Tests show that this can not be done in a reliable way. Then the maximum number of transactions is around 60 per second. Because of those reasons, the default behavior of H2 is to delay writing committed transactions. 

@advanced_1234_p
 In H2, after a power failure, a bit more than one second of committed transactions may be lost. To change the behavior, use <code>SET WRITE_DELAY</code> and <code>CHECKPOINT SYNC</code>. Most other databases support commit delay as well. In the performance comparison, commit delay was used for all databases that support it. 

@advanced_1235_h3
Running the Durability Test

@advanced_1236_p
 To test the durability / non-durability of this and other databases, you can use the test application in the package <code>org.h2.test.poweroff</code>. Two computers with network connection are required to run this test. One computer just listens, while the test application is run (and power is cut) on the other computer. The computer with the listener application opens a TCP/IP port and listens for an incoming connection. The second computer first connects to the listener, and then created the databases and starts inserting records. The connection is set to 'autocommit', which means after each inserted record a commit is performed automatically. Afterwards, the test computer notifies the listener that this record was inserted successfully. The listener computer displays the last inserted record number every 10 seconds. Now, switch off the power manually, then restart the computer, and run the application again. You will find out that in most cases, none of the databases contains all the records that the listener computer knows about. For details, please consult the source code of the listener and test application. 

@advanced_1237_h2
Using the Recover Tool

@advanced_1238_p
 The <code>Recover</code> tool can be used to extract the contents of a database file, even if the database is corrupted. It also extracts the content of the transaction log and large objects (CLOB or BLOB). To run the tool, type on the command line: 

@advanced_1239_p
 For each database in the current directory, a text file will be created. This file contains raw insert statements (for the data) and data definition (DDL) statements to recreate the schema of the database. This file can be executed using the <code>RunScript</code> tool or a <code>RUNSCRIPT FROM</code> SQL statement. The script includes at least one <code>CREATE USER</code> statement. If you run the script against a database that was created with the same user, or if there are conflicting users, running the script will fail. Consider running the script against a database that was created with a user name that is not in the script. 

@advanced_1240_p
 The <code>Recover</code> tool creates a SQL script from database file. It also processes the transaction log. 

@advanced_1241_h2
File Locking Protocols

@advanced_1242_p
 Multiple concurrent connections to the same database are supported, however a database file can only be open for reading and writing (in embedded mode) by one process at the same time. Otherwise, the processes would overwrite each others data and corrupt the database file. To protect against this problem, whenever a database is opened, a lock file is created to signal other processes that the database is in use. If the database is closed, or if the process that opened the database stops normally, this lock file is deleted. 

@advanced_1243_p
 In special cases (if the process did not terminate normally, for example because there was a power failure), the lock file is not deleted by the process that created it. That means the existence of the lock file is not a safe protocol for file locking. However, this software uses a challenge-response protocol to protect the database files. There are two methods (algorithms) implemented to provide both security (that is, the same database files cannot be opened by two processes at the same time) and simplicity (that is, the lock file does not need to be deleted manually by the user). The two methods are 'file method' and 'socket methods'. 

@advanced_1244_p
 The file locking protocols (except the file locking method 'FS') have the following limitation: if a shared file system is used, and the machine with the lock owner is sent to sleep (standby or hibernate), another machine may take over. If the machine that originally held the lock wakes up, the database may become corrupt. If this situation can occur, the application must ensure the database is closed when the application is put to sleep. 

@advanced_1245_h3
File Locking Method 'File'

@advanced_1246_p
 The default method for database file locking is the 'File Method'. The algorithm is: 

@advanced_1247_li
If the lock file does not exist, it is created (using the atomic operation <code>File.createNewFile</code>). Then, the process waits a little bit (20 ms) and checks the file again. If the file was changed during this time, the operation is aborted. This protects against a race condition when one process deletes the lock file just after another one create it, and a third process creates the file again. It does not occur if there are only two writers. 

@advanced_1248_li
 If the file can be created, a random number is inserted together with the locking method ('file'). Afterwards, a watchdog thread is started that checks regularly (every second once by default) if the file was deleted or modified by another (challenger) thread / process. Whenever that occurs, the file is overwritten with the old data. The watchdog thread runs with high priority so that a change to the lock file does not get through undetected even if the system is very busy. However, the watchdog thread does use very little resources (CPU time), because it waits most of the time. Also, the watchdog only reads from the hard disk and does not write to it. 

@advanced_1249_li
 If the lock file exists and was recently modified, the process waits for some time (up to two seconds). If it was still changed, an exception is thrown (database is locked). This is done to eliminate race conditions with many concurrent writers. Afterwards, the file is overwritten with a new version (challenge). After that, the thread waits for 2 seconds. If there is a watchdog thread protecting the file, he will overwrite the change and this process will fail to lock the database. However, if there is no watchdog thread, the lock file will still be as written by this thread. In this case, the file is deleted and atomically created again. The watchdog thread is started in this case and the file is locked. 

@advanced_1250_p
 This algorithm is tested with over 100 concurrent threads. In some cases, when there are many concurrent threads trying to lock the database, they block each other (meaning the file cannot be locked by any of them) for some time. However, the file never gets locked by two threads at the same time. However using that many concurrent threads / processes is not the common use case. Generally, an application should throw an error to the user if it cannot open a database, and not try again in a (fast) loop. 

@advanced_1251_h3
File Locking Method 'Socket'

@advanced_1252_p
 There is a second locking mechanism implemented, but disabled by default. To use it, append <code>;FILE_LOCK=SOCKET</code> to the database URL. The algorithm is: 

@advanced_1253_li
If the lock file does not exist, it is created. Then a server socket is opened on a defined port, and kept open. The port and IP address of the process that opened the database is written into the lock file. 

@advanced_1254_li
If the lock file exists, and the lock method is 'file', then the software switches to the 'file' method. 

@advanced_1255_li
If the lock file exists, and the lock method is 'socket', then the process checks if the port is in use. If the original process is still running, the port is in use and this process throws an exception (database is in use). If the original process died (for example due to a power failure, or abnormal termination of the virtual machine), then the port was released. The new process deletes the lock file and starts again. 

@advanced_1256_p
 This method does not require a watchdog thread actively polling (reading) the same file every second. The problem with this method is, if the file is stored on a network share, two processes (running on different computers) could still open the same database files, if they do not have a direct TCP/IP connection. 

@advanced_1257_h3
File Locking Method 'FS'

@advanced_1258_p
 This database file locking mechanism uses native file system lock on the database file. No *.lock.db file is created in this case, and no background thread is started. This mechanism may not work on all systems as expected. Some systems allow to lock the same file multiple times within the same virtual machine, and on some system native file locking is not supported or files are not unlocked after a power failure. 

@advanced_1259_p
 To enable this feature, append <code>;FILE_LOCK=FS</code> to the database URL. 

@advanced_1260_p
 This feature is relatively new. When using it for production, please ensure your system does in fact lock files as expected. 

@advanced_1261_h2
File Locking Method 'Serialized'

@advanced_1262_p
 This locking mode allows to open multiple connections to the same database. The connections may be opened from multiple processes and from different computers. When writing to the database, access is automatically synchronized internally. Write operations are slower than when using the server mode, and concurrency is relatively poor. The advantage of this mode is that there is no need to start a server. 

@advanced_1263_p
 To enable this feature, append <code>;FILE_LOCK=SERIALIZED</code> to the database URL. 

@advanced_1264_p
 This feature is relatively new. When using it for production, please ensure your use case is well tested (if possible with automated test cases). 

@advanced_1265_h2
Using Passwords

@advanced_1266_h3
Using Secure Passwords

@advanced_1267_p
 Remember that weak passwords can be broken regardless of the encryption and security protocols. Don't use passwords that can be found in a dictionary. Appending numbers does not make passwords 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 (but it's more important to use a long password than to use special characters). Example: 

@advanced_1268_code
i'sE2rtPiUKtT

@advanced_1269_p
 from the sentence <code>it's easy to remember this password if you know the trick</code>. 

@advanced_1270_h3
Passwords: Using Char Arrays instead of Strings

@advanced_1271_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 (if not enough main memory is available), which is a problem if the attacker has access to the swap file of the operating system. 

@advanced_1272_p
 It is a good idea to use char arrays instead of strings for passwords. Char arrays can be cleared (filled with zeros) after use, and therefore the password will not be stored in the swap file. 

@advanced_1273_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: 

@advanced_1274_p
 This example requires Java 1.6. When using Swing, use <code>javax.swing.JPasswordField</code>. 

@advanced_1275_h3
Passing the User Name and/or Password in the URL

@advanced_1276_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. 

@advanced_1277_h2
Password Hash

@advanced_1278_p
 Sometimes the database password needs to be stored in a configuration file (for example in the <code>web.xml</code> file). In addition to connecting with the plain text password, this database supports connecting with the password hash. This means that only the hash of the password (and not the plain text password) needs to be stored in the configuration file. This will only protect others from reading or re-constructing the plain text password (even if they have access to the configuration file); it does not protect others from accessing the database using the password hash. 

@advanced_1279_p
 To connect using the password hash instead of plain text password, append <code>;PASSWORD_HASH=TRUE</code> to the database URL, and replace the password with the password hash. To calculate the password hash from a plain text password, run the following command within the H2 Console tool: <code>@password_hash &lt;upperCaseUserName&gt; &lt;password&gt;</code>. As an example, if the user name is <code>sa</code> and the password is <code>test</code>, run the command <code>@password_hash SA test</code>. Then use the resulting password hash as you would use the plain text password. When using an encrypted database, then the user password and file password need to be hashed separately. To calculate the hash of the file password, run: <code>@password_hash file &lt;filePassword&gt;</code>. 

@advanced_1280_h2
Protection against SQL Injection

@advanced_1281_h3
What is SQL Injection

@advanced_1282_p
 This database engine provides a solution for the security vulnerability known as 'SQL Injection'. Here is a short description of what SQL injection means. Some applications build SQL statements with embedded user input such as: 

@advanced_1283_p
 If this mechanism is used anywhere in the application, and user input is not correctly filtered or encoded, it is possible for a user to inject SQL functionality or statements by using specially built input such as (in this example) this password: <code>' OR ''='</code>. In this case the statement becomes: 

@advanced_1284_p
 Which is always true no matter what the password stored in the database is. For more information about SQL Injection, see <a href="#glossary_links">Glossary and Links</a>. 

@advanced_1285_h3
Disabling Literals

@advanced_1286_p
 SQL Injection is not possible if user input is not directly embedded in SQL statements. A simple solution for the problem above is to use a prepared statement: 

@advanced_1287_p
 This database provides a way to enforce usage of parameters when passing user input to the database. This is done by disabling embedded literals in SQL statements. To do this, execute the statement: 

@advanced_1288_p
 Afterwards, SQL statements with text and number literals are not allowed any more. That means, SQL statement of the form <code>WHERE NAME='abc'</code> or <code>WHERE CustomerId=10</code> will fail. It is still possible to use prepared statements and parameters as described above. Also, it is still possible to generate SQL statements dynamically, and use the Statement API, as long as the SQL statements do not include literals. There is also a second mode where number literals are allowed: <code>SET ALLOW_LITERALS NUMBERS</code>. To allow all literals, execute <code>SET ALLOW_LITERALS ALL</code> (this is the default setting). Literals can only be enabled or disabled by an administrator. 

@advanced_1289_h3
Using Constants

@advanced_1290_p
 Disabling literals also means disabling hard-coded 'constant' literals. This database supports defining constants using the <code>CREATE CONSTANT</code> command. Constants can be defined only when literals are enabled, but used even when literals are disabled. To avoid name clashes with column names, constants can be defined in other schemas: 

@advanced_1291_p
 Even when literals are enabled, it is better to use constants instead of hard-coded number or text literals in queries or views. With constants, typos are found at compile time, the source code is easier to understand and change. 

@advanced_1292_h3
Using the ZERO() Function

@advanced_1293_p
 It is not required to create a constant for the number 0 as there is already a built-in function <code>ZERO()</code>: 

@advanced_1294_h2
Protection against Remote Access

@advanced_1295_p
 By default this database does not allow connections from other machines when starting the H2 Console, the TCP server, or the PG server. Remote access can be enabled using the command line options <code>-webAllowOthers, -tcpAllowOthers, -pgAllowOthers</code>. If you enable remote access, please also consider using the options <code>-baseDir, -ifExists</code>, so that remote users can not create new databases or access existing databases with weak passwords. When using the option <code>-baseDir</code>, only databases within that directory may be accessed. Ensure the existing accessible databases are protected using strong passwords. 

@advanced_1296_h2
Restricting Class Loading and Usage

@advanced_1297_p
 By default there is no restriction on loading classes and executing Java code for admins. That means an admin may call system functions such as <code>System.setProperty</code> by executing: 

@advanced_1298_p
 To restrict users (including admins) from loading classes and executing code, the list of allowed classes can be set in the system property <code>h2.allowedClasses</code> in the form of a comma separated list of classes or patterns (items ending with <code>*</code>). By default all classes are allowed. Example: 

@advanced_1299_p
 This mechanism is used for all user classes, including database event listeners, trigger classes, user-defined functions, user-defined aggregate functions, and JDBC driver classes (with the exception of the H2 driver) when using the H2 Console. 

@advanced_1300_h2
Security Protocols

@advanced_1301_p
 The following paragraphs document the security protocols used in this database. These descriptions are very technical and only intended for security experts that already know the underlying security primitives. 

@advanced_1302_h3
User Password Encryption

@advanced_1303_p
 When a user tries to connect to a database, the combination of user name, @, and password are hashed using SHA-256, and this hash value is transmitted to the database. This step does not protect against an attacker that re-uses the value if he is able to listen to the (unencrypted) transmission between the client and the server. But, the passwords are never transmitted as plain text, even when using an unencrypted connection between client and server. That means if a user reuses the same password for different things, this password is still protected up to some point. See also 'RFC 2617 - HTTP Authentication: Basic and Digest Access Authentication' for more information. 

@advanced_1304_p
 When a new database or user is created, a new random salt value is generated. The size of the salt is 64 bits. Using the random salt reduces the risk of an attacker pre-calculating hash values for many different (commonly used) passwords. 

@advanced_1305_p
 The combination of user-password hash value (see above) and salt is hashed using SHA-256. The resulting value is stored in the database. When a user tries to connect to the database, the database combines user-password hash value with the stored salt value and calculates the hash value. Other products use multiple iterations (hash the hash value again and again), but this is not done in this product to reduce the risk of denial of service attacks (where the attacker tries to connect with bogus passwords, and the server spends a lot of time calculating the hash value for each password). The reasoning is: if the attacker has access to the hashed passwords, he also has access to the data in plain text, and therefore does not need the password any more. If the data is protected by storing it on another computer and only accessible remotely, then the iteration count is not required at all. 

@advanced_1306_h3
File Encryption

@advanced_1307_p
 The database files can be encrypted using two different algorithms: AES-128 and XTEA (using 32 rounds). The reasons for supporting XTEA is performance (XTEA is a bit faster as AES in some environments) and to have an alternative algorithm if AES is suddenly broken. Please note that the XTEA implementation used in this database only uses 32 rounds and not 64 rounds as recommended by its inventor (as of 2010, the best known attack is on 27 rounds). 

@advanced_1308_p
 When a user tries to connect to an encrypted database, the combination of <code>file@</code> and the file password is hashed using SHA-256. This hash value is transmitted to the server. 

@advanced_1309_p
 When a new database file is created, a new cryptographically secure random salt value is generated. The size of the salt is 64 bits. The combination of the file password hash and the salt value is hashed 1024 times using SHA-256. The reason for the iteration is to make it harder for an attacker to calculate hash values for common passwords. 

@advanced_1310_p
 The resulting hash value is used as the key for the block cipher algorithm (AES-128 or XTEA with 32 rounds). Then, an initialization vector (IV) key is calculated by hashing the key again using SHA-256. This is to make sure the IV is unknown to the attacker. The reason for using a secret IV is to protect against watermark attacks. 

@advanced_1311_p
 Before saving a block of data (each block is 8 bytes long), the following operations are executed: first, the IV is calculated by encrypting the block number with the IV key (using the same block cipher algorithm). This IV is combined with the plain text using XOR. The resulting data is encrypted using the AES-128 or XTEA algorithm. 

@advanced_1312_p
 When decrypting, the operation is done in reverse. First, the block is decrypted using the key, and then the IV is calculated combined with the decrypted text using XOR. 

@advanced_1313_p
 Therefore, the block cipher mode of operation is CBC (cipher-block chaining), but each chain is only one block long. The advantage over the ECB (electronic codebook) mode is that patterns in the data are not revealed, and the advantage over multi block CBC is that flipped cipher text bits are not propagated to flipped plaintext bits in the next block. 

@advanced_1314_p
 Database encryption is meant for securing the database while it is not in use (stolen laptop and so on). It is not meant for cases where the attacker has access to files while the database is in use. When he has write access, he can for example replace pieces of files with pieces of older versions and manipulate data like this. 

@advanced_1315_p
 File encryption slows down the performance of the database engine. Compared to unencrypted mode, database operations take about 2.2 times longer when using XTEA, and 2.5 times longer using AES (embedded mode). 

@advanced_1316_h3
Wrong Password / User Name Delay

@advanced_1317_p
 To protect against remote brute force password attacks, the delay after each unsuccessful login gets double as long. Use the system properties <code>h2.delayWrongPasswordMin</code> and <code>h2.delayWrongPasswordMax</code> to change the minimum (the default is 250 milliseconds) or maximum delay (the default is 4000 milliseconds, or 4 seconds). The delay only applies for those using the wrong password. Normally there is no delay for a user that knows the correct password, with one exception: after using the wrong password, there is a delay of up to (randomly distributed) the same delay as for a wrong password. This is to protect against parallel brute force attacks, so that an attacker needs to wait for the whole delay. Delays are synchronized. This is also required to protect against parallel attacks. 

@advanced_1318_p
 There is only one exception message for both wrong user and for wrong password, to make it harder to get the list of user names. It is not possible from the stack trace to see if the user name was wrong or the password. 

@advanced_1319_h3
HTTPS Connections

@advanced_1320_p
 The web server supports HTTP and HTTPS connections using <code>SSLServerSocket</code>. There is a default self-certified certificate to support an easy starting point, but custom certificates are supported as well. 

@advanced_1321_h2
SSL/TLS Connections

@advanced_1322_p
 Remote SSL/TLS connections are supported using the Java Secure Socket Extension (<code>SSLServerSocket, SSLSocket</code>). By default, anonymous SSL is enabled. The default cipher suite is <code>SSL_DH_anon_WITH_RC4_128_MD5</code>. 

@advanced_1323_p
 To use your own keystore, set the system properties <code>javax.net.ssl.keyStore</code> and <code>javax.net.ssl.keyStorePassword</code> before starting the H2 server and client. See also <a href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CustomizingStores"> Customizing the Default Key and Trust Stores, Store Types, and Store Passwords</a> for more information. 

@advanced_1324_p
 To disable anonymous SSL, set the system property <code>h2.enableAnonymousSSL</code> to false. 

@advanced_1325_h2
Universally Unique Identifiers (UUID)

@advanced_1326_p
 This database supports UUIDs. Also supported is a function to create new UUIDs using a cryptographically strong pseudo random number generator. With random UUIDs, the chance of two having the same value can be calculated using the probability theory. See also 'Birthday Paradox'. Standardized randomly generated UUIDs have 122 random bits. 4 bits are used for the version (Randomly generated UUID), and 2 bits for the variant (Leach-Salz). This database supports generating such UUIDs using the built-in function <code>RANDOM_UUID()</code>. Here is a small program to estimate the probability of having two identical UUIDs after generating a number of values: 

@advanced_1327_p
 Some values are: 

@advanced_1328_th
Number of UUIs

@advanced_1329_th
Probability of Duplicates

@advanced_1330_td
2^36=68'719'476'736

@advanced_1331_td
0.000'000'000'000'000'4

@advanced_1332_td
2^41=2'199'023'255'552

@advanced_1333_td
0.000'000'000'000'4

@advanced_1334_td
2^46=70'368'744'177'664

@advanced_1335_td
0.000'000'000'4

@advanced_1336_p
 To help non-mathematicians understand what those numbers mean, here a comparison: one's annual risk of being hit by a meteorite is estimated to be one chance in 17 billion, that means the probability is about 0.000'000'000'06. 

@advanced_1337_h2
Recursive Queries

@advanced_1338_p
 H2 has experimental support for recursive queries using so called "common table expressions" (CTE). Examples: 

@advanced_1339_p
 Limitations: Recursive queries need to be of the type <code>UNION ALL</code>, and the recursion needs to be on the second part of the query. No tables or views with the name of the table expression may exist. Different table expression names need to be used when using multiple distinct table expressions within the same transaction and for the same session. All columns of the table expression are of type <code>VARCHAR</code>. Views with recursive queries are not supported. Subqueries and <code>INSERT INTO ... FROM</code> with recursive queries are not supported. Parameters are only supported within the last <code>SELECT</code> statement (a workaround is to use session variables like <code>@start</code> within the table expression). The syntax is: 

@advanced_1340_h2
Settings Read from System Properties

@advanced_1341_p
 Some settings of the database can be set on the command line using <code>-DpropertyName=value</code>. It is usually not required to change those settings manually. The settings are case sensitive. Example: 

@advanced_1342_p
 The current value of the settings can be read in the table <code>INFORMATION_SCHEMA.SETTINGS</code>. 

@advanced_1343_p
 For a complete list of settings, see <a href="../javadoc/org/h2/constant/SysProperties.html">SysProperties</a>. 

@advanced_1344_h2
Setting the Server Bind Address

@advanced_1345_p
 Usually server sockets accept connections on any/all local addresses. This may be a problem on multi-homed hosts. To bind only to one address, use the system property <code>h2.bindAddress</code>. This setting is used for both regular server sockets and for SSL server sockets. IPv4 and IPv6 address formats are supported. 

@advanced_1346_h2
Pluggable File System

@advanced_1347_p
 This database supports a pluggable file system API. The file system implementation is selected using a file name prefix. The following file systems are included: 

@advanced_1348_code
zip:

@advanced_1349_li
 read-only zip-file based file system. Format: <code>zip:/zipFileName!/fileName</code>. 

@advanced_1350_code
split:

@advanced_1351_li
 file system that splits files in 1 GB files (stackable with other file systems). 

@advanced_1352_code
nio:

@advanced_1353_li
 file system that uses <code>FileChannel</code> instead of <code>RandomAccessFile</code> (faster in some operating systems). 

@advanced_1354_code
nioMapped:

@advanced_1355_li
 file system that uses memory mapped files (faster in some operating systems). Please note that there currently is a file size limitation of 2 GB when using this file system when using a 32-bit JVM. To work around this limitation, combine it with the split file system: <code>split:nioMapped:test</code>. 

@advanced_1356_code
memFS:

@advanced_1357_li
 in-memory file system (slower than mem; experimental; mainly used for testing the database engine itself). 

@advanced_1358_code
memLZF:

@advanced_1359_li
 compressing in-memory file system (slower than memFS but uses less memory; experimental; mainly used for testing the database engine itself). 

@advanced_1360_p
 As an example, to use the the <code>nio</code> file system, use the following database URL: <code>jdbc:h2:nio:~/test</code>. 

@advanced_1361_p
 To register a new file system, extend the classes <code>org.h2.store.fs.FileSystem, FileObject</code>, and call the method <code>FileSystem.register</code> before using it. 

@advanced_1362_h2
Database Upgrade

@advanced_1363_p
 In version 1.2, H2 introduced a new file store implementation which is incompatible to the one used in versions &lt; 1.2. To automatically convert databases to the new file store, it is necessary to include an additional jar file. The file can be found at <a href="http://h2database.com/h2mig_pagestore_addon.jar">http://h2database.com/h2mig_pagestore_addon.jar</a> . If this file is in the classpath, every connect to an older database will result in a conversion process. 

@advanced_1364_p
 The conversion itself is done internally via <code>'script to'</code> and <code>'runscript from'</code>. After the conversion process, the files will be renamed from 

@advanced_1365_code
dbName.data.db

@advanced_1366_li
 to <code>dbName.data.db.backup</code> 

@advanced_1367_code
dbName.index.db

@advanced_1368_li
 to <code>dbName.index.db.backup</code> 

@advanced_1369_p
 by default. Also, the temporary script will be written to the database directory instead of a temporary directory. Both defaults can be customized via 

@advanced_1370_code
org.h2.upgrade.DbUpgrade.setDeleteOldDb(boolean)

@advanced_1371_code
org.h2.upgrade.DbUpgrade.setScriptInTmpDir(boolean)

@advanced_1372_p
 prior opening a database connection. 

@advanced_1373_p
 Since version 1.2.140 it is possible to let the old h2 classes (v 1.2.128) connect to the database. The automatic upgrade .jar file must be present, and the URL must start with <code>jdbc:h2v1_1:</code>. If the database should automatically connect using the old version if a database with the old format exists (without upgrade), and use the new version otherwise, then append <code>;NO_UPGRADE=TRUE</code> to the database URL. 

@advanced_1374_h2
Limits and Limitations

@advanced_1375_p
 This database has the following known limitations: 

@advanced_1376_li
Database file size limit: 4 TB (using the default page size of 2 KB) or higher (when using a larger page size). When using the feature "h2.lobInDatabase" then this limit is including CLOB and BLOB data, otherwise this limit is excluding CLOB and BLOB data, and every CLOB or BLOB can be up to 256 GB. 

@advanced_1377_li
The maximum file size for FAT or FAT32 file systems is 4 GB. That means when using FAT or FAT32, the limit is 4 GB for the data. This is the limitation of the file system. The database does provide a workaround for this problem, it is to use the file name prefix <code>split:</code>. In that case files are split into files of 1 GB by default. An example database URL is: <code>jdbc:h2:split:~/test</code>. 

@advanced_1378_li
The maximum number of rows per table is 2'147'483'648. 

@advanced_1379_li
Main memory requirements: The larger the database, the more main memory is required. With the version 1.1 storage mechanism, the minimum main memory required for a 12 GB database was around 240 MB. With the current page store, the minimum main memory required is much lower, around 1 MB for each 8 GB database file size. 

@advanced_1380_li
Limit on the complexity of SQL statements. Statements of the following form will result in a stack overflow exception: 

@advanced_1381_li
There is no limit for the following entities, except the memory and storage capacity: maximum identifier length (table name, column name, and so on); maximum number of tables, columns, indexes, triggers, and other database objects; maximum statement length, number of parameters per statement, tables per statement, expressions in order by, group by, having, and so on; maximum rows per query; maximum columns per table, columns per index, indexes per table, lob columns per table, and so on; maximum row length, index row length, select row length; maximum length of a varchar column, decimal column, literal in a statement. 

@advanced_1382_li
For limitations on data types, see the documentation of the respective Java data type or the data type documentation of this database. 

@advanced_1383_h2
Glossary and Links

@advanced_1384_th
Term

@advanced_1385_th
Description

@advanced_1386_td
AES-128

@advanced_1387_td
A block encryption algorithm. See also: <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Wikipedia: AES</a>

@advanced_1388_td
Birthday Paradox

@advanced_1389_td
Describes the higher than expected probability that two persons in a room have the same birthday. Also valid for randomly generated UUIDs. See also: <a href="http://en.wikipedia.org/wiki/Birthday_paradox">Wikipedia: Birthday Paradox</a>

@advanced_1390_td
Digest

@advanced_1391_td
Protocol to protect a password (but not to protect data). See also: <a href="http://www.faqs.org/rfcs/rfc2617.html">RFC 2617: HTTP Digest Access Authentication</a>

@advanced_1392_td
GCJ

@advanced_1393_td
Compiler for Java. <a href="http://gcc.gnu.org/java">GNU Compiler for the Java</a> and <a href="http://www.dobysoft.com/products/nativej">NativeJ (commercial)</a>

@advanced_1394_td
HTTPS

@advanced_1395_td
A protocol to provide security to HTTP connections. See also: <a href="http://www.ietf.org/rfc/rfc2818.txt">RFC 2818: HTTP Over TLS</a>

@advanced_1396_td
Modes of Operation

@advanced_1397_a
Wikipedia: Block cipher modes of operation

@advanced_1398_td
Salt

@advanced_1399_td
Random number to increase the security of passwords. See also: <a href="http://en.wikipedia.org/wiki/Key_derivation_function">Wikipedia: Key derivation function</a>

@advanced_1400_td
SHA-256

@advanced_1401_td
A cryptographic one-way hash function. See also: <a href="http://en.wikipedia.org/wiki/SHA_family">Wikipedia: SHA hash functions</a>

@advanced_1402_td
SQL Injection

@advanced_1403_td
A security vulnerability where an application embeds SQL statements or expressions in user input. See also: <a href="http://en.wikipedia.org/wiki/SQL_injection">Wikipedia: SQL Injection</a>

@advanced_1404_td
Watermark Attack

@advanced_1405_td
Security problem of certain encryption programs where the existence of certain data can be proven without decrypting. For more information, search in the internet for 'watermark attack cryptoloop'

@advanced_1406_td
SSL/TLS

@advanced_1407_td
Secure Sockets Layer / Transport Layer Security. See also: <a href="http://java.sun.com/products/jsse/">Java Secure Socket Extension (JSSE)</a>

@advanced_1408_td
XTEA

@advanced_1409_td
A block encryption algorithm. See also: <a href="http://en.wikipedia.org/wiki/XTEA">Wikipedia: XTEA</a>

@build_1000_h1
Build

@build_1001_a
 Portability

@build_1002_a
 Environment

@build_1003_a
 Building the Software

@build_1004_a
 Build Targets

@build_1005_a
 Using Maven 2

@build_1006_a
 Translating

@build_1007_a
 Providing Patches

@build_1008_a
 Reporting Problems or Requests

@build_1009_a
 Automated Build

@build_1010_a
 Generating Railroad Diagrams

@build_1011_h2
Portability

@build_1012_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_1013_h2
Environment

@build_1014_p
 To run this database, a Java Runtime Environment (JRE) version 1.5 or higher is required. 

@build_1015_p
 To create the database executables, the following software stack was used. To use this database, it is not required to install this software however. 

@build_1016_li
Mac OS X and Windows XP 

@build_1017_a
Sun JDK Version 1.5 and 1.6

@build_1018_a
Eclipse Version 3.4

@build_1019_li
Eclipse Plugins: <a href="http://subclipse.tigris.org">Subclipse</a>, <a href="http://eclipse-cs.sourceforge.net">Eclipse Checkstyle Plug-in</a>, <a href="http://www.eclemma.org">EclEmma Java Code Coverage 1.3.0</a> 

@build_1020_a
Emma Java Code Coverage

@build_1021_a
Mozilla Firefox

@build_1022_a
OpenOffice

@build_1023_a
NSIS 2.38

@build_1024_li
 (Nullsoft Scriptable Install System) 

@build_1025_a
Maven

@build_1026_h2
Building the Software

@build_1027_p
 You need to install a JDK, for example the Sun JDK version 1.5 or 1.6. Ensure that Java binary directory is included in the <code>PATH</code> environment variable, and that the environment variable <code>JAVA_HOME</code> points to your Java installation. On the command line, go to the directory <code>h2</code> and execute the following command: 

@build_1028_p
 For Linux and OS X, use <code>./build.sh</code> instead of <code>build</code>. 

@build_1029_p
 You will get a list of targets. If you want to build the <code>jar</code> file, execute (Windows): 

@build_1030_p
 To run the build tool in shell mode, use the command line option <code>-</code> as in <code>./build.sh -</code>. 

@build_1031_h3
Switching the Source Code

@build_1032_p
 By default the source code uses Java 1.6 features, however Java 1.5 is supported as well. To switch the source code to the installed version of Java, run: 

@build_1033_h2
Build Targets

@build_1034_p
 The build system can generate smaller jar files as well. The following targets are currently supported: 

@build_1035_code
jarClient

@build_1036_li
 creates the file <code>h2client.jar</code>. This only contains the JDBC client. 

@build_1037_code
jarSmall

@build_1038_li
 creates the file <code>h2small.jar</code>. This only contains the embedded database. Debug information is disabled. 

@build_1039_code
jarJaqu

@build_1040_li
 creates the file <code>h2jaqu.jar</code>. This only contains the JaQu (Java Query) implementation. All other jar files do not include JaQu. 

@build_1041_code
javadocImpl

@build_1042_li
 creates the Javadocs of the implementation. 

@build_1043_p
 To create the file <code>h2client.jar</code>, go to the directory <code>h2</code> and execute the following command: 

@build_1044_h3
Using Lucene 2 / 3

@build_1045_p
 Both Apache Lucene 2 and Lucene 3 are supported. Currently Apache Lucene version 2.x is used by default for H2 version 1.2.x, and Lucene version 3.x is used by default for H2 version 1.3.x. To use a different version of Lucene when compiling, it needs to be specified as follows: 

@build_1046_h2
Using Maven 2

@build_1047_h3
Using a Central Repository

@build_1048_p
 You can include the database in your Maven 2 project as a dependency. Example: 

@build_1049_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_1050_h3
Using Snapshot Version

@build_1051_p
 To build a <code>h2-*-SNAPSHOT.jar</code> file and upload it the to the local Maven 2 repository, execute the following command: 

@build_1052_p
 Afterwards, you can include the database in your Maven 2 project as a dependency: 

@build_1053_h2
Translating

@build_1054_p
 The translation of this software is split into the following parts: 

@build_1055_li
H2 Console: <code>src/main/org/h2/server/web/res/_text_*.prop</code> 

@build_1056_li
Error messages: <code>src/main/org/h2/res/_messages_*.prop</code> 

@build_1057_p
 To translate the H2 Console, start it and select Preferences / Translate. After you are done, send the translated <code>*.prop</code> file to the Google Group. The web site is currently translated using Google. 

@build_1058_h2
Providing Patches

@build_1059_p
 If you like to provide patches, please consider the following guidelines to simplify merging them: 

@build_1060_li
Only use Java 1.5 features (do not use Java 1.6) (see <a href="#environment">Environment</a>). 

@build_1061_li
Follow the coding style used in the project, and use Checkstyle (see above) to verify. For example, do not use tabs (use spaces instead). The checkstyle configuration is in <code>src/installer/checkstyle.xml</code>. 

@build_1062_li
A template of the Eclipse settings are in <code>src/installer/eclipse.settings/*</code>. If you want to use them, you need to copy them to the <code>.settings</code> directory. The formatting options (<code>eclipseCodeStyle</code>) are also included. 

@build_1063_li
Please provide test cases and integrate them into the test suite. For Java level tests, see <code>src/test/org/h2/test/TestAll.java</code>. For SQL level tests, see <code>src/test/org/h2/test/test.in.txt</code> or <code>testSimple.in.txt</code>. 

@build_1064_li
The test cases should cover at least 90% of the changed and new code; use a code coverage tool to verify that (see above). or use the build target <code>coverage</code>. 

@build_1065_li
Verify that you did not break other features: run the test cases by executing <code>build test</code>. 

@build_1066_li
Provide end user documentation if required (<code>src/docsrc/html/*</code>). 

@build_1067_li
Document grammar changes in <code>src/docsrc/help/help.csv</code> 

@build_1068_li
Provide a change log entry (<code>src/docsrc/html/changelog.html</code>). 

@build_1069_li
Verify the spelling using <code>build spellcheck</code>. If required add the new words to <code>src/tools/org/h2/build/doc/dictionary.txt</code>. 

@build_1070_li
Run <code>src/installer/buildRelease</code> to find and fix formatting errors. 

@build_1071_li
Verify the formatting using <code>build docs</code> and <code>build javadoc</code>. 

@build_1072_li
Submit patches as <code>.patch</code> files (compressed if big). To create a patch using Eclipse, use Team / Create Patch. 

@build_1073_p
 For legal reasons, patches need to be public in the form of an email to the <a href="http://groups.google.com/group/h2-database">group</a>, or in the form of an <a href="http://code.google.com/p/h2database/issues/list">issue report or attachment</a>. Significant contributions need to include the following statement: 

@build_1074_p
 "I wrote the code, it's mine, and I'm contributing it to H2 for distribution multiple-licensed under the H2 License, version 1.0, and under the Eclipse Public License, version 1.0 (http://h2database.com/html/license.html)." 

@build_1075_h2
Reporting Problems or Requests

@build_1076_p
 Please consider the following checklist if you have a question, want to report a problem, or if you have a feature request: 

@build_1077_li
Feature requests are always welcome, even if the feature is already on the <a href="roadmap.html">roadmap</a>. Your mail will help prioritize feature requests. If you urgently need a feature, consider <a href="#providing_patches">providing a patch</a>. 

@build_1078_li
Before posting problems, check the <a href="faq.html">FAQ</a> and do a <a href="http://google.com">Google search</a>. 

@build_1079_li
When got an unexpected exception, please try the <a href="sourceError.html">Error Analyzer tool</a>. If this doesn't help, please report the problem, including the complete error message and stack trace, and the root cause stack trace(s). 

@build_1080_li
When sending source code, please use a public web clipboard such as <a href="http://pastebin.com">Pastebin</a>, <a href="http://cl1p.net">Cl1p</a>, or <a href="http://www.mysticpaste.com/new">Mystic Paste</a> to avoid formatting problems. Please keep test cases as simple and short as possible, but so that the problem can still be reproduced. As a template, use: <a href="http://h2database.googlecode.com/svn/trunk/h2/src/test/org/h2/samples/HelloWorld.java">HelloWorld.java</a>. Method that simply call other methods should be avoided, as well as unnecessary exception handling. Please use the JDBC API and no external tools or libraries. The test should include all required initialization code, and should be started with the main method. 

@build_1081_li
For large attachments, use a public temporary storage such as <a href="http://rapidshare.com">Rapidshare</a>. 

@build_1082_li
Google Group versus issue tracking: Use the <a href="http://groups.google.com/group/h2-database">Google Group</a> for questions or if you are not sure it's a bug. If you are sure it's a bug, you can create an <a href="http://code.google.com/p/h2database/issues/list">issue</a>, but you don't need to (sending an email to the group is enough). Please note that only few people monitor the issue tracking system. 

@build_1083_li
For out-of-memory problems, please analyze the problem yourself first, for example using the command line option <code>-XX:+HeapDumpOnOutOfMemoryError</code> and a memory analysis tool such as the <a href="http://www.eclipse.org/mat">Eclipse Memory Analyzer (MAT)</a>. 

@build_1084_li
It may take a few days to get an answers. Please do not double post. 

@build_1085_h2
Automated Build

@build_1086_p
 This build process is automated and runs regularly. The build process includes running the tests and code coverage, using the command line <code>./build.sh clean jar coverage -Dh2.ftpPassword=... uploadBuild</code>. The last results are available here: 

@build_1087_a
Test Output

@build_1088_a
Code Coverage Summary

@build_1089_a
Code Coverage Details (download, 1.3 MB)

@build_1090_a
Build Newsfeed

@build_1091_a
Latest Jar File (download, 1 MB)

@build_1092_h2
Generating Railroad Diagrams

@build_1093_p
 The railroad diagrams are HTML, formatted as nested tables. The diagrams are generated as follows: 

@build_1094_li
The BNF parser (<code>org.h2.bnf.Bnf</code>) reads and parses the BNF from the file <code>help.csv</code>. 

@build_1095_li
The page parser (<code>org.h2.server.web.PageParser</code>) reads the template HTML file and fills in the diagrams. 

@build_1096_li
The rail images (one straight, four junctions, two turns) are generated using a simple Java application. 

@build_1097_p
 To generate railroad diagrams for other grammars, see the package <code>org.h2.jcr</code>. This package is used to generate the SQL-2 railroad diagrams for the JCR 2.0 specification. 

@changelog_1000_h1
Change Log

@changelog_1001_h2
Next Version (unreleased)

@changelog_1002_li
When the system property h2.lobInDatabase is set, reading a BLOB is a bit faster because the length is not read. 

@changelog_1003_li
The SimpleResultSet now has a feature to not close the result set after reading the last row. 

@changelog_1004_li
Native fulltext search: the ignore list doesn't need to be all uppercase now. 

@changelog_1005_li
Improved statistics output in the Recover tool. 

@changelog_1006_li
Issue 269: GROUP BY queries with a column or having clause that contains IN(SELECT ...) could return the wrong values. Example: SELECT X IN(SELECT Y) FROM Z GROUP BY X. 

@changelog_1007_li
After closing a database, the writer thread will stop almost immediately (instead of after at most 100 ms). This should avoid error messages in the Tomcat log file after a shutdown. 

@changelog_1008_li
Issue 271: ResultSet.getConcurrency() did not correctly detect that the result set is not updatable. 

@changelog_1009_li
The SLF4J 1.6 API is now used by default (this should not have any user visible effect). 

@changelog_1010_li
The org.h2.tools.Console no longer calls System.exit on shutdown (this should not have any user visible effect, but should allow to integrate the tool easier into other applications). 

@changelog_1011_li
Improved date / time arithmetics. Adding and subtracting a floating point value from a date or timestamp is now supported. 

@changelog_1012_li
When creating a BLOB with in InputStream or a CLOB with a Reader, and the InputStream or Reader threw an non-IOException, then the LOB storage was broken when storing LOBs in the database. 

@changelog_1013_li
EXPLAIN SELECT didn't include the sample size if one was set. 

@changelog_1014_li
Improved EXPLAIN plan formatting and documentation. 

@changelog_1015_li
Issue 266: Domains: a NOT NULL clause in a domain definition ignored. 

@changelog_1016_li
More accurate calculation of variance and standard deviation for large number of samples with low variance (now using Welford's method). 

@changelog_1017_li
Server: CLOB data with unicode characters between character code 0xd800 and 0xdfff were not transferred correctly. In many cases, the thread was stuck afterwards. 

@changelog_1018_li
Issue 264: the Hibernate dialect in src/tools was removed because it is outdated. 

@changelog_1019_li
Cache size limit could be exceeded for certain queries, leading to an OutOfMemoryError in some cases. Fixed. 

@changelog_1020_h2
Version 1.3.148 Beta (2010-12-12)

@changelog_1021_li
The built-in connection pool was simplified a bit. The dispose() method no longer throws an exception (it only logs it). 

@changelog_1022_li
The database upgrade (to upgrade from H2 version 1.1.x) has been simplified. 

@changelog_1023_li
The feature to log all errors (system properties h2.logAllErrors and h2.logAllErrorsFile) has been removed. 

@changelog_1024_li
When starting the H2 Console, the properties file can now be completely disabled. 

@changelog_1025_li
Server.openBrowser no longer writes to System.out directly if opening the URL failed. 

@changelog_1026_li
The INSERT optimizations (INSERT ... DIRECT SORTED SELECT) were not parsed correctly when using a column list. 

@changelog_1027_li
H2 Console: the tables and columns are now listed for SQLite as well. 

@changelog_1028_li
H2 Console: improved autocomplete feature (also simplified the source code for this feature). 

@changelog_1029_li
Issue 260: the DbStarter servlet context listener now starts the server before opening a connection, so that connecting using the server mode works. 

@changelog_1030_li
The Shell tool can now enable, disable, and display the current autocommit mode. 

@changelog_1031_li
Issue 259: there is a limitation in the cluster mode: The SQL statement SET AUTOCOMMIT FALSE doesn't work. To disable autocommit, the method Connection.setAutoCommit(false) needs to be called. This is now documented. 

@changelog_1032_li
Connection pool / DataSource: a NullPointerException was thrown when using a database URL that doesn't start with "jdbc:h2:". 

@changelog_1033_li
Using the java.sql.Blob or java.sql.Clob interfaces could throw the wrong exception after the object was closed. 

@changelog_1034_li
LOB: in server mode, if the feature "LOBs in database" is disabled, the temporary files are now created in the temp directory (the same as when "LOBs in database" is enabled). 

@changelog_1035_h2
Version 1.2.147 (2010-11-21)

@changelog_1036_li
H2 Console: the server properties directory can now be set on the command line using java ... -properties &lt;directory&gt;. Issue 159. 

@changelog_1037_li
New feature INSERT INTO ... DIRECT SELECT, mainly to speed up loading tables from a CSV file. When using DIRECT, then the results from the query are directly applied in the target table without any intermediate step (without temporary file). 

@changelog_1038_li
Converting binary data to UUID was incorrect when the converting more than 31 bytes. Now always the first 16 bytes are used. 

@changelog_1039_li
Improved date / time arithmetics. Now supported are multiplying and dividing a time with / by a number, adding and subtracting a time to / from a time or date, subtracting a time or timestamp from a timestamp. 

@changelog_1040_li
The Ant build script has been removed because it is no longer up to date. 

@changelog_1041_li
Nested outer joins without brackets were not working as expected. Example: select * from a inner join b inner join c on c.id = b.id on b.id = a.id; 

@changelog_1042_li
JMX (the Java management extension) is now supported. Issue 253. 

@changelog_1043_li
Creating a comment on a column didn't work if the schema name was equal the database name. 

@changelog_1044_li
When using multi-version concurrency, re-running a prepared statement with the same parameters would sometimes give the same result even if another connection committed a change (the previous result was sometimes re-used incorrectly). 

@changelog_1045_li
When using SELECT_FOR_UPDATE_MVCC (lock only the selected rows when using MVCC), the selected rows were sometimes not locked correctly. 

@changelog_1046_li
When using Lucene 3, the index files were not always closed when the database was closed. 

@changelog_1047_li
Concurrently preparing a statement and altering a table could throw a table not found exception. 

@changelog_1048_li
When concurrently preparing many statements with a subquery, in some cases the query didn't run (Column "..." must be in the GROUP BY list). 

@changelog_1049_li
CallableStatement: now the syntax "{? = CALL...}" is supported as well. 

@changelog_1050_li
Issue Lob in databases: two small BLOB or CLOB values were always considered equal. This also affected unique indexes. 

@changelog_1051_li
The shutdown hook is (re-) enabled by default even for H2 version 1.3.x. 

@changelog_1052_li
When creating a database from a recovery script, the same user can now be used (CREATE USER now always includes IF EXISTS). 

@changelog_1053_li
The H2 Console now prints a status message if started with parameters. 

@changelog_1054_h2
Version 1.3.146 Beta (2010-11-08)

@changelog_1055_li
This is a beta version. The next version will be 1.2.147. The differences between 1.2.x and 1.3.x are: 

@changelog_1056_li
In version 1.3.x, h2.lobInDatabase (store CLOB and BLOB in the database file) is enabled by default. 

@changelog_1057_li
In version 1.3.x, ANALYZE_AUTO is 2000 (automatic ANALYZE). 

@changelog_1058_li
In version 1.3.x, DB_CLOSE_ON_EXIT (the shutdown hook) is disabled by default. 

@changelog_1059_li
In version 1.3.x, DROP_RESTRICT (default action for DROP is RESTRICT) is enabled. 

@changelog_1060_li
In version 1.3.x, FUNCTIONS_IN_SCHEMA (allow to store functions in a schema) is enabled. 

@changelog_1061_li
In version 1.3.x, LARGE_TRANSACTIONS (support for very large transactions) is enabled. Changes to tables without a primary key can be buffered to disk. 

@changelog_1062_li
In version 1.3.x, MAX_MEMORY_ROWS_DISTINCT is set to a 10000. 

@changelog_1063_li
In version 1.3.x, NESTED_JOINS (nested joins and right outer joins) is enabled. 

@changelog_1064_li
In version 1.3.x, OPTIMIZE_INSERT_FROM_SELECT (speed up CREATE TABLE ... AS SELECT) is enabled. 

@changelog_1065_li
In version 1.3.x, OPTIMIZE_OR (convert OR conditions to IN(..) if possible) is enabled. 

@changelog_1066_li
In version 1.3.x, QUERY_CACHE_SIZE is enabled. 

@changelog_1067_li
In version 1.3.x, SELECT_FOR_UPDATE_MVCC (MVCC and SELECT FOR UPDATE) is enabled. 

@changelog_1068_li
In version 1.3.x, RUNSCRIPT and SCRIPT (commands and tools), use UTF-8 by default (ScriptCommand.charset). 

@changelog_1069_li
In version 1.3.x, Lucene 3 is used by default. Issue 147. 

@changelog_1070_li
When the system property h2.lobInDatabase is set, the lob tables were always created when closing the database, even if the tables were not needed. 

@changelog_1071_li
In the MySQL mode, SHOW TABLES didn't work, and meta data tables were not case insensitive. Updatable result sets didn't work as expected. Issue 249. 

@changelog_1072_li
Connection-created Clob and Blob objects can now be filled using Clob.setCharacterStream(1), Clob.setString(1, s), Blob.setBytes(1, x), Blob.setBinaryStream(1). Issue 235. 

@changelog_1073_li
Trying to convert a very small CLOB to a BLOB or a very small CLOB to a BLOB threw a NullPointerException. 

@changelog_1074_li
INFORMATION_SCHEMA.SETTINGS: now the current page count can be queried using select * from information_schema.settings where name = 'info.PAGE_COUNT'. 

@changelog_1075_li
For an invalid value exception, the parameter name and value was switched in some cases. 

@changelog_1076_li
When using trace level 3, opening a database no longer prints there is a EOFException (because that is the expected behavior). 

@changelog_1077_li
CALL calling a Java function with return type ResultSet and return value null threw a ClassCastException. 

@changelog_1078_li
SELECT ... FROM CSVREAD no longer creates a temporary file. Some large imports are now twice as fast. 

@changelog_1079_h2
Version 1.2.145 (2010-11-02)

@changelog_1080_li
A new String cache is now created at most once every 5 second, so that out of memory exceptions are not artificially delayed. 

@changelog_1081_li
After closing a database, the writer thread will stop after 100 ms at the latest (instead of 1 second). 

@changelog_1082_li
Opening a large database could fail in theory if the process was killed and then not fully compacted (because the unique transaction log key was re-used). 

@changelog_1083_li
Views now store the schema for Java functions if "functions in schemas" is enabled (system property h2.functionsInSchema). 

@changelog_1084_li
Improved error message if the LOB files are already deleted on the client side. 

@changelog_1085_li
Closing a Statement or PreparedStatement at the same time as executing a statement could throw a strange exception. Issue 241. 

@changelog_1086_li
The Recover tool did not work with compressed lob files (set compress_lob lzf). Also, sometimes the Recover tool was very slow, specially using a 64-bit JVM, because it tried to de-compress lob files even if they were not compressed (which could allocate a lot of memory). 

@changelog_1087_li
H2 Console: webAllowOthers and webSSL were swapped if they didn't exist in the properties file. Issue 244. 

@changelog_1088_li
When the system property h2.lobInDatabase is set, CREATE TABLE ... AS SELECT with a LOB column did not always work. 

@changelog_1089_li
Some system properties are not supported any longer, because they can already be set in the database URL. The constants are: CACHE_SIZE_DEFAULT, CACHE_TYPE_DEFAULT, DEFAULT_LOCK_MODE, LOCK_MODE_READ_COMMITTED, DEFAULT_MAX_LENGTH_INPLACE_LOB, DEFAULT_MAX_LENGTH_INPLACE_LOB2, DEFAULT_MAX_MEMORY_UNDO, DEFAULT_MAX_OPERATION_MEMORY, DEFAULT_PAGE_SIZE, DEFAULT_RESULT_SET_CONCURRENCY, MIN_WRITE_DELAY. 

@changelog_1090_li
Various system properties have been replaced with database level settings: ALIAS_COLUMN_NAME, ANALYZE_AUTO, ANALYZE_SAMPLE, DATABASE_TO_UPPER, DEFAULT_ESCAPE, DEFRAG_ALWAYS, DROP_RESTRICT, ESTIMATED_FUNCTION_TABLE_ROWS, FUNCTIONS_IN_SCHEMA, LARGE_RESULT_BUFFER_SIZE, LARGE_TRANSACTIONS, MAX_COMPACT_COUNT, MAX_COMPACT_TIME, MAX_MEMORY_ROWS_DISTINCT, MAX_QUERY_TIMEOUT, NESTED_JOINS, OPTIMIZE_DISTINCT, OPTIMIZE_EVALUATABLE_SUBQUERIES, OPTIMIZE_INSERT_FROM_SELECT, OPTIMIZE_IN_LIST, OPTIMIZE_IS_NULL, OPTIMIZE_OR, OPTIMIZE_SUBQUERY_CACHE, OPTIMIZE_TWO_EQUALS, OPTIMIZE_UPDATE, PAGE_STORE_INTERNAL_COUNT, PAGE_STORE_TRIM, QUERY_CACHE_SIZE, RECOMPILE_ALWAYS, RECONNECT_CHECK_DELAY, SELECT_FOR_UPDATE_MVCC, SHARE_LINKED_CONNECTIONS. See the Javadoc documentation of DbSettings for details. The system properties are still supported for backward compatibility. 

@changelog_1091_li
When the system property h2.nestedJoins was enabled, some outer joins returned the wrong result. 

@changelog_1092_li
Opening a database could throw a NullPointerException. 

@changelog_1093_li
After a crash, the database file did not always shrink because old transaction log pages were not removed from the file. 

@changelog_1094_li
Various CallableStatement methods could throw a NullPointerException. 

@changelog_1095_li
LOB files were not deleted when running DROP ALL OBJECTS. 

@changelog_1096_li
MS SQL Server compatibility: support "N" in front of string literals ("National Language" strings). Issue 240. 

@changelog_1097_li
CAST: when converting a string to binary, it is hex encoded (every byte two characters); a hex string can be converted to a number by first converting it to binary. Examples: CAST(CAST('FFFF' AS BINARY) AS INT) = 65535, CAST(65535 AS BINARY) = '0000FFFF'. 

@changelog_1098_li
When a domain (user defined data type) contained a user defined function, the database could not be opened. 

@changelog_1099_li
CAST('011' AS INT) will no longer use decode the value as an octal number (using Integer.decode) but now use Integer.parseInt. The same logic applied to byte, short, and long. This also means that trying to convert hex numbers (0x...) with CAST now fails. 

@changelog_1100_li
A table in the Recover tool script could not be imported if the script contained duplicate keys. 

@changelog_1101_h2
Version 1.2.144 (2010-10-15)

@changelog_1102_li
The Windows .bat files did not contain CR+LF. 

@changelog_1103_li
The LOB storage (when the system property h2.lobInDatabase is set) is now only initialized when needed. 

@changelog_1104_li
The index condition columnName IS NULL was not efficient when using a clustered index. 

@changelog_1105_li
The Recover tool did not work for databases larger than 2 GB. 

@changelog_1106_li
In memory database: outer joins with a condition "column is null" could return the wrong result. 

@changelog_1107_li
Temporary files were not created in the temporary directory of the system, but in the current working directory. This affected temporary undo log files for read-only databases, temporary files for large result sets when using read-only databases, and temporary LOB files when storing LOBs in the database (system property h2.lobInDatabase). When the setting h2.lobInDatabase is not set, temporary LOB files are still stored in a sub-directory (.lobs.db/) of the current working directory. 

@changelog_1108_li
New experimental feature to speed up CREATE TABLE ... AS SELECT. To enable the feature, set the system property h2.optimizeInsertFromSelect to true. For large queries, performance can be doubled. 

@changelog_1109_li
When LOB objects are stored in the database (using the experimental setting h2.lobInDatabase), and using the MVCC mode, opening a database with uncommitted transactions could throw a NullPointerException. 

@changelog_1110_li
Support of stored procedures with OUT parameters in CallableStatement is implemented. 

@changelog_1111_li
PreparedStatement.getMetaData() was not always consistent with resulting ResultSet.getMetaData(). 

@changelog_1112_li
The build tool now uses JAVA_HOME for javac as well. Issue 233. 

@changelog_1113_li
Opening and closing encrypted databases is now much faster. 

@changelog_1114_li
H2 Console: new experimental feature to support file download and upload, but only if there is a directory called "transfer" in the current working directory. For security reasons, only very simple file names are supported. Sub-directories are not supported. To upload, use transfer.jsp; to download, use transfer/fileName. 

@changelog_1115_li
A new sample application that shows how to manually create an encrypted and compressed script file. 

@changelog_1116_li
Performance has been improved a bit. 

@changelog_1117_li
DatabaseMetaData.getJDBCMajorVersion now returns 4 (instead of 3) when the driver is compiled with Java 6 (the default). 

@changelog_1118_li
Re-added the internal utility class BitField which improves performance of opening and closing a database (because it supports setByte / getByte, unlike java.util.BitSet). 

@changelog_1119_li
INFORMATION_SCHEMA.SESSIONS: the start time of a SQL statement is no longer set in each case. It is only set for long running statements. This change should improve performance a bit on some devices, specially when using Android. 

@changelog_1120_li
A old databases without user name and password (created with H2 version 1.2.142 or older) couldn't be opened with version 1.2.143. Fixed. 

@changelog_1121_li
The database upgrade classes have been renamed. 

@changelog_1122_li
The database did not automatically upgrade when using a connection pool or data source. 

@changelog_1123_li
JaQu: a database object can now also be created using a DataSource. Issue 227. 

@changelog_1124_li
The built-in profiler now better supports the Dalvik VM. 

@changelog_1125_li
The jarSmall build target no longer includes assertions (SysProperties.CHECK, CHECK2, system properties h2.check and h2.check2). 

@changelog_1126_li
The jarSmall build target excluded the DbUpgrade classes by mistake. 

@changelog_1127_h2
Version 1.2.143 (2010-09-18)

@changelog_1128_li
If the user name and password are not set or empty, then the password is not hashed. To disable this behavior, set the system property h2.emptyPassword to false. TCP server: the default user name for the management database is now an empty string. 

@changelog_1129_li
Cluster: auto-commit was disabled after opening a connection. 

@changelog_1130_li
Connection.getAutoCommit() is now much faster, specially when using the server mode. 

@changelog_1131_li
Statement.cancel() had no effect when using the server mode. 

@changelog_1132_li
SCRIPT: the SQL script no longer contains settings that match the default value. 

@changelog_1133_li
Statement.cancel() did not work when running RUNSCRIPT and SCRIPT. 

@changelog_1134_li
Statement.cancel() could cause a NullPointerException. 

@changelog_1135_li
In some cases (specially when using a small cache size or a large database over 1 GB) for some operations like ALTER TABLE the data was written before the transaction log entries, which could cause a corrupt database if the process was killed during the ALTER TABLE operation. Thanks a lot to Victor Pyankov for helping solve this problem! 

@changelog_1136_li
The Recover tool could throw a ArrayIndexOutOfBoundsException when trying to recover a corrupt database file. 

@changelog_1137_li
The SCRIPT command and tool now uses the default file encoding for the system now instead of UTF-8 (as before). In most cases, this will not affect existing applications, as the encoding only affects how SQL identifiers (table names and so on) that contain special characters are stored. Table data is escaped, and therefore is no problem. 

@changelog_1138_li
The SCRIPT command and tool now also support the CHARSET option (like RUNSCRIPT). 

@changelog_1139_li
When closing a database, sometimes empty space in the database was not freed up. 

@changelog_1140_li
Trying to create a view with parameters in the query will now throw an exception. So far, creating the view was allowed, but the parameter value was not used (null was used instead). 

@changelog_1141_li
New experimental feature SHUTDOWN DEFRAG. This option re-orders the pages while closing the database so that table scans are faster. 

@changelog_1142_li
When using the MULTI_THREADED option, concurrently reading from a database (specially from a larger database, or when using a small cache size) could throw an exception. 

@changelog_1143_li
When adding a comment to a column that has a check constraint, the database couldn't be re-opened. 

@changelog_1144_li
New system property h2.lobClientMaxSizeMemory to set the maximum size of a LOB object to keep in memory on the client side when using the server mode. 

@changelog_1145_h2
Version 1.2.142 (2010-08-31)

@changelog_1146_li
Documentation for using H2 on Android devices has been added under Tutorial - Android. 

@changelog_1147_li
An ArrayIndexOutOfBoundsException was thrown when querying the table information_schema.function_aliases while there are any user defined aggregate functions. 

@changelog_1148_li
The jar files are now about 50 KB smaller. In the last few versions they contained superfluous classes. 

@changelog_1149_li
The default time to compact a database when closing (system property h2.maxCompactTime) is now 0.2 seconds instead of 1 second. 

@changelog_1150_li
Opening an closing a database is now faster. 

@changelog_1151_li
In theory, when using indexes with large index rows (or when using a very small page size), removing rows could throw an internal exception in some cases. 

@changelog_1152_li
Inserting rows in reverse order could throw an ArrayIndexOutOfBoundsException in some cases (specially rows larger than the page size, which is 2 KB by default). Issue 226. 

@changelog_1153_li
H2 Console: with Chrome and Safari, resizing the table/query frame doesn't work. Issue 225. 

@changelog_1154_li
New experimental database file locking mechanism "FS" to use native file locking (no *.lock.db file is created in this case, and no background thread is started). This mechanism may not work on all systems (on some systems it's possible to lock the same file multiple times within the same virtual machine, and on some system native file locking is not working or unlocking is not working). 

@changelog_1155_h2
Version 1.2.141 (2010-08-22)

@changelog_1156_li
New experimental pseudo-encryption algorithm "FOG". It makes the data appear to be encrypted. This algorithm is cryptographically extremely weak, and should only be used to hide data from reading the plain text using a text editor. Please let us know if you think this is useful or not. 

@changelog_1157_li
Documentation: the grammar and function documentation can now be easier translated. 

@changelog_1158_li
Password hash: in addition to connecting with the plain text password, H2 now supports connecting with the password hash. Like this you don't have to store plain text passwords in config files. For details, see the documentation at Advanced / Password Hash. 

@changelog_1159_li
Lucene 3.x support was added in the source code, however it is not yet enabled by default and is not yet supported when using the default h2 jar file. To enable Lucene 3.x support, the source code of H2 needs to be switched using <code>./build.sh -Dlucene=3 switchSource</code>, and then re-compile. To switch the source code back use <code>./build.sh -Dlucene=2 switchSource</code> (replace ./build.sh with build.bat on Windows). The plan is to use Lucene 3 by default in H2 version 1.3.x. Issue 147. 

@changelog_1160_li
The native fulltext search could cause a Java level deadlock if searching from multiple connections concurrently. 

@changelog_1161_li
CREATE FORCE VIEW didn't work in most cases if a referenced table didn't exist. 

@changelog_1162_li
MVCC: when trying to insert two rows with the same key from two connections, the second connection immediately threw the exception "Unique index or primary key violation". Instead, the second connection now waits throwing the exception until the first connection committed the change (same as when trying to concurrently update the same row). 

@changelog_1163_li
Server mode: if the client ran with a different timezone setting than the server, date values got shifted by the difference between the timezones. This problem affected the data types DATE, TIME, and TIMESTAMP, when using PreparedStatement.setDate / setTime / setTimestamp and ResultSet.getDate / getTime / getTimestamp. To solve the problem, both the client and the server need to be updated (otherwise the old transfer protocol is used). 

@changelog_1164_li
The built-in connection pool (JdbcConnectionPool) did not always honor the login timeout (the timeout could occur much too early). Thanks a lot to Dario Fassi for the patch! 

@changelog_1165_li
Translation: the new messages have been translated to Spanish. Thanks a lot to Dario Fassi! 

@changelog_1166_li
The table INFORMATION_SCHEMA.SETTINGS now contains all H2-specific system properties (the ones that start with "h2.") and that are explicitly set. Previously, some H2-specific settings (for example h2.analyzeAuto) were missing in this list. 

@changelog_1167_li
EXPLAIN ANALYZE with an in-memory database threw an exception. Issue 216. 

@changelog_1168_li
Data modifications (inserts, updates, and deletes) are now up to 5 times faster because converting objects to byte arrays is avoided if possible. 

@changelog_1169_li
LOG=0 is now a bit faster (previously undo log entries were still written). 

@changelog_1170_li
The command line tools now say so if the source directory of an option doesn't exist. 

@changelog_1171_li
It is now allowed to truncate a table if referential integrity has been disabled for this table or database. 

@changelog_1172_li
For unencrypted databases, the automatic upgrade temporary script file is now unencrypted again. 

@changelog_1173_h2
Version 1.2.140 (2010-07-25)

@changelog_1174_li
The default MAX_LOG_SIZE is now 16 MB instead of 2 MB. Some uses cases are 3 times faster now. 

@changelog_1175_li
Improved cache memory usage calculation. 

@changelog_1176_li
Only resources that are actually used are loaded in memory. This can reduce the memory usage by about 400 KB. 

@changelog_1177_li
Profiling: the jar file can now be installed as an agent using java -javaagent:h2*.jar - this was be used to more accurately calculate the memory footprint of the cache. It has no effect when using H2 (using this feature in an application is not needed and not recommended). 

@changelog_1178_li
The cache was not used efficiently when reading (behaving like a FIFO cache instead of an LRU cache). 

@changelog_1179_li
Storing lobs in the database has been changed. It is now faster. Unfortunately, the change is not backward compatible; if you have used h2.lobInDatabase before you will need to re-build the database. 

@changelog_1180_li
SHUTDOWN COMPACT is now faster. 

@changelog_1181_li
H2 Console: requesting the status did not always show the window on top of others. 

@changelog_1182_li
H2 Console: on some system, the browser windows got opened when requesting a new one. 

@changelog_1183_li
The built-in profiling tool now uses a default stack depth of 32 elements and a default interval of 10 ms. 

@changelog_1184_li
Database files now grows in 1 MB blocks (and at least 20% at a time), instead of always 256 KB. This speeds up loading a new database. 

@changelog_1185_li
H2 Console: new built-in command @sleep to help profile another session. 

@changelog_1186_li
For improved performance, LOG=0 and LOG=1 are again supported. LOG=0 means the transaction log is disabled completely (fastest; for loading a database). LOG=1 means the transaction log is enabled, but FileDescriptor.sync is disabled (if no protection against power failure is required). LOG=2 is the default (transaction log is enabled, FileDescriptor.sync for each checkpoint). 

@changelog_1187_li
After deleting a lot of data (for example by dropping or altering tables, or indexes, or after a large transaction), opening a large database was very slow. Fixed. 

@changelog_1188_li
When killing the process after creating and dropping many tables (specially temporary tables), the database could not be opened sometimes. 

@changelog_1189_li
CAST(NULL AS ...) doesn't forget the data type, precision, and scale any longer. 

@changelog_1190_li
Experimental support for recursive queries (see 'Advanced' - 'Recursive Queries' for details). 

@changelog_1191_li
Problems with JDK 1.6.0_18 have been reports in the class StringUtils.quoteRemarkSQL. This method is now changed. 

@changelog_1192_li
The "small jar" distribution did not include the CompressTool, which was required for some operations. Fixed. 

@changelog_1193_li
The build tool now supports (minimalistic) shell mode, started using ./build.sh - 

@changelog_1194_li
IS NULL comparison with nested queries and linked tables did not work. Example: select * from (select x from test) where x is null. 

@changelog_1195_li
Support for null-safe equals. This includes the ANSI SQL standard syntax A IS [NOT] DISTINCT FROM B as well as the shorter A IS [NOT] B. 

@changelog_1196_li
Primary key violations threw a strange exception message when using a single column INT or BIGINT key. 

@changelog_1197_li
EXPLAIN ANALYZE now also lists the number of pages read from the file. 

@changelog_1198_li
Memory mapped files: There was a bug in version 1.2.139 so that memory mapped files could only be used together with split, for example: split:nioMapped: - the problem is now solved. It is still a good idea to use split:nioMapped: to work around the 2 GB limitation of memory mapped files. 

@changelog_1199_li
Memory mapped files: the system property h2.nioCleanerHack is now disabled by default because it was not always working as expected. Now System.gc() is used in a loop until the buffer is garbage collected. This of course is also not a nice solution, but the only one known to work. See also http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 

@changelog_1200_li
Bugfixes for the automatic 1.1 db migration. 

@changelog_1201_li
If an old 1.1 database file version is found on connect, it is now possible to let the old h2 classes (v 1.2.128) connect to the database. The automatic upgrade .jar file must be present, and the url must contain NO_UPGRADE=TRUE 

@changelog_1202_li
The automatic upgrade temporary script file is now encrypted. 

@changelog_1203_h2
Version 1.2.139 (2010-07-10)

@changelog_1204_li
There was a bug in the internal IntIntHashMap. There were no known side effects however. 

@changelog_1205_li
ANALYZE now uses less memory. 

@changelog_1206_li
Memory mapped file system: improved error messages if there is a problem. 

@changelog_1207_li
The Lucene fulltext search did not work well when using special file systems such as split or nioMapped. 

@changelog_1208_li
The memory mapped file system (nioMapped: file prefix) couldn't seek past the file length. 

@changelog_1209_li
Some file system operations did not work with stacked file systems (for example split and nioMapped). This also affected the DeleteDbFiles tool. 

@changelog_1210_li
New experimental query cache. The cache is only used if the SQL statement and all parameters match. Each session has it's own cache with the given size. Only the last returned result per query is cached. Only SELECT statements are cached (excluding UNION and FOR UPDATE statements). This works for both statements and prepared statement. To enable, set the system property h2.commandCacheSize to a value larger than 0. There is currently no plan to enable this option by default in future versions. 

@changelog_1211_li
Conditions with many OR operations could throw an UnsupportedOperationException if h2.optimizeOr was enabled. 

@changelog_1212_li
XA connection: after transaction commit or rollback, the physical connection is set into autocommit mode. 

@changelog_1213_li
MULTI_THREADED did not work correctly and could throw the exception "try to add a record twice" for larger databases because cache access was not correctly synchronized. 

@changelog_1214_li
Automatic database upgrade from non page store is now possible. If the classes from the h2mig_pagestore_addon.jar file are in the classpath, the database will be converted to the current page store format automatically. The file can be found here: <a href="http://h2database.com/h2mig_pagestore_addon.jar">http://h2database.com/h2mig_pagestore_addon.jar</a> 

@changelog_1215_li
The MultiDimension tools was extended with a few helper methods. The API was unified a bit. 

@changelog_1216_li
ODBC: MS Access could not link to a table with unique index or primary key. To solve this problem, index meta data is currently disabled for ODBC. When using the new H2 version to access a database over ODBC, the PostgreSQL catalog is automatically upgraded. Using a database with an upgraded PostgreSQL catalog with an older version of H2 is still possible, but not over ODBC. 

@changelog_1217_li
ODBC: MS Access could not link to a table with a name containing '_'. 

@changelog_1218_li
ODBC: additional connection settings can now be added to the database name. Example: ~/test;cipher=xtea. Therefore, encrypted databases are supported. 

@changelog_1219_li
Local temporary tables can now be created without having to commit a transaction using CREATE LOCAL TEMPORARY TABLE TEMP(ID INT PRIMARY KEY) TRANSACTIONAL. 

@changelog_1220_li
New system property h2.dropRestrict (default false) to change the default action for DROP TABLE and DROP VIEW (false for CASCADE, true for RESTRICT). The plan is to enable this property by default in version 1.3.x. 

@changelog_1221_li
DROP TABLE now also supports CASCADE (still the default) and RESTRICT. 

@changelog_1222_li
The wrong exception was thrown when trying to connect to a server if the server was not running. 

@changelog_1223_li
UNION queries where the first query contains a nested query were parsed incorrectly. Example: "select 1 from (select 2 from dual) union select 3 from dual" was parsed as "select 1 from ((select 2 from dual) union select 3 from dual)". Fixed. 

@changelog_1224_li
Support ALTER SCHEMA name RENAME TO newName (rename schema). (patch from Kerry Sainsbury) 

@changelog_1225_h2
Version 1.2.138 (2010-06-27)

@changelog_1226_li
Referential integrity: it was not allowed to delete a row with NULL in the parent table, if there was a row with NULL in the child table. 

@changelog_1227_li
Experimental feature to support case sensitive catalog names and database names using the DATABASE() method. To use this feature, set the system property h2.databaseToUpper to false. The plan is to set the property to false by default in version 1.3.x. Issue 204 - thanks to Sylvain Cuaz (ILM Informatique) for the patch. 

@changelog_1228_li
Experimental feature to support nested joins. To enable, set the system property h2.nestedJoins to true. If enabled, nested joins and right outer joins should work as expected (issues 145, 177, and 203). The plan is to enable this feature by default in version 1.3.x. 

@changelog_1229_li
New sample application: CachedPreparedStatements. 

@changelog_1230_li
When creating functions within a schema, those functions could not be used in views, nested queries, and constraints. Fixed. 

@changelog_1231_li
The benchmarks have been run using recent database versions. 

@changelog_1232_li
Version 1.2.137 could still not be converted to Java 1.4 (because the Retrotranslator doesn't support BigDecimal.precision). 

@changelog_1233_li
Cluster: non-admin users could not connect when one of the cluster node was stopped. Issue 206. 

@changelog_1234_li
DROP VIEW now supports the CASCADE and RESTRICT clauses (patch from Kerry Sainsbury) 

@changelog_1235_li
CREATE VIEW now supports the OR REPLACE clause (patch from Kerry Sainsbury) 

@changelog_1236_li
Build tool: ability to only run one test using the -Dtest=className setting. eg: build -Dtest=org.h2.test.db.TestViewDropView test (patch from Kerry Sainsbury). 

@changelog_1237_h2
Version 1.2.137 (2010-06-06)

@changelog_1238_li
Statements with a nested query and a condition that was always NULL threw an IndexOutOfBoundsException. Example: select * from (select null as x) where x=1 

@changelog_1239_li
The changes that were made to support large transactions also fixed a bug with large transactions (when the undo log file size is larger than 2 GB). 

@changelog_1240_li
Experimental feature to support very large transactions (except when using MVCC). To enable, set the system property h2.largeTransactions to true. If enabled, changes to tables without a primary key can be buffered to disk. The plan is to enable this feature by default in version 1.3.x. 

@changelog_1241_li
H2 Console: editing result sets is now also working for database other than H2, if they do support updatable result sets. Add "@edit" before the query. Only limited testing has been done on this feature, some data types may not work (please provide feedback if you find issues). 

@changelog_1242_li
Cluster: an open transaction was committed when a cluster node was stopped (because disabling the cluster executes SET CLUSTER '', which committed the transaction). Transaction are no longer committed when calling SET CLUSTER. Issue 199. 

@changelog_1243_li
Cluster: non-admin users couldn't connect to the cluster and couldn't disable the cluster. Issue 201. 

@changelog_1244_li
Cluster: NEXTVAL('sequence') was only called on one cluster node, therefore sequence values could get out of sync. 

@changelog_1245_li
Version 1.2.136 could not be converted to Java 1.4 (because the Retrotranslator doesn't support BigDecimal.precision). A workaround has been implemented. 

@changelog_1246_li
The error code of IO exceptions in CSV functions was incorrect. 

@changelog_1247_li
The TriggerPassData example now uses a prefix (the database name). 

@changelog_1248_li
The wrong exception was thrown when trying to reference a table that doesn't support references such as a table in the information schema. 

@changelog_1249_li
Server.shutdownTcpServer can now stop all TCP servers on this JVM. 

@changelog_1250_li
JdbcConnectionPool: the default connection timeout is now 30 seconds (it used to be 5 minutes). 

@changelog_1251_li
LOB storage: LOBs added with "h2.lobInDatabase" enabled couldn't be read later with this option disabled. 

@changelog_1252_h2
Version 1.2.136 (2010-05-24)

@changelog_1253_li
When using ORDER BY and there are both ascending and descending indexes, the database used the first index even when the second one could be used for sorting. 

@changelog_1254_li
Conditions of the form columnName IS NULL now use an index. To disable this feature, set the system property h2.optimizeIsNull to false. 

@changelog_1255_li
H2 Console: when the settings were not stored yet (for example when running for the first time), the last recently used settings were not stored. A workaround was to create the file ".h2.server.properties" manually in the current user home directory, with the contents: webAllowOthers=false, webPort=8082, webSSL=false, 0=Generic H2 (Embedded)|org.h2.Driver|jdbc\:h2\:~/test|sa (where a comma is a newline). 

@changelog_1256_li
The source code is now switched to Java 6 (JDK 1.6) by default. Java 5 (JDK 1.5) is still supported, and the jar file is still compiled for Java 5. 

@changelog_1257_li
The BOM (the byte-order-mark) character 0xfeff at the beginning of the file is ignored. This is for compatibility with Microsoft Excel. 

@changelog_1258_li
When opening an existing database, the cache size is set to at most half the amount of memory available for the virtual machine (Runtime.getRuntime().maxMemory()), even if the cache size setting stored in the database is larger. Setting the cache size in the database URL or explicitly using SET CACHE_SIZE overrides this value (even if larger than the physical memory). 

@changelog_1259_li
INFORMATION_SCHEMA.SETTINGS: the cache size is now returned in KB. 

@changelog_1260_li
New system property h2.selectForUpdateMvcc, the default is false (the feature is disabled). When enabled, SELECT ... FOR UPDATE only locks the selected rows in the MVCC mode. Aggregate or GROUP BY queries are not allowed in this case. 

@changelog_1261_li
Profiler: improved message if there was no stack trace. 

@changelog_1262_li
The H2 Console can now be used within another application, in a frame or iframe. Issue 197. 

@changelog_1263_li
Recover tool: the statistics section now includes page type counts again. 

@changelog_1264_li
Queries with multiple IN(...) conditions sometimes return the wrong results when there was a multi-column index for the column. 

@changelog_1265_li
Queries with IN(..., NULL) did sometimes return the wrong results when there was a index for the column. 

@changelog_1266_li
DECIMAL: faster precision and memory usage calculations. 

@changelog_1267_li
A new class org.h2.tools.TriggerAdapter allows to use the ResultSet interface within trigger implementations. 

@changelog_1268_li
A subselect which used an index could lead to wrong results. Fixed. 

@changelog_1269_li
Creating a cached temporary non persistent table with a primary key threw a NullPointerException. 

@changelog_1270_h2
Version 1.2.135 (2010-05-08)

@changelog_1271_li
Temporary files were not deleted when using large transactions, disabling autocommit, and closing the session without committing. 

@changelog_1272_li
Queries using multiple IN(..) conditions on the same table could cause repeated rows in the result set. 

@changelog_1273_li
Translation: Lubomir Grajciar translated the H2 Console as well as all error message to Slovensky. Thanks a lot! 

@changelog_1274_li
There was a possible Java level deadlock when opening an uninitialized database and using a file system that also opened a database. 

@changelog_1275_li
When killing the process while the database was writing a checkpoint, while it was closing, or while running recovery (while removing temporary tables from a previous run), the database could become corrupt. A new test case has been implemented to ensure such problems can not occur in the future. 

@changelog_1276_li
File system: new method FileSystem.setReadOnly. 

@changelog_1277_li
The page size for new databases can now be set in the database URL using ;PAGE_SIZE=512. Currently this feature is only used to simplify testing. 

@changelog_1278_li
New system property h2.functionsInSchema (default is false). If enabled, the SCRIPT statement always includes the schema name in the CREATE ALIAS statement (even if the schema is PUBLIC). This is not backward compatible with H2 versions 1.2.134 and older. 

@changelog_1279_li
Functions: it is no longer required to add a space after a comma in the parameter list. Example: CREATE ALIAS PARSE_INT FOR "java.lang.Integer.parseInt(java.lang.String,int)" 

@changelog_1280_li
Functions now reside within a schema, similar to sequences. If you do create such functions in schemas other than PUBLIC, then the database can not be opened with older versions of H2. 

@changelog_1281_li
Cluster: after a cluster node failed, the second cluster node can now be re-created and started without having to stop the first cluster node, and without having to stop running applications. To do that, append ;AUTO_RECONNECT=TRUE to the database URL. 

@changelog_1282_li
Auto-reconnect: if another connection uses the database in exclusive mode then this connection will try to re-connect until the exclusive mode ends. This is important when using the cluster mode. 

@changelog_1283_li
SET EXCLUSIVE now supports 0 (disable), 1 (enable), and 2 (enable and close all other connections). 

@changelog_1284_li
Installing the H2 as a service should now work on Windows 7. The batch files now explicitly set the directory using pushd "%~dp0". 

@changelog_1285_li
Temporary tables can now be 'cached', that means indexes of temporary tables can be persisted. This enables very large temporary tables (both local and global). 

@changelog_1286_li
The CreateCluster tool now sets the source database in exclusive mode before copying data to the new database. 

@changelog_1287_li
The H2 Console now stream results one statement / result set at a time (using chunked transfer encoding). To disable, set the system property h2.consoleStream to false. This feature is not supported when using a servlet container. 

@changelog_1288_li
The H2 Console did not call the CreateCluster tool with the correctly escaped parameters. 

@changelog_1289_li
Improved PostgreSQL compatibility for ALTER TABLE ALTER COLUMN. 

@changelog_1290_li
Commas at the end of INSERT ... VALUES (), (), are now supported. 

@changelog_1291_li
The H2 Console "Start Browser" button now works even when the IP address changes while the tool runs (for example, because a wireless connection breaks, or when enabling / disabling the network connection). 

@changelog_1292_li
When casting from float or double to BigDecimal, the result was sometimes unexpected, because "new BigDecimal(double val)" was used. Now "BigDecimal.valueOf(double val)" and "new BigDecimal(Float.toString(f))" are used. But it is still not recommended to use float or double for currency values (see data type documentation). 

@changelog_1293_li
Global temporary tables are now deleted when closing the database. Before, they were deleted when opening the database the next time. 

@changelog_1294_li
UNIQUE was not listed as a keyword. 

@changelog_1295_li
Improved error message when an non-SQL-exception occurred in a user defined function. The method name and parameters are included in the error message. 

@changelog_1296_li
For some queries, the exception did not include the SQL statement. Example: select x from system_range(1, 2) group by 'a'. 

@changelog_1297_li
The Shell tool will execute SQL statements passed as using the command line parameter -sql. 

@changelog_1298_li
If InetAddress.getLocalHost() fails, the database should now throw an exception. 

@changelog_1299_li
New columns INFORMATION_SCHEMA.INDEXES.INDEX_CLASS and INFORMATION_SCHEMA.TABLES.TABLE_CLASS. 

@changelog_1300_li
INFORMATION_SCHEMA.INDEXES.SQL now contains the CREATE INDEX statement instead of just the fully qualified index name. 

@changelog_1301_h2
Version 1.2.134 (2010-04-23)

@changelog_1302_li
New system property h2.analyzeAuto (default 0 meaning disabled) to automatically run ANALYZE after that many changes to a table. For details, see the Javadoc of this system property. The plan is to set this property to 2000 in version 1.3.x. 

@changelog_1303_li
JdbcXAConnection.start() does not support TMJOIN. Issue 189. 

@changelog_1304_li
MySQL compatibility: TIMESTAMPDIFF is now an alias for DATEDIFF. 

@changelog_1305_li
MERGE did not respect foreign key and check constraints. 

@changelog_1306_li
ALTER TABLE ALTER COLUMN: changing the data type of a column no longer makes it nullable. 

@changelog_1307_li
When using AUTO_SERVER=TRUE, the server is now started as a daemon thread. This was a problem when using Tomcat and a connection pool. 

@changelog_1308_li
Servers can now be started as a daemon thread using the command line options -tcpDaemon, -pgDaemon, and -webDaemon. 

@changelog_1309_li
H2 Console: the built-in commands are now documented. 

@changelog_1310_li
REPLACE: if any parameter is null, the result is null. 

@changelog_1311_li
Queries with DISTINCT and ORDER BY will now use the index on ORDER BY if possible. This is specially important for queries used inside IN(SELECT ...). 

@changelog_1312_li
The new statement EXPLAIN ANALYZE executes the statement, and displays the query plan with the actual row scan count for each table. 

@changelog_1313_li
H2 Console: the auto-complete feature didn't quote column names that need quoting. Issue 186. 

@changelog_1314_li
The experimental LOB storage mechanism now supports all features of the old one. To use it, set the system property "h2.lobInDatabase" to "true". If you have used this feature in version 1.2.133, you need to export and re-import the database using SCRIPT / RUNSCRIPT. 

@changelog_1315_li
The functions isBeforeFirst() and isAfterLast() were not compliant to the JDBC spec. If the ResultSet contains no rows, they must return false. Fixed. 

@changelog_1316_li
Filesystem parameters like "split:" didn't work in server mode with baseDir set. 

@changelog_1317_li
If baseDir is set, and a database name is given which points to a directory outside the baseDir (eg. "../dbname"), an exception is thrown. 

@changelog_1318_h2
Version 1.2.133 (2010-04-10)

@changelog_1319_li
A new experimental LOB storage mechanism is available. When enabled, CLOB and BLOB data is stored in hidden tables in the database. To use it, set the system property "h2.lobInDatabase" to "true". Compression is not yet implemented. Duplicate objects are only stored once. Usually writing is slower, but reading is faster (mainly because of caching). 

@changelog_1320_li
The Shell tool threw a NumberFormatException on a empty statement. 

@changelog_1321_li
The h2small-*.jar did not support "drop all objects delete files". Now it is supported (the DeleteDbFiles tool is now included). 

@changelog_1322_li
Operations that don't fit in memory are now faster. Temporary file handling was changed. 

@changelog_1323_li
The default maximum log stream size is now 2 MB. This is a good value according to some performance tests. 

@changelog_1324_li
New system property "h2.syncMethod" to configure what method to call when closing the database, on checkpoint, and on CHECKPOINT SYNC. The default is "sync" which calls RandomAccessFile.getFD().sync(). 

@changelog_1325_li
ROWNUM could not be used for pagination. The follow query returned no rows: select x from (select *, rownum as r from system_range(1, 3)) where r=2; 

@changelog_1326_li
Workaround for a java.sql.Date issue: years above 9999 are not formatted correctly. When calling ResultSet.getString() on a date value, an alternative formatting algorithm is used. 

@changelog_1327_li
Prepared statements with nested subqueries did not always return the correct result. Example: select ?, ?, (select count(*) from test t, (select id from test where 0=?) t2 where t2.id=t.id) from test 

@changelog_1328_li
When using MULTI_THREADED=TRUE, the exception following exception could be thrown: "object already exists: TABLES" 

@changelog_1329_li
Comparison of integer columns against float numbers was not always correct. Issue 182. 

@changelog_1330_li
H2 Console: Editing the result of a multi-line queries failed. Issue 183. 

@changelog_1331_li
H2 Console: if the settings file (.h2.properties) can't be accessed, the exception is now ignored. 

@changelog_1332_h2
Version 1.2.132 (2010-03-21)

@changelog_1333_li
The implementation of a Java to C (source code level) converter has been started. The plan is: it should be possible to convert H2 (or a part of it) to C so that the database can be run without a JVM. This will be a long term project (it may take a year or so). 

@changelog_1334_li
User defined table implementation can now be used using CREATE TABLE ... ENGINE. Thanks to Sergi Vladykin for implementing this feature! 

@changelog_1335_li
Improved MS SQL Server compatibility: support string concatenation using "+". Thanks to Stepan for the patch! 

@changelog_1336_li
When using the multi-threaded mode, running ANALYZE concurrently in multiple connections could throw an exception. 

@changelog_1337_li
The MERGE statement is now about 30% faster when using a PreparedStatement. 

@changelog_1338_li
Multi-column indexes where the second or later column was descending did not always produce correct results (rows were missing in the result set, or the result set was empty). 

@changelog_1339_li
When using large transactions or a small log size, the database could get very slow (profiling shows the hotspot is in FileObjectDisk.sync()). 

@changelog_1340_li
The Shell tool now prints the stack trace when the list mode is enabled. 

@changelog_1341_li
CREATE ALIAS ... AS: Compilation was incorrect if the source code contained characters that are not supported by the default file encoding. 

@changelog_1342_li
Issue 176: the JdbcDataSource now also supports a 'description' property. 

@changelog_1343_li
The Shell tool threw a ArrayIndexOutOfBoundsException after 20 statements. 

@changelog_1344_li
When using the small version of H2 ('jarClient'), the first call to Connection.createBlob (or similar) could throw a ClassNotFoundException because the file org.h2.store.fs.FileSystemZip is not included. This missing class is now ignored. 

@changelog_1345_li
Literals of type BIGINT now have the correct data type. 

@changelog_1346_h2
Version 1.2.131 (2010-03-05)

@changelog_1347_li
Older versions of H2 (version 1.2.127 and older) could not connect to a new version (version 1.2.129 and newer). The connection blocked when trying to connect. Now the connection no longer blocks, instead a SQL exception is thrown. 

@changelog_1348_li
In versions 1.2.129 and 1.2.130, a database could not be opened sometimes after dropping tables or indexes, and then creating new indexes for existing tables. The exception contained the text "parent not found" (version 1.2.129) or "Table not found" (version 1.2.130). 

@changelog_1349_li
After the database was closed, a null pointer exception could occur in Database.flush. 

@changelog_1350_li
An ArrayIndexOutOfBoundsException could occur in the page store (eg. on "delete from table"). Fixed. 

@changelog_1351_h2
Version 1.2.130 (2010-02-26)

@changelog_1352_li
EXPLAIN: The query plan now contains ".tableScan" if a table scan is used. 

@changelog_1353_li
IN(..): when combining and IN(..) condition with a condition that didn't use an index, the result could contain duplicate rows. 

@changelog_1354_li
IN(..): the index was not used if there were multiple IN(..) conditions. 

@changelog_1355_li
For foreign key constraints, the metadata column INFORMATION_SCHEMA.INDEXES.CONSTRAINT_NAME was not set for non-unique indexes. 

@changelog_1356_li
PostgreSQL compatibility: when using the following exception was thrown: Column "T.TYPTYPMOD" not found. Fixed. This is only when using psqlodbc_08_04*. 

@changelog_1357_li
A tool to migrate an old database from the non-page store format to the newest version has been added in src/tools/org/h2/dev/util/Migrate.java. This file is not included in the jar file currently. 

@changelog_1358_li
When using temporary tables, the database didn't shrink sometimes when closing. Also, sometimes a database could not recover normally. 

@changelog_1359_li
Large transactions could run out of heap space. The maximum size of a transaction is now much larger. 

@changelog_1360_li
The default setting for the system property h2.webMaxValueLength is now 100000 (it was 10000 before). 

@changelog_1361_li
Creating a database was delayed about 2 seconds if the directory didn't exist. 

@changelog_1362_li
Implemented INIT feature. If the database URL contains ";INIT=...;" then the DDL or DML commands following are executed on startup. Example URL: jdbc:h2:mem:test;INIT=RUNSCRIPT FROM '~/create.sql' (patch from Kerry Sainsbury). 

@changelog_1363_h2
Version 1.2.129 (2010-02-19)

@changelog_1364_li
The methods of the CloseListener are added to the Trigger interface. The interface CloseListener is removed. This is potentially a breaking change for existing triggers. 

@changelog_1365_li
CREATE ALIAS: error message when compiling Java code have been improved. 

@changelog_1366_li
MVCC: creating a table with an incorrect constraint could cause strange errors. 

@changelog_1367_li
Hash indexes now are only used for single column indexes. 

@changelog_1368_li
The cache types WEAK_* and TQ are no longer supported. A weak reference cache never frees up memory so it's the same as having a very large cache size. The TQ cache was not included in the jar file since a longer time, and was not tested. 

@changelog_1369_li
The file system abstraction no longer throws SQL exceptions. 

@changelog_1370_li
DatabaseEventListener.diskSpaceIsLow has changed. 

@changelog_1371_li
The CompressTool no longer throw as SQL exceptions. Instead, it throws runtime exceptions. 

@changelog_1372_li
SimpleResultSet.addColumn and addRow now can throw a IllegalStateException instead of a SQLException. 

@changelog_1373_li
When doing an index lookup, decimal values with the same value but different scale (for example 0.00 and 0.0) where not considered equal in version 1.2.128. Now they are (unlike BigDecimal.equals()). 

@changelog_1374_li
The BNF parser now uses the visitor pattern. 

@changelog_1375_li
Converting a UUID to bytes was incorrect. Because of that, updatable result sets on tables with UUID primary key did not work. 

@changelog_1376_li
The database URL property DATABASE_EVENT_LISTENER_OBJECT is no longer supported (there are problems passing objects when the PostgreSQL driver is installed as well). 

@changelog_1377_li
H2 Console: asynchronous login (using a DatabaseEventListener) is no longer supported. 

@changelog_1378_li
A workaround for a Windows socket problem has been implemented. Thanks a lot to Sergi Vladykin. 

@changelog_1379_li
The Recover tool did not convert correctly convert CLOB data with non-ASCII characters. 

@changelog_1380_li
Tools: the method run(String... args) has been renamed to runTool(String... args). 

@changelog_1381_li
Server.startWebServer(Connection) was not working as expected. 

@changelog_1382_li
The database URL option ACCESS_MODE_LOG is no longer supported. 

@changelog_1383_li
The database URL option RECOVER has currently no effect. 

@changelog_1384_li
Converting an old (non-page store) database is no longer supported using this version. 

@changelog_1385_li
The following system properties are no longer supported: h2.overflowExceptions, h2.optimizeDropDependencies, h2.optimizeGroupSorted, h2.optimizeMinMax, h2.optimizeNot, h2.optimizeIn, h2.optimizeInJoin, h2.reuseSpace*. Most of then were there for a long time, but always with the same value. There was no unit test with the other value. So changing them was potentially dangerous (not a lot, but still). 

@changelog_1386_li
The setting LOG has currently no effect (it only had an effect when the page store was disabled). 

@changelog_1387_li
Disabling the page store is no longer supported. The old storage mechanism has been removed, shrinking the jar file size by almost 10%. 

@changelog_1388_li
The translated resources are now stored in UTF-8 format. 

@changelog_1389_li
The Windows service wrapper now detects if multiple versions of H2 are installed. 

@changelog_1390_h2
Version 1.2.128 (2010-01-30)

@changelog_1391_li
There are known errors on rollback when the page store is disabled and at the same time MVCC is used. See http://code.google.com/p/h2database/issues/detail?id=158 

@changelog_1392_li
The DeleteDbFiles tool deleted all files in the .lob.db directory, even files that didn't belong to the database. 

@changelog_1393_li
Automatic conversion of old databases to the page store format failed if the database contained LOB files. 

@changelog_1394_li
Nested subqueries didn't work for INSERT INTO and IN(..). Example: insert into test ((select 1)); 

@changelog_1395_li
If the database was already closed using SHUTDOWN IMMEDIATELY, closing a second connection could throw a NullPointerException if there was a local temporary table. 

@changelog_1396_li
Less classes are loaded when using the database in embedded mode. 

@changelog_1397_li
The information schema tables are only initialized when needed. This reduces memory usage and speeds up creating in-memory databases. Each in-memory database needs about 8 KB of heap memory. 

@changelog_1398_li
Nested UNION/INTERSECT queries with brackets could produce the wrong result if used within a subquery. Example: select count(*) from (select 1 union (select 2 intersect select 2)) x; 

@changelog_1399_li
Comparing an column against a constant expression with a higher precision or length than the column could give wrong results (the expression was truncated before comparing). 

@changelog_1400_li
Improved PostgreSQL compatibility (support SHOW DEFAULT_TRANSACTION_ISOLATION). 

@changelog_1401_li
Documentation: the javadocs for Csv.write and read used the wrong default charset. 

@changelog_1402_li
MVCC: if the table was locked in exclusive mode (such as SELECT ... FOR UPDATE), another session could query the table. This is now longer possible. 

@changelog_1403_li
If a FOR UPDATE query was executed twice (using a PreparedStatement), the table was not locked. 

@changelog_1404_li
Triggers: INSTEAD OF triggers are now supported. Such triggers can be defined on views. 

@changelog_1405_li
New system property h2.identifiersToUpper. If set to false, identifiers in SQL statements are case sensitive even if they are not quoted. 

@changelog_1406_li
Slightly improved performance if the table is already locked. 

@changelog_1407_li
CompressLZF: faster decompression. 

@changelog_1408_li
PgServer: the wrong size was sent for VARCHAR data. Thanks again to Sergi Vladykin for the patch. 

@changelog_1409_li
Serialized access mode (server-less multi-connection mode): fixed getGeneratedKeys() for sequences. 

@changelog_1410_h2
Version 1.2.127 (2010-01-15)

@changelog_1411_li
Serialized access mode (server-less multi-connection mode): sequences did not work as expected (there were gaps in generated values when using multiple connections). 

@changelog_1412_li
Page store: new databases can not be opened with older versions. 

@changelog_1413_li
Page store: adding data to new database is now faster. 

@changelog_1414_li
File system: getting the file name from a path is now faster. This should speed up BLOB and CLOB access. 

@changelog_1415_li
PgServer: incorrect SQL types were returned in result set meta data. Concurrently opening a database could fail (PG catalog initialization was not synchronized). Thanks a lot to Sergi Vladykin for providing the patches! 

@changelog_1416_li
SHOW COLUMNS did not work correctly if there where multiple indexes on the same columns. 

@changelog_1417_li
Page store: the wrong write count was written to the database header. This could cause the server-less multi-connection mode to fail. 

@changelog_1418_li
Result sets larger than 2 GB threw an exception "Negative seek offset". Fixed. 

@changelog_1419_li
If the system property h2.check was set to false, an ArrayIndexOutOfBoundsException could occur. 

@changelog_1420_li
Alter table is now supported even if a table has views defined. (Patch from Kerry Sainsbury). 

@changelog_1421_li
Fulltext search: exceptions within the fulltext search package had the wrong SQL state. 

@changelog_1422_li
The Lucene fulltext search ignored transaction rollback. Fixed using a trigger on rollback. 

@changelog_1423_li
Trigger can now be called on rollback. 

@changelog_1424_li
The shell script h2.sh ignored command line line arguments. 

@changelog_1425_li
When running H2 in the Google AppEngine for Java, a AccessControlException could be thrown when trying to open a read-only database. Fixed. 

@changelog_1426_li
The user home directory prefix (~) is now only expanded when followed by a slash or backslash, or standing alone. 

@changelog_1427_li
Native fulltext search: before inserting or deleting data, FT_INIT() had to be called. This is no longer required. 

@changelog_1428_li
The .trace.db file is now only created if required. 

@changelog_1429_li
Shell tool: improved PostgreSQL compatibility. 

@changelog_1430_li
Trying to open a database in read-only mode when a .lock.db file exists will now fail with a nice error message. 

@changelog_1431_li
H2 Console: data that is too long is now abbreviated as follows: text... (100000 characters). A large binary is abbreviated as follows: abcdef... (100000 bytes). 

@changelog_1432_li
Faster data conversion from BIGINT or INT to DECIMAL. 

@changelog_1433_li
Server-less multi-connection mode: try to delete log files if switching between read/write operations. 

@changelog_1434_li
CompressLZF: Faster decompress and improved javadocs 

@changelog_1435_h2
Version 1.2.126 (2009-12-18)

@changelog_1436_li
The ChangeFileEncryption tool will now fail with an exception if the database is still in use. The Backup tool will also fail except when running in quiet mode. 

@changelog_1437_li
CSVREAD: when reading the column names from the CSV file, column names that contain no special characters are considered case insensitive now. 

@changelog_1438_li
Optimization index conditions of the form 'column=NULL' (which is always false; unlike 'column IS NULL'). 

@changelog_1439_li
Script command and tool: the primary key constraint is now listed before inserting the data. This will result in a smaller database when using the page store. 

@changelog_1440_li
Statements with IN(SELECT..) conditions could produce the wrong result. Example: index on id, name; query: select * from test where id between 1 and 3 and name in (select 'World'). 

@changelog_1441_li
Statements with IN(..) conditions could produce the wrong result when using views or nested select statements. Example: index on id; index on name; query: select * from (select * from test) where id=1 and name in('a', 'b'). select * from (select * from test) where id=1 and name in('Hello', 'World'). 

@changelog_1442_li
Page store: a rollback of a relatively large transaction could fail with an ArrayIndexOutOfBoundsException or a 'row not found' exception in the PageBtreeIndex in some cases. 

@changelog_1443_li
JaQu: the decompiler has been improved, and a few test cases already work. It is still incomplete however. 

@changelog_1444_li
LIKE: any letter is now allowed after the escape character (which is still '\' by default). Previously, an exception was thrown (unlike other databases) if it was not the escape character, '_' or '%'. If the escape character appears at the end of the pattern, the result is it is ignored (like PostgreSQL and MS SQL Server). 

@changelog_1445_li
The reserve heap memory is no longer used. 

@changelog_1446_li
Database.checkpoint() could throw a NullPointerException. 

@changelog_1447_h2
Version 1.2.125 (2009-12-06)

@changelog_1448_li
Lucene fulltext search: the Lucene field names now match the table column names, except if the column names start with _ (in which case another _ is prepended). Unfortunately this change means existing fulltext indexes need to be re-built. 

@changelog_1449_li
The shell tool now has a very simple statement history. 

@changelog_1450_li
The zip file system implementation now supports the '~' home directory prefix. Example database URL: jdbc:h2:zip:~/test.zip!/test 

@changelog_1451_li
Right outer joins on tables that were already 'inner joined' was processed incorrectly. 

@changelog_1452_li
Temporary files from LOB objects were not deleted early enough when using the server mode. 

@changelog_1453_li
Trying to alter a temporary table threw a strange exception. It is still not possible to do that, but the exception message is better now. 

@changelog_1454_li
When the system property h2.maxMemoryRowsDistinct was set, and using SELECT DISTINCT, the temporary table was not correctly dropped. This could cause problems in recovery when the process was killed. 

@changelog_1455_li
Trigger that are called before a select statement are now supported. This allows to create tables that work like materialized views. 

@changelog_1456_li
Non-row based triggers were called even if the action didn't match the declared action (INSERT triggers were also called when deleting rows). This has been changed. The MERGE statement calls both INSERT and DELETE triggers. 

@changelog_1457_li
Statements with IN(..) conditions could produce the wrong result or a data conversion error (since version 1.2.120). Examples: index on id, name, condition: id=1 and name in('Hello', 'x'); index on id, query: select * from (select * from test) where id=1 and name in('Hello', 'World'). 

@changelog_1458_li
The CompressTool was not multithreading safe. Because of this, the following database operations where also not multithreading safe (even when using different databases): the SCRIPT command (only when using compression), the COMPRESS function, and storing CLOB or BLOB data (only when compression is enabled). 

@changelog_1459_li
The compression algorithm "LZF" is now about 33% faster than before when compressing small block (around 2 KB). It is much faster than Deflate, but the compression ratio is lower. Some of the optimizations are from Sam Van Oort, thanks a lot! 

@changelog_1460_li
Compressing large blocks of data didn't work when using the "Deflate" compression algorithm. Compressing a lot of data could run out of heap memory. 

@changelog_1461_li
The test cases don't access the file system directly, this simplifies GAE for Java testing. Thanks to Vince Bonfanti. 

@changelog_1462_li
More bugs in the server-less multi-connection mode have been fixed. 

@changelog_1463_li
When running against an old database, the SCRIPT statement could generate a SQL script that contained duplicate indexes (PRIMARY_KEY_E). 

@changelog_1464_li
JdbcConnectionPool.getConnection() could throw a NullPointerException. 

@changelog_1465_li
User defined functions: the source code is now available using SELECT SOURCE FROM INFORMATION_SCHEMA.FUNCTION_ALIASES. 

@changelog_1466_li
User defined functions with source code didn't work after re-opening the database. 

@changelog_1467_li
The newsfeeds are now Atom 1.0 standard compliant. 

@changelog_1468_li
The database is now closed after an out of memory exception, because the database could get corrupt otherwise. 

@changelog_1469_li
Better error message if both AUTO_SERVER and SERIALIZED parameters are set to TRUE. 

@changelog_1470_li
Drop table did not delete lob files in old file store (not PAGE_STORE). 

@cheatSheet_1000_h1
H2 Database Engine Cheat Sheet

@cheatSheet_1001_h2
Using H2

@cheatSheet_1002_a
H2

@cheatSheet_1003_li
 is <a href="http://code.google.com/p/h2database/source">open source</a>, <a href="license.html">free to use and distribute</a>. 

@cheatSheet_1004_a
Download

@cheatSheet_1005_li
: <a href="http://repo1.maven.org/maven2/com/h2database/h2/1.3.148/h2-1.3.148.jar" class="link">jar</a>, <a href="http://www.h2database.com/h2-setup-2010-12-12.exe" class="link">installer (Windows)</a>, <a href="http://www.h2database.com/h2-2010-12-12.zip" class="link">zip</a>. 

@cheatSheet_1006_li
To start the <a href="quickstart.html#h2_console">H2 Console tool</a>, double click the jar file, or run <code>java -jar h2*.jar</code>, <code>h2.bat</code>, or <code>h2.sh</code>. 

@cheatSheet_1007_a
A new database is automatically created

@cheatSheet_1008_a
by default

@cheatSheet_1009_li
. 

@cheatSheet_1010_a
Closing the last connection closes the database

@cheatSheet_1011_li
. 

@cheatSheet_1012_h2
Documentation

@cheatSheet_1013_p
 Reference: <a href="grammar.html" class="link">SQL grammar</a>, <a href="functions.html" class="link">functions</a>, <a href="datatypes.html" class="link">data types</a>, <a href="tutorial.html#command_line_tools" class="link">tools</a>, <a href="../javadoc/index.html" class="link">API</a> 

@cheatSheet_1014_a
Features

@cheatSheet_1015_p
: <a href="tutorial.html#fulltext" class="link">fulltext search</a>, <a href="features.html#file_encryption" class="link">encryption</a>, <a href="features.html#read_only" class="link">read-only</a> <a href="features.html#database_in_zip" class="link">(zip/jar)</a>, <a href="tutorial.html#csv" class="link">CSV</a>, <a href="features.html#auto_reconnect" class="link">auto-reconnect</a>, <a href="features.html#triggers" class="link">triggers</a>, <a href="features.html#user_defined_functions" class="link">user functions</a> 

@cheatSheet_1016_a
Database URLs

@cheatSheet_1017_a
Embedded

@cheatSheet_1018_code
jdbc:h2:~/test

@cheatSheet_1019_p
 'test' in the user home directory

@cheatSheet_1020_code
jdbc:h2:/data/test

@cheatSheet_1021_p
 'test' in the directory /data

@cheatSheet_1022_code
jdbc:h2:test

@cheatSheet_1023_p
 in the current(!) working directory

@cheatSheet_1024_a
In-Memory

@cheatSheet_1025_code
jdbc:h2:mem:test

@cheatSheet_1026_p
 multiple connections in one process

@cheatSheet_1027_code
jdbc:h2:mem:

@cheatSheet_1028_p
 unnamed private; one connection

@cheatSheet_1029_a
Server Mode

@cheatSheet_1030_code
jdbc:h2:tcp://localhost/~/test

@cheatSheet_1031_p
 user home dir

@cheatSheet_1032_code
jdbc:h2:tcp://localhost//data/test

@cheatSheet_1033_p
 absolute dir

@cheatSheet_1034_a
Server start

@cheatSheet_1035_p
:<code>java -cp *.jar org.h2.tools.Server</code> 

@cheatSheet_1036_a
Settings

@cheatSheet_1037_code
jdbc:h2:..;MODE=MySQL

@cheatSheet_1038_a
compatibility (or HSQLDB,...)

@cheatSheet_1039_code
jdbc:h2:..;TRACE_LEVEL_FILE=3

@cheatSheet_1040_a
log to *.trace.db

@cheatSheet_1041_a
Using the JDBC API

@cheatSheet_1042_a
Connection Pool

@cheatSheet_1043_a
Maven 2

@cheatSheet_1044_a
Hibernate

@cheatSheet_1045_p
 hibernate.cfg.xml (or use the HSQLDialect): 

@cheatSheet_1046_a
TopLink and Glassfish

@cheatSheet_1047_p
 Datasource class: <code>org.h2.jdbcx.JdbcDataSource</code>

@cheatSheet_1048_code
oracle.toplink.essentials.platform.

@cheatSheet_1049_code
database.H2Platform

@download_1000_h1
Downloads

@download_1001_h3
Version 1.3.148 (2010-12-12), Beta

@download_1002_a
Windows Installer

@download_1003_a
Platform-Independent Zip

@download_1004_h3
Version 1.2.147 (2010-11-21), Last Stable

@download_1005_a
Windows Installer

@download_1006_a
Platform-Independent Zip

@download_1007_h3
Download Mirror and Older Versions

@download_1008_a
Platform-Independent Zip

@download_1009_h3
Jar File

@download_1010_a
Maven.org

@download_1011_a
Sourceforge.net

@download_1012_a
Latest Automated Build (not released)

@download_1013_h3
Database Upgrade Helper Files

@download_1014_a
Upgrade database from 1.1 to the current version

@download_1015_h3
Subversion Source Repository

@download_1016_a
Google Code

@download_1017_p
 For details about changes, see the <a href="changelog.html">Change Log</a>. 

@download_1018_h3
News and Project Information

@download_1019_a
Atom Feed

@download_1020_a
RSS Feed

@download_1021_a
DOAP File

@download_1022_p
 (<a href="http://trac.usefulinc.com/doap">what is this</a>) 

@faq_1000_h1
Frequently Asked Questions

@faq_1001_a
 I Have a Problem or Feature Request

@faq_1002_a
 Are there Known Bugs? When is the Next Release?

@faq_1003_a
 Is this Database Engine Open Source?

@faq_1004_a
 How to Create a New Database?

@faq_1005_a
 How to Connect to a Database?

@faq_1006_a
 Where are the Database Files Stored?

@faq_1007_a
 What is the Size Limit (Maximum Size) of a Database?

@faq_1008_a
 Is it Reliable?

@faq_1009_a
 Why is Opening my Database Slow?

@faq_1010_a
 My Query is Slow

@faq_1011_a
 H2 is Very Slow

@faq_1012_a
 Column Names are Incorrect?

@faq_1013_a
 Float is Double?

@faq_1014_a
 Is the GCJ Version Stable? Faster?

@faq_1015_a
 How to Translate this Project?

@faq_1016_a
 How to Contribute to this Project?

@faq_1017_h3
I Have a Problem or Feature Request

@faq_1018_p
 Please read the <a href="build.html#support">support checklist</a>. 

@faq_1019_h3
Are there Known Bugs? When is the Next Release?

@faq_1020_p
 Usually, bugs get fixes as they are found. There is a release every few weeks. Here is the list of known and confirmed issues: 

@faq_1021_li
Apache Harmony: there seems to be a bug in Harmony that affects H2. See <a href="https://issues.apache.org/jira/browse/HARMONY-6505">HARMONY-6505</a>. 

@faq_1022_li
Tomcat and Glassfish 3 set most static fields (final or non-final) to <code>null</code> when unloading a web application. This can cause a <code>NullPointerException</code> in H2 versions 1.1.107 and older, and may still not work in newer versions. Please report it if you run into this issue. In Tomcat &gt;= 6.0 this behavior can be disabled by setting the system property <code>org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false</code>, however Tomcat may then run out of memory. A known workaround is to put the <code>h2*.jar</code> file in a shared <code>lib</code> directory (<code>common/lib</code>). 

@faq_1023_li
Some problems have been found with right outer join. Internally, it is converted to left outer join, which does not always produce the same results as other databases when used in combination with other joins. 

@faq_1024_li
When using Install4j before 4.1.4 on Linux and enabling <code>pack200</code>, the <code>h2*.jar</code> becomes corrupted by the install process, causing application failure. A workaround is to add an empty file <code>h2*.jar.nopack</code> next to the <code>h2*.jar</code> file. This problem is solved in Install4j 4.1.4. 

@faq_1025_p
 For a complete list, see <a href="http://code.google.com/p/h2database/issues/list">Open Issues</a>. 

@faq_1026_h3
Is this Database Engine Open Source?

@faq_1027_p
 Yes. It is free to use and distribute, and the source code is included. See also under license. 

@faq_1028_h3
How to Create a New Database?

@faq_1029_p
 By default, a new database is automatically created if it does not yet exist. See <a href="tutorial.html#creating_new_databases">Creating New Databases</a>. 

@faq_1030_h3
How to Connect to a Database?

@faq_1031_p
 The database driver is <code>org.h2.Driver</code>, and the database URL starts with <code>jdbc:h2:</code>. To connect to a database using JDBC, use the following code: 

@faq_1032_h3
Where are the Database Files Stored?

@faq_1033_p
 When using database URLs like <code>jdbc:h2:~/test</code>, the database is stored in the user directory. For Windows, this is usually <code>C:\Documents and Settings\&lt;userName&gt;</code>. If the base directory is not set (as in <code>jdbc:h2:test</code>), the database files are stored in the directory where the application is started (the current working directory). When using the H2 Console application from the start menu, this is <code>&lt;Installation Directory&gt;/bin</code>. The base directory can be set in the database URL. A fixed or relative path can be used. When using the URL <code>jdbc:h2:file:data/sample</code>, the database is stored in the directory <code>data</code> (relative to the current working directory). The directory is created automatically if it does not yet exist. It is also possible to use the fully qualified directory name (and for Windows, drive name). Example: <code>jdbc:h2:file:C:/data/test</code> 

@faq_1034_h3
What is the Size Limit (Maximum Size) of a Database?

@faq_1035_p
 See <a href="advanced.html#limits_limitations">Limits and Limitations</a>. 

@faq_1036_h3
Is it Reliable?

@faq_1037_p
 That is not easy to say. It is still a quite new product. A lot of tests have been written, and the code coverage of these tests is very high. Randomized stress tests are run regularly. But there are probably still bugs that have not yet been found (as with most software). Some features are known to be dangerous, they are only supported for situations where performance is more important than reliability. Those dangerous features are: 

@faq_1038_li
Disabling the transaction log or FileDescriptor.sync() using LOG=0 or LOG=1. 

@faq_1039_li
Using the transaction isolation level <code>READ_UNCOMMITTED</code> (<code>LOCK_MODE 0</code>) while at the same time using multiple connections. 

@faq_1040_li
Disabling database file protection using (setting <code>FILE_LOCK</code> to <code>NO</code> in the database URL). 

@faq_1041_li
Disabling referential integrity using <code>SET REFERENTIAL_INTEGRITY FALSE</code>. 

@faq_1042_p
 In addition to that, running out of memory should be avoided. In older versions, OutOfMemory errors while using the database could corrupt a databases. 

@faq_1043_p
 This database is well tested using automated test cases. The tests run every night and run for more than one hour. But not all areas of this database are equally well tested. When using one of the following features for production, please ensure your use case is well tested (if possible with automated test cases). The areas that are not well tested are: 

@faq_1044_li
Platforms other than Windows XP, Linux, Mac OS X, or JVMs other than Sun 1.5 or 1.6 

@faq_1045_li
The features <code>AUTO_SERVER</code> and <code>AUTO_RECONNECT</code> 

@faq_1046_li
The file locking method 'Serialized' 

@faq_1047_li
Cluster mode, 2-phase commit, savepoints 

@faq_1048_li
24/7 operation 

@faq_1049_li
Fulltext search 

@faq_1050_li
Operations on LOBs over 2 GB 

@faq_1051_li
Some operations on databases larger than 500 MB may be slower than expected 

@faq_1052_li
The optimizer may not always select the best plan 

@faq_1053_p
 Areas considered experimental are: 

@faq_1054_li
The PostgreSQL server 

@faq_1055_li
Multi-threading within the engine using <code>SET MULTI_THREADED=1</code> 

@faq_1056_li
Compatibility modes for other databases (only some features are implemented) 

@faq_1057_li
The soft reference cache (<code>CACHE_TYPE=SOFT_LRU</code>). It might not improve performance, and out of memory issues have been reported. 

@faq_1058_p
 Some users have reported that after a power failure, the database cannot be opened sometimes. In this case, use a backup of the database or the Recover tool. Please report such problems. The plan is that the database automatically recovers in all situations. 

@faq_1059_h3
Why is Opening my Database Slow?

@faq_1060_p
 To find out what the problem is, use the H2 Console and click on "Test Connection" instead of "Login". After the "Login Successful" appears, click on it (it's a link). This will list the top stack traces. Then either analyze this yourself, or post those stack traces in the Google Group. 

@faq_1061_p
 Other possible reasons are: the database is very big (many GB), or contains linked tables that are slow to open. 

@faq_1062_h3
My Query is Slow

@faq_1063_p
 Slow <code>SELECT</code> (or <code>DELETE, UPDATE, MERGE</code>) statement can have multiple reasons. Follow this checklist: 

@faq_1064_li
Run <code>ANALYZE</code> (see documentation for details). 

@faq_1065_li
Run the query with <code>EXPLAIN</code> and check if indexes are used (see documentation for details). 

@faq_1066_li
If required, create additional indexes and try again using <code>ANALYZE</code> and <code>EXPLAIN</code>. 

@faq_1067_li
If it doesn't help please report the problem. 

@faq_1068_h3
H2 is Very Slow

@faq_1069_p
 By default, H2 closes the database when the last connection is closed. If your application closes the only connection after each operation, the database is opened and closed a lot, which is quite slow. There are multiple ways to solve this problem, see <a href="performance.html#database_performance_tuning">Database Performance Tuning</a>. 

@faq_1070_h3
Column Names are Incorrect?

@faq_1071_p
 For the query <code>SELECT ID AS X FROM TEST</code> the method <code>ResultSetMetaData.getColumnName()</code> returns <code>ID</code>, I expect it to return <code>X</code>. What's wrong? 

@faq_1072_p
 This is not a bug. According the the JDBC specification, the method <code>ResultSetMetaData.getColumnName()</code> should return the name of the column and not the alias name. If you need the alias name, use <a href="http://java.sun.com/javase/6/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel(int)"><code>ResultSetMetaData.getColumnLabel()</code></a>. Some other database don't work like this yet (they don't follow the JDBC specification). If you need compatibility with those databases, use the <a href="features.html#compatibility">Compatibility Mode</a>, or append <a href="../javadoc/org/h2/constant/DbSettings.html#ALIAS_COLUMN_NAME"><code>;ALIAS_COLUMN_NAME=TRUE</code></a> to the database URL. 

@faq_1073_p
 This also applies to DatabaseMetaData calls that return a result set. The columns in the JDBC API are column labels, not column names. 

@faq_1074_h3
Float is Double?

@faq_1075_p
 For a table defined as <code>CREATE TABLE TEST(X FLOAT)</code> the method <code>ResultSet.getObject()</code> returns a <code>java.lang.Double</code>, I expect it to return a <code>java.lang.Float</code>. What's wrong? 

@faq_1076_p
 This is not a bug. According the the JDBC specification, the JDBC data type <code>FLOAT</code> is equivalent to <code>DOUBLE</code>, and both are mapped to <code>java.lang.Double</code>. See also <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/getstart/mapping.html#1055162"> Mapping SQL and Java Types - 8.3.10 FLOAT</a>.

@faq_1077_h3
Is the GCJ Version Stable? Faster?

@faq_1078_p
 The GCJ version is not as stable as the Java version. When running the regression test with the GCJ version, sometimes the application just stops at what seems to be a random point without error message. Currently, the GCJ version is also slower than when using the Sun VM. However, the startup of the GCJ version is faster than when using a VM. 

@faq_1079_h3
How to Translate this Project?

@faq_1080_p
 For more information, see <a href="build.html#translating">Build/Translating</a>. 

@faq_1081_h3
How to Contribute to this Project?

@faq_1082_p
 There are various way to help develop an open source project like H2. The first step could be to <a href="build.html#translating">translate</a> the error messages and the GUI to your native language. Then, you could <a href="build.html#providing_patches">provide patches</a>. Please start with small patches. That could be adding a test case to improve the <a href="build.html#automated">code coverage</a> (the target code coverage for this project is 90%, higher is better). You will have to <a href="build.html">develop, build and run the tests</a>. Once you are familiar with the code, you could implement missing features from the <a href="roadmap.html">feature request list</a>. I suggest to start with very small features that are easy to implement. Keep in mind to provide test cases as well. 

@features_1000_h1
Features

@features_1001_a
 Feature List

@features_1002_a
 Comparison to Other Database Engines

@features_1003_a
 H2 in Use

@features_1004_a
 Connection Modes

@features_1005_a
 Database URL Overview

@features_1006_a
 Connecting to an Embedded (Local) Database

@features_1007_a
 In-Memory Databases

@features_1008_a
 Database Files Encryption

@features_1009_a
 Database File Locking

@features_1010_a
 Opening a Database Only if it Already Exists

@features_1011_a
 Closing a Database

@features_1012_a
 Ignore Unknown Settings

@features_1013_a
 Changing Other Settings when Opening a Connection

@features_1014_a
 Custom File Access Mode

@features_1015_a
 Multiple Connections

@features_1016_a
 Database File Layout

@features_1017_a
 Logging and Recovery

@features_1018_a
 Compatibility

@features_1019_a
 Auto-Reconnect

@features_1020_a
 Automatic Mixed Mode

@features_1021_a
 Page Size

@features_1022_a
 Using the Trace Options

@features_1023_a
 Using Other Logging APIs

@features_1024_a
 Read Only Databases

@features_1025_a
 Read Only Databases in Zip or Jar File

@features_1026_a
 Graceful Handling of Low Disk Space Situations

@features_1027_a
 Computed Columns / Function Based Index

@features_1028_a
 Multi-Dimensional Indexes

@features_1029_a
 User-Defined Functions and Stored Procedures

@features_1030_a
 Triggers

@features_1031_a
 Compacting a Database

@features_1032_a
 Cache Settings

@features_1033_h2
Feature List

@features_1034_h3
Main Features

@features_1035_li
Very fast database engine 

@features_1036_li
Open source 

@features_1037_li
Written in Java 

@features_1038_li
Supports standard SQL, JDBC API 

@features_1039_li
Embedded and Server mode, Clustering support 

@features_1040_li
Strong security features 

@features_1041_li
The PostgreSQL ODBC driver can be used 

@features_1042_li
Multi version concurrency 

@features_1043_h3
Additional Features

@features_1044_li
Disk based or in-memory databases and tables, read-only database support, temporary tables 

@features_1045_li
Transaction support (read committed and serializable transaction isolation), 2-phase-commit 

@features_1046_li
Multiple connections, table level locking 

@features_1047_li
Cost based optimizer, using a genetic algorithm for complex queries, zero-administration 

@features_1048_li
Scrollable and updatable result set support, large result set, external result sorting, functions can return a result set 

@features_1049_li
Encrypted database (AES or XTEA), SHA-256 password encryption, encryption functions, SSL 

@features_1050_h3
SQL Support

@features_1051_li
Support for multiple schemas, information schema 

@features_1052_li
Referential integrity / foreign key constraints with cascade, check constraints 

@features_1053_li
Inner and outer joins, subqueries, read only views and inline views 

@features_1054_li
Triggers and Java functions / stored procedures 

@features_1055_li
Many built-in functions, including XML and lossless data compression 

@features_1056_li
Wide range of data types including large objects (BLOB/CLOB) and arrays 

@features_1057_li
Sequence and autoincrement columns, computed columns (can be used for function based indexes) 

@features_1058_code
ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP

@features_1059_li
Collation support, users, roles 

@features_1060_li
Compatibility modes for IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL. 

@features_1061_h3
Security Features

@features_1062_li
Includes a solution for the SQL injection problem 

@features_1063_li
User password authentication uses SHA-256 and salt 

@features_1064_li
For server mode connections, user passwords are never transmitted in plain text over the network (even when using insecure connections; this only applies to the TCP server and not to the H2 Console however; it also doesn't apply if you set the password in the database URL) 

@features_1065_li
All database files (including script files that can be used to backup data) can be encrypted using AES-128 and XTEA encryption algorithms 

@features_1066_li
The remote JDBC driver supports TCP/IP connections over SSL/TLS 

@features_1067_li
The built-in web server supports connections over SSL/TLS 

@features_1068_li
Passwords can be sent to the database using char arrays instead of Strings 

@features_1069_h3
Other Features and Tools

@features_1070_li
Small footprint (smaller than 1 MB), low memory requirements 

@features_1071_li
Multiple index types (b-tree, tree, hash) 

@features_1072_li
Support for multi-dimensional indexes 

@features_1073_li
CSV (comma separated values) file support 

@features_1074_li
Support for linked tables, and a built-in virtual 'range' table 

@features_1075_code
EXPLAIN PLAN

@features_1076_li
 support, sophisticated trace options 

@features_1077_li
Database closing can be delayed or disabled to improve the performance 

@features_1078_li
Web-based Console application (translated to many languages) with autocomplete 

@features_1079_li
The database can generate SQL script files 

@features_1080_li
Contains a recovery tool that can dump the contents of the database 

@features_1081_li
Support for variables (for example to calculate running totals) 

@features_1082_li
Automatic re-compilation of prepared statements 

@features_1083_li
Uses a small number of database files 

@features_1084_li
Uses a checksum for each record and log entry for data integrity 

@features_1085_li
Well tested (high code coverage, randomized stress tests) 

@features_1086_h2
Comparison to Other Database Engines

@features_1087_th
Feature

@features_1088_th
H2

@features_1089_a
Derby

@features_1090_a
HSQLDB

@features_1091_a
MySQL

@features_1092_a
PostgreSQL

@features_1093_td
Pure Java

@features_1094_td
Yes

@features_1095_td
Yes

@features_1096_td
Yes

@features_1097_td
No

@features_1098_td
No

@features_1099_td
Embedded Mode (Java)

@features_1100_td
Yes

@features_1101_td
Yes

@features_1102_td
Yes

@features_1103_td
No

@features_1104_td
No

@features_1105_td
Performance (Embedded)

@features_1106_td
Fast

@features_1107_td
Slow

@features_1108_td
Fast

@features_1109_td
N/A

@features_1110_td
N/A

@features_1111_td
In-Memory Mode

@features_1112_td
Yes

@features_1113_td
Yes

@features_1114_td
Yes

@features_1115_td
No

@features_1116_td
No

@features_1117_td
Explain Plan

@features_1118_td
Yes

@features_1119_td
No

@features_1120_td
Yes

@features_1121_td
Yes

@features_1122_td
Yes

@features_1123_td
Built-in Clustering / Replication

@features_1124_td
Yes

@features_1125_td
Yes

@features_1126_td
No

@features_1127_td
Yes

@features_1128_td
Yes

@features_1129_td
Encrypted Database

@features_1130_td
Yes

@features_1131_td
Yes *10

@features_1132_td
Yes *10

@features_1133_td
No

@features_1134_td
No

@features_1135_td
Linked Tables

@features_1136_td
Yes

@features_1137_td
No

@features_1138_td
Partially *1

@features_1139_td
Partially *2

@features_1140_td
No

@features_1141_td
ODBC Driver

@features_1142_td
Yes

@features_1143_td
No

@features_1144_td
No

@features_1145_td
Yes

@features_1146_td
Yes

@features_1147_td
Fulltext Search

@features_1148_td
Yes

@features_1149_td
No

@features_1150_td
No

@features_1151_td
Yes

@features_1152_td
Yes

@features_1153_td
User-Defined Datatypes

@features_1154_td
Yes

@features_1155_td
No

@features_1156_td
Yes

@features_1157_td
Yes

@features_1158_td
Yes

@features_1159_td
Files per Database

@features_1160_td
Few

@features_1161_td
Many

@features_1162_td
Few

@features_1163_td
Many

@features_1164_td
Many

@features_1165_td
Row Level Locking

@features_1166_td
Yes *9

@features_1167_td
Yes

@features_1168_td
Yes *9

@features_1169_td
Yes

@features_1170_td
Yes

@features_1171_td
Multi Version Concurrency

@features_1172_td
Yes

@features_1173_td
No

@features_1174_td
Yes

@features_1175_td
Yes

@features_1176_td
Yes

@features_1177_td
Multi-Threaded Statement Processing

@features_1178_td
No *11

@features_1179_td
Yes

@features_1180_td
Yes

@features_1181_td
Yes

@features_1182_td
Yes

@features_1183_td
Role Based Security

@features_1184_td
Yes

@features_1185_td
Yes *3

@features_1186_td
Yes

@features_1187_td
Yes

@features_1188_td
Yes

@features_1189_td
Updatable Result Sets

@features_1190_td
Yes

@features_1191_td
Yes *7

@features_1192_td
Yes

@features_1193_td
Yes

@features_1194_td
Yes

@features_1195_td
Sequences

@features_1196_td
Yes

@features_1197_td
No

@features_1198_td
Yes

@features_1199_td
No

@features_1200_td
Yes

@features_1201_td
Limit and Offset

@features_1202_td
Yes

@features_1203_td
No

@features_1204_td
Yes

@features_1205_td
Yes

@features_1206_td
Yes

@features_1207_td
Temporary Tables

@features_1208_td
Yes

@features_1209_td
Yes *4

@features_1210_td
Yes

@features_1211_td
Yes

@features_1212_td
Yes

@features_1213_td
Information Schema

@features_1214_td
Yes

@features_1215_td
No *8

@features_1216_td
Yes

@features_1217_td
Yes

@features_1218_td
Yes

@features_1219_td
Computed Columns

@features_1220_td
Yes

@features_1221_td
Yes

@features_1222_td
Yes

@features_1223_td
No

@features_1224_td
Yes *6

@features_1225_td
Case Insensitive Columns

@features_1226_td
Yes

@features_1227_td
No

@features_1228_td
Yes

@features_1229_td
Yes

@features_1230_td
Yes *6

@features_1231_td
Custom Aggregate Functions

@features_1232_td
Yes

@features_1233_td
No

@features_1234_td
Yes

@features_1235_td
Yes

@features_1236_td
Yes

@features_1237_td
Footprint (jar/dll size)

@features_1238_td
~1 MB *5

@features_1239_td
~2 MB

@features_1240_td
~1 MB

@features_1241_td
~4 MB

@features_1242_td
~6 MB

@features_1243_p
 *1 HSQLDB supports text tables.

@features_1244_p
 *2 MySQL supports linked MySQL tables under the name 'federated tables'.

@features_1245_p
 *3 Derby support for roles based security and password checking as an option.

@features_1246_p
 *4 Derby only supports global temporary tables.

@features_1247_p
 *5 The default H2 jar file contains debug information, jar files for other databases do not.

@features_1248_p
 *6 PostgreSQL supports functional indexes.

@features_1249_p
 *7 Derby only supports updatable result sets if the query is not sorted.

@features_1250_p
 *8 Derby doesn't support standard compliant information schema tables.

@features_1251_p
 *9 When using MVCC (multi version concurrency).

@features_1252_p
 *10 Derby and HSQLDB <a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29">don't hide hide data patterns well</a>.

@features_1253_p
 *11 The MULTI_THREADED option is not enabled by default, and not yet supported when using MVCC. 

@features_1254_h3
DaffodilDb and One$Db

@features_1255_p
 It looks like the development of this database has stopped. The last release was February 2006. 

@features_1256_h3
McKoi

@features_1257_p
 It looks like the development of this database has stopped. The last release was August 2004. 

@features_1258_h2
H2 in Use

@features_1259_p
 For a list of applications that work with or use H2, see: <a href="links.html">Links</a>. 

@features_1260_h2
Connection Modes

@features_1261_p
 The following connection modes are supported: 

@features_1262_li
Embedded mode (local connections using JDBC) 

@features_1263_li
Server mode (remote connections using JDBC or ODBC over TCP/IP) 

@features_1264_li
Mixed mode (local and remote connections at the same time) 

@features_1265_h3
Embedded Mode

@features_1266_p
 In embedded mode, an application opens a database from within the same JVM using JDBC. This is the fastest and easiest connection mode. The disadvantage is that a database may only be open in one virtual machine (and class loader) at any time. As in all modes, both persistent and in-memory databases are supported. There is no limit on the number of database open concurrently, or on the number of open connections. 

@features_1267_h3
Server Mode

@features_1268_p
 When using the server mode (sometimes called remote mode or client/server mode), an application opens a database remotely using the JDBC or ODBC API. A server needs to be started within the same or another virtual machine, or on another computer. Many applications can connect to the same database at the same time, by connecting to this server. Internally, the server process opens the database(s) in embedded mode. 

@features_1269_p
 The server mode is slower than the embedded mode, because all data is transferred over TCP/IP. As in all modes, both persistent and in-memory databases are supported. There is no limit on the number of database open concurrently per server, or on the number of open connections. 

@features_1270_h3
Mixed Mode

@features_1271_p
 The mixed mode is a combination of the embedded and the server mode. The first application that connects to a database does that in embedded mode, but also starts a server so that other applications (running in different processes or virtual machines) can concurrently access the same data. The local connections are as fast as if the database is used in just the embedded mode, while the remote connections are a bit slower. 

@features_1272_p
 The server can be started and stopped from within the application (using the server API), or automatically (automatic mixed mode). When using the <a href="#auto_mixed_mode">automatic mixed mode</a>, all clients that want to connect to the database (no matter if it's an local or remote connection) can do so using the exact same database URL. 

@features_1273_h2
Database URL Overview

@features_1274_p
 This database supports multiple connection modes and connection settings. This is achieved using different database URLs. Settings in the URLs are not case sensitive. 

@features_1275_th
Topic

@features_1276_th
URL Format and Examples

@features_1277_a
Embedded (local) connection

@features_1278_td
 jdbc:h2:[file:][&lt;path&gt;]&lt;databaseName&gt;

@features_1279_td
 jdbc:h2:~/test

@features_1280_td
 jdbc:h2:file:/data/sample

@features_1281_td
 jdbc:h2:file:C:/data/sample (Windows only)

@features_1282_a
In-memory (private)

@features_1283_td
jdbc:h2:mem:

@features_1284_a
In-memory (named)

@features_1285_td
 jdbc:h2:mem:&lt;databaseName&gt;

@features_1286_td
 jdbc:h2:mem:test_mem 

@features_1287_a
Server mode (remote connections)

@features_1288_a
 using TCP/IP

@features_1289_td
 jdbc:h2:tcp://&lt;server&gt;[:&lt;port&gt;]/[&lt;path&gt;]&lt;databaseName&gt;

@features_1290_td
 jdbc:h2:tcp://localhost/~/test

@features_1291_td
 jdbc:h2:tcp://dbserv:8084/~/sample jdbc:h2:tcp://localhost/mem:test

@features_1292_a
Server mode (remote connections)

@features_1293_a
 using SSL/TLS

@features_1294_td
 jdbc:h2:ssl://&lt;server&gt;[:&lt;port&gt;]/&lt;databaseName&gt;

@features_1295_td
 jdbc:h2:ssl://secureserv:8085/~/sample; 

@features_1296_a
Using encrypted files

@features_1297_td
 jdbc:h2:&lt;url&gt;;CIPHER=[AES|XTEA]

@features_1298_td
 jdbc:h2:ssl://secureserv/~/testdb;CIPHER=AES

@features_1299_td
 jdbc:h2:file:~/secure;CIPHER=XTEA

@features_1300_a
File locking methods

@features_1301_td
 jdbc:h2:&lt;url&gt;;FILE_LOCK={FILE|SOCKET|NO}

@features_1302_td
 jdbc:h2:file:~/private;CIPHER=XTEA;FILE_LOCK=SOCKET

@features_1303_a
Only open if it already exists

@features_1304_td
 jdbc:h2:&lt;url&gt;;IFEXISTS=TRUE

@features_1305_td
 jdbc:h2:file:~/sample;IFEXISTS=TRUE

@features_1306_a
Don't close the database when the VM exits

@features_1307_td
 jdbc:h2:&lt;url&gt;;DB_CLOSE_ON_EXIT=FALSE 

@features_1308_a
Execute SQL on connection

@features_1309_td
 jdbc:h2:&lt;url&gt;;INIT=RUNSCRIPT FROM '~/create.sql'

@features_1310_td
 jdbc:h2:file:~/sample;INIT=RUNSCRIPT FROM '~/create.sql'\\;RUNSCRIPT FROM '~/populate.sql'

@features_1311_a
User name and/or password

@features_1312_td
 jdbc:h2:&lt;url&gt;[;USER=&lt;username&gt;][;PASSWORD=&lt;value&gt;]

@features_1313_td
 jdbc:h2:file:~/sample;USER=sa;PASSWORD=123

@features_1314_a
Debug trace settings

@features_1315_td
 jdbc:h2:&lt;url&gt;;TRACE_LEVEL_FILE=&lt;level 0..3&gt;

@features_1316_td
 jdbc:h2:file:~/sample;TRACE_LEVEL_FILE=3

@features_1317_a
Ignore unknown settings

@features_1318_td
 jdbc:h2:&lt;url&gt;;IGNORE_UNKNOWN_SETTINGS=TRUE

@features_1319_a
Custom file access mode

@features_1320_td
 jdbc:h2:&lt;url&gt;;ACCESS_MODE_DATA=rws

@features_1321_a
Database in a zip file

@features_1322_td
 jdbc:h2:zip:&lt;zipFileName&gt;!/&lt;databaseName&gt;

@features_1323_td
 jdbc:h2:zip:~/db.zip!/test 

@features_1324_a
Compatibility mode

@features_1325_td
 jdbc:h2:&lt;url&gt;;MODE=&lt;databaseType&gt;

@features_1326_td
 jdbc:h2:~/test;MODE=MYSQL 

@features_1327_a
Auto-reconnect

@features_1328_td
 jdbc:h2:&lt;url&gt;;AUTO_RECONNECT=TRUE

@features_1329_td
 jdbc:h2:tcp://localhost/~/test;AUTO_RECONNECT=TRUE 

@features_1330_a
Automatic mixed mode

@features_1331_td
 jdbc:h2:&lt;url&gt;;AUTO_SERVER=TRUE

@features_1332_td
 jdbc:h2:~/test;AUTO_SERVER=TRUE 

@features_1333_a
Page size

@features_1334_td
 jdbc:h2:&lt;url&gt;;PAGE_SIZE=512

@features_1335_a
Changing other settings

@features_1336_td
 jdbc:h2:&lt;url&gt;;&lt;setting&gt;=&lt;value&gt;[;&lt;setting&gt;=&lt;value&gt;...]

@features_1337_td
 jdbc:h2:file:~/sample;TRACE_LEVEL_SYSTEM_OUT=3

@features_1338_h2
Connecting to an Embedded (Local) Database

@features_1339_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 recommended to use lowercase letters only. The database name must be at least three characters long (a limitation of <code>File.createTempFile</code>). To point to the user home directory, use <code>~/</code>, as in: <code>jdbc:h2:~/test</code>. 

@features_1340_h2
In-Memory Databases

@features_1341_p
 For certain use cases (for example: rapid prototyping, testing, high performance operations, read-only databases), it may not be required to persist data, or persist changes to the data. This database supports the in-memory mode, where the data is not persisted. 

@features_1342_p
 In some cases, only one connection to a in-memory 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_1343_p
 Sometimes multiple connections to the same in-memory database are required. In this case, the database URL must include a name. Example: <code>jdbc:h2:mem:db1</code>. Accessing the same database using this URL only works within the same virtual machine and class loader environment. 

@features_1344_p
 In-memory can be accessed 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>. 

@features_1345_p
 By default, closing the last connection to a database closes the database. For an in-memory database, this means the content is lost. To keep the database open, add <code>;DB_CLOSE_DELAY=-1</code> to the database URL. To keep the content of an in-memory database as long as the virtual machine is alive, use <code>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</code>. 

@features_1346_h2
Database Files Encryption

@features_1347_p
 The database files can be encrypted. Two encryption algorithms are supported: AES and XTEA. To use file encryption, you need to specify the encryption algorithm (the 'cipher') and the file password (in addition to the user password) when connecting to the database. 

@features_1348_h3
Creating a New Database with File Encryption

@features_1349_p
 By default, a new database is automatically created if it does not exist yet. To create an encrypted database, connect to it as it would already exist. 

@features_1350_h3
Connecting to an Encrypted Database

@features_1351_p
 The encryption algorithm is set in the database URL, and the file password is specified in the password field, before the user password. A single space separates the file password and the user password; the file password itself may not contain spaces. File passwords and user passwords are case sensitive. Here is an example to connect to a password-encrypted database: 

@features_1352_h3
Encrypting or Decrypting a Database

@features_1353_p
 To encrypt an existing database, use the <code>ChangeFileEncryption</code> tool. This tool can also decrypt an encrypted database, or change the file encryption key. The tool is available from within the H2 Console in the tools section, or you can run it from the command line. The following command line will encrypt the database <code>test</code> in the user home directory with the file password <code>filepwd</code> and the encryption algorithm AES: 

@features_1354_h2
Database File Locking

@features_1355_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_1356_p
 The following file locking methods are implemented: 

@features_1357_li
The default method is <code>FILE</code> and uses a watchdog thread to protect the database file. The watchdog reads the lock file each second. 

@features_1358_li
The second method is <code>SOCKET</code> 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 one (and always the same) computer. 

@features_1359_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. Failing to do so will result in a corrupted database. Using the method <code>NO</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_1360_p
 To open the database with a different file locking method, use the parameter <code>FILE_LOCK</code>. The following code opens the database with the 'socket' locking method: 

@features_1361_p
 For more information about the algorithms, see <a href="advanced.html#file_locking_protocols">Advanced / File Locking Protocols</a>. 

@features_1362_h2
Opening a Database Only if it Already Exists

@features_1363_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 databases, and only allow to open existing databases. To do this, add <code>;IFEXISTS=TRUE</code> to the database 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_1364_h2
Closing a Database

@features_1365_h3
Delayed Database Closing

@features_1366_p
 Usually, a 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 to keep at least one connection open. The automatic closing of a database can be delayed or disabled with the SQL statement <code>SET DB_CLOSE_DELAY &lt;seconds&gt;</code>. The parameter &lt;seconds&gt; specifies the number of seconds to keep a database open after the last connection to it was closed. The following statement will keep a database open for 10 seconds after the last connection was closed: 

@features_1367_p
 The value -1 means the database is not 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_1368_h3
Don't Close a Database when the VM Exits

@features_1369_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, 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_1370_h2
Execute SQL on Connection

@features_1371_p
 Sometimes, particularly for in-memory databases, it is useful to be able to execute DDL or DML commands automatically when a client connects to a database. This functionality is enabled via the INIT property. Note that multiple commands may be passed to INIT, but the semicolon delimiter must be escaped, as in the example below. 

@features_1372_h2
Ignore Unknown Settings

@features_1373_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 <code>PREFERDOSLIKELINEENDS</code> and <code>IGNOREDRIVERPRIVILEGES</code> 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 <code>;IGNORE_UNKNOWN_SETTINGS=TRUE</code> to the database URL. 

@features_1374_h2
Changing Other Settings when Opening a Connection

@features_1375_p
 In addition to the settings already described, other database settings can be passed in the database URL. Adding <code>;setting=value</code> at the end of a database URL is the same as executing the statement <code>SET setting value</code> just after connecting. For a list of supported settings, see <a href="grammar.html">SQL Grammar</a>. 

@features_1376_h2
Custom File Access Mode

@features_1377_p
 Usually, the database opens the database file with the access mode <code>rw</code>, meaning read-write (except for read only databases, where the mode <code>r</code> is used). To open a database in read-only mode if the database file is not read-only, use <code>ACCESS_MODE_DATA=r</code>. Also supported are <code>rws</code> and <code>rwd</code>. This setting must be specified in the database URL: 

@features_1378_p
 For more information see <a href="advanced.html#durability_problems">Durability Problems</a>. On many operating systems the access mode <code>rws</code> does not guarantee that the data is written to the disk. 

@features_1379_h2
Multiple Connections

@features_1380_h3
Opening Multiple Databases at the Same Time

@features_1381_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_1382_h3
Multiple Connections to the Same Database: Client/Server

@features_1383_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_1384_h3
Multithreading Support

@features_1385_p
 This database is multithreading-safe. That means, if an application is multi-threaded, it does not need to worry about synchronizing access to the database. Internally, most requests to the same database are synchronized. That means an application can use multiple threads that access the same database at the same time, however if one thread executes a long running query, the other threads need to wait. 

@features_1386_p
 An application should normally use one connection per thread. This database synchronizes access to the same connection, but other databases may not do this. 

@features_1387_h3
Locking, Lock-Timeout, Deadlocks

@features_1388_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). All locks are released when the transaction commits or rolls back. When using the default transaction isolation level 'read committed', read locks are already released after each statement. 

@features_1389_p
 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 a connection cannot get a lock for a specified time, then a lock timeout exception is thrown. 

@features_1390_p
 Usually, <code>SELECT</code> statements 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 <code>SELECT ... FOR UPDATE</code>. The statements <code>COMMIT</code> and <code>ROLLBACK</code> releases all open locks. The commands <code>SAVEPOINT</code> and <code>ROLLBACK TO SAVEPOINT</code> 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. The following statements generate locks: 

@features_1391_th
Type of Lock

@features_1392_th
SQL Statement

@features_1393_td
Read

@features_1394_td
SELECT * FROM TEST;

@features_1395_td
 CALL SELECT MAX(ID) FROM TEST;

@features_1396_td
 SCRIPT;

@features_1397_td
Write

@features_1398_td
SELECT * FROM TEST WHERE 1=0 FOR UPDATE;

@features_1399_td
Write

@features_1400_td
INSERT INTO TEST VALUES(1, 'Hello');

@features_1401_td
 INSERT INTO TEST SELECT * FROM TEST;

@features_1402_td
 UPDATE TEST SET NAME='Hi';

@features_1403_td
 DELETE FROM TEST;

@features_1404_td
Write

@features_1405_td
ALTER TABLE TEST ...;

@features_1406_td
 CREATE INDEX ... ON TEST ...;

@features_1407_td
 DROP INDEX ...;

@features_1408_p
 The number of seconds until a lock timeout exception is thrown can be set separately for each connection using the SQL command <code>SET LOCK_TIMEOUT &lt;milliseconds&gt;</code>. The initial lock timeout (that is the timeout used for new connections) can be set using the SQL command <code>SET DEFAULT_LOCK_TIMEOUT &lt;milliseconds&gt;</code>. The default lock timeout is persistent. 

@features_1409_h2
Database File Layout

@features_1410_p
 The following files are created for persistent databases: 

@features_1411_th
File Name

@features_1412_th
Description

@features_1413_th
Number of Files

@features_1414_td
 test.h2.db 

@features_1415_td
 Database file.

@features_1416_td
 Contains the transaction log, indexes, and data for all tables.

@features_1417_td
 Format: <code>&lt;database&gt;.h2.db</code> 

@features_1418_td
 1 per database 

@features_1419_td
 test.lock.db 

@features_1420_td
 Database lock file.

@features_1421_td
 Automatically (re-)created while the database is in use.

@features_1422_td
 Format: <code>&lt;database&gt;.lock.db</code> 

@features_1423_td
 1 per database (only if in use) 

@features_1424_td
 test.trace.db 

@features_1425_td
 Trace file (if the trace option is enabled).

@features_1426_td
 Contains trace information.

@features_1427_td
 Format: <code>&lt;database&gt;.trace.db</code>

@features_1428_td
 Renamed to <code>&lt;database&gt;.trace.db.old</code> is too big. 

@features_1429_td
 0 or 1 per database 

@features_1430_td
 test.lobs.db/* 

@features_1431_td
 Directory containing one file for each

@features_1432_td
 BLOB or CLOB value larger than a certain size.

@features_1433_td
 Format: <code>&lt;id&gt;.t&lt;tableId&gt;.lob.db</code> 

@features_1434_td
 1 per large object 

@features_1435_td
 test.123.temp.db 

@features_1436_td
 Temporary file.

@features_1437_td
 Contains a temporary blob or a large result set.

@features_1438_td
 Format: <code>&lt;database&gt;.&lt;id&gt;.temp.db</code> 

@features_1439_td
 1 per object 

@features_1440_h3
Moving and Renaming Database Files

@features_1441_p
 Database name and location are not stored inside the database files. 

@features_1442_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 of the same database start with the same name and the respective extensions are unchanged). 

@features_1443_p
 As there is no platform specific data in the files, they can be moved to other operating systems without problems. 

@features_1444_h3
Backup

@features_1445_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_1446_p
 To backup data while the database is running, the SQL command <code>SCRIPT</code> can be used. 

@features_1447_h2
Logging and Recovery

@features_1448_p
 Whenever data is modified in the database and those changes are committed, the changes are written to the transaction log (except for in-memory objects). The changes to the main data area itself are usually written later on, to optimize disk access. If there is a power failure, the main data area is not up-to-date, but because the changes are in the transaction log, the next time the database is opened, the changes are re-applied automatically. 

@features_1449_h2
Compatibility

@features_1450_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_1451_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 <code>IGNORECASE=TRUE</code> to the database URL (example: <code>jdbc:h2:~/test;IGNORECASE=TRUE</code>). 

@features_1452_h3
Compatibility Modes

@features_1453_p
 For certain features, this database can emulate the behavior of specific databases. Not all features or differences of those databases are implemented. Here is the list of currently supported modes and the differences to the regular mode: 

@features_1454_h3
DB2 Compatibility Mode

@features_1455_p
 To use the IBM DB2 mode, use the database URL <code>jdbc:h2:~/test;MODE=DB2</code> or the SQL statement <code>SET MODE DB2</code>. 

@features_1456_li
For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. 

@features_1457_li
Support for the syntax <code>[OFFSET .. ROW] [FETCH ... ONLY]</code> as an alternative for <code>LIMIT .. OFFSET</code>. 

@features_1458_li
Concatenating <code>NULL</code> with another value results in the other value. 

@features_1459_h3
Derby Compatibility Mode

@features_1460_p
 To use the Apache Derby mode, use the database URL <code>jdbc:h2:~/test;MODE=Derby</code> or the SQL statement <code>SET MODE Derby</code>. 

@features_1461_li
For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. 

@features_1462_li
For unique indexes, <code>NULL</code> is distinct. That means only one row with <code>NULL</code> in one of the columns is allowed. 

@features_1463_li
Concatenating <code>NULL</code> with another value results in the other value. 

@features_1464_h3
HSQLDB Compatibility Mode

@features_1465_p
 To use the HSQLDB mode, use the database URL <code>jdbc:h2:~/test;MODE=HSQLDB</code> or the SQL statement <code>SET MODE HSQLDB</code>. 

@features_1466_li
For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. 

@features_1467_li
When converting the scale of decimal data, the number is only converted if the new scale is smaller than the current scale. Usually, the scale is converted and 0s are added if required. 

@features_1468_li
For unique indexes, <code>NULL</code> is distinct. That means only one row with <code>NULL</code> in one of the columns is allowed. 

@features_1469_li
Text can be concatenated using '+'. 

@features_1470_h3
MS SQL Server Compatibility Mode

@features_1471_p
 To use the MS SQL Server mode, use the database URL <code>jdbc:h2:~/test;MODE=MSSQLServer</code> or the SQL statement <code>SET MODE MSSQLServer</code>. 

@features_1472_li
For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. 

@features_1473_li
Identifiers may be quoted using square brackets as in <code>[Test]</code>. 

@features_1474_li
For unique indexes, <code>NULL</code> is distinct. That means only one row with <code>NULL</code> in one of the columns is allowed. 

@features_1475_li
Concatenating <code>NULL</code> with another value results in the other value. 

@features_1476_li
Text can be concatenated using '+'. 

@features_1477_h3
MySQL Compatibility Mode

@features_1478_p
 To use the MySQL mode, use the database URL <code>jdbc:h2:~/test;MODE=MySQL</code> or the SQL statement <code>SET MODE MySQL</code>. 

@features_1479_li
When inserting data, if a column is defined to be <code>NOT NULL</code> and <code>NULL</code> 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_1480_li
Creating indexes in the <code>CREATE TABLE</code> statement is allowed using <code>INDEX(..)</code> or <code>KEY(..)</code>. Example: <code>create table test(id int primary key, name varchar(255), key idx_name(name));</code> 

@features_1481_li
Meta data calls return identifiers in lower case. 

@features_1482_li
When converting a floating point number to an integer, the fractional digits are not truncated, but the value is rounded. 

@features_1483_li
Concatenating <code>NULL</code> with another value results in the other value. 

@features_1484_h3
Oracle Compatibility Mode

@features_1485_p
 To use the Oracle mode, use the database URL <code>jdbc:h2:~/test;MODE=Oracle</code> or the SQL statement <code>SET MODE Oracle</code>. 

@features_1486_li
For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. 

@features_1487_li
When using unique indexes, multiple rows with <code>NULL</code> in all columns are allowed, however it is not allowed to have multiple rows with the same values otherwise. 

@features_1488_li
Concatenating <code>NULL</code> with another value results in the other value. 

@features_1489_h3
PostgreSQL Compatibility Mode

@features_1490_p
 To use the PostgreSQL mode, use the database URL <code>jdbc:h2:~/test;MODE=PostgreSQL</code> or the SQL statement <code>SET MODE PostgreSQL</code>. 

@features_1491_li
For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. 

@features_1492_li
When converting a floating point number to an integer, the fractional digits are not be truncated, but the value is rounded. 

@features_1493_li
The system columns <code>CTID</code> and <code>OID</code> are supported. 

@features_1494_h2
Auto-Reconnect

@features_1495_p
 The auto-reconnect feature causes the JDBC driver to reconnect to the database if the connection is lost. The automatic re-connect only occurs when auto-commit is enabled; if auto-commit is disabled, an exception is thrown. To enable this mode, append <code>;AUTO_RECONNECT=TRUE</code> to the database URL. 

@features_1496_p
 Re-connecting will open a new session. After an automatic re-connect, variables and local temporary tables definitions (excluding data) are re-created. The contents of the system table <code>INFORMATION_SCHEMA.SESSION_STATE</code> contains all client side state that is re-created. 

@features_1497_p
 If another connection uses the database in exclusive mode (enabled using <code>SET EXCLUSIVE 1</code> or <code>SET EXCLUSIVE 2</code>), then this connection will try to re-connect until the exclusive mode ends. 

@features_1498_h2
Automatic Mixed Mode

@features_1499_p
 Multiple processes can access the same database without having to start the server manually. To do that, append <code>;AUTO_SERVER=TRUE</code> to the database URL. You can use the same database URL independent of whether the database is already open or not. This feature doesn't work with in-memory databases. Example database URL: 

@features_1500_p
 Use the same URL for all connections to this database. Internally, when using this mode, the first connection to the database is made in embedded mode, and additionally a server is started internally (as a daemon thread). If the database is already open in another process, the server mode is used automatically. 

@features_1501_p
 The application that opens the first connection to the database uses the embedded mode, which is faster than the server mode. Therefore the main application should open the database first if possible. The first connection automatically starts a server on a random port. This server allows remote connections, however only to this database (to ensure that, the client reads <code>.lock.db</code> file and sends the the random key that is stored there to the server). When the first connection is closed, the server stops. If other (remote) connections are still open, one of them will then start a server (auto-reconnect is enabled automatically). 

@features_1502_p
 All processes need to have access to the database files. If the first connection is closed (the connection that started the server), open transactions of other connections will be rolled back (this may not be a problem if you don't disable autocommit). Explicit client/server connections (using <code>jdbc:h2:tcp://</code> or <code>ssl://</code>) are not supported. This mode is not supported for in-memory databases. 

@features_1503_p
 Here is an example how to use this mode. Application 1 and 2 are not necessarily started on the same computer, but they need to have access to the database files. Application 1 and 2 are typically two different processes (however they could run within the same process). 

@features_1504_h2
Page Size

@features_1505_p
 The page size for new databases is 2 KB (2048), unless the system property <code>h2.pageSize</code> is set to a different value, or the page size is set explicitly in the database URL using <code>PAGE_SIZE=</code>. The page size of existing databases can not be changed. 

@features_1506_h2
Using the Trace Options

@features_1507_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_1508_li
Trace to <code>System.out</code> and/or to a file 

@features_1509_li
Support for trace levels <code>OFF, ERROR, INFO, DEBUG</code> 

@features_1510_li
The maximum size of the trace file can be set 

@features_1511_li
It is possible to generate Java source code from the trace file 

@features_1512_li
Trace can be enabled at runtime by manually creating a file 

@features_1513_h3
Trace Options

@features_1514_p
 The simplest way to enable the trace option is setting it in the database URL. There are two settings, one for <code>System.out</code> (<code>TRACE_LEVEL_SYSTEM_OUT</code>) tracing, and one for file tracing (<code>TRACE_LEVEL_FILE</code>). The trace levels are 0 for <code>OFF</code>, 1 for <code>ERROR</code> (the default), 2 for <code>INFO</code>, and 3 for <code>DEBUG</code>. A database URL with both levels set to <code>DEBUG</code> is: 

@features_1515_p
 The trace level can be changed at runtime by executing the SQL command <code>SET TRACE_LEVEL_SYSTEM_OUT level</code> (for <code>System.out</code> tracing) or <code>SET TRACE_LEVEL_FILE level</code> (for file tracing). Example: 

@features_1516_h3
Setting the Maximum Size of the Trace File

@features_1517_p
 When using a high trace level, the trace file can get very big quickly. The default size limit is 16 MB, if the trace file exceeds this limit, it is renamed to <code>.old</code> and a new file is created. If another such file exists, it is deleted. To limit the size to a certain number of megabytes, use <code>SET TRACE_MAX_FILE_SIZE mb</code>. Example: 

@features_1518_h3
Java Code Generation

@features_1519_p
 When setting the trace level to <code>INFO</code> or <code>DEBUG</code>, Java source code is generated as well. This simplifies reproducing problems. The trace file looks like this: 

@features_1520_p
 To filter the Java source code, use the <code>ConvertTraceFile</code> tool as follows: 

@features_1521_p
 The generated file <code>Test.java</code> will contain the Java source code. The generated source code may be too large to compile (the size of a Java method is limited). If this is the case, the source code needs to be split in multiple methods. The password is not listed in the trace file and therefore not included in the source code. 

@features_1522_h2
Using Other Logging APIs

@features_1523_p
 By default, this database uses its own native 'trace' facility. This facility is called 'trace' and not 'log' within this database to avoid confusion with the transaction log. Trace messages can be written to both file and <code>System.out</code>. In most cases, this is sufficient, however sometimes it is better to use the same facility as the application, for example Log4j. To do that, this database support SLF4J. 

@features_1524_a
SLF4J

@features_1525_p
 is a simple facade for various logging APIs and allows to plug in the desired implementation at deployment time. SLF4J supports implementations such as Logback, Log4j, Jakarta Commons Logging (JCL), Java logging, x4juli, and Simple Log. 

@features_1526_p
 To enable SLF4J, set the file trace level to 4 in the database URL: 

@features_1527_p
 Changing the log mechanism is not possible after the database is open, that means executing the SQL statement <code>SET TRACE_LEVEL_FILE 4</code> when the database is already open will not have the desired effect. To use SLF4J, all required jar files need to be in the classpath. If it does not work, check the file <code>&lt;database&gt;.trace.db</code> for error messages. 

@features_1528_h2
Read Only Databases

@features_1529_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 <code>SELECT</code> and <code>CALL</code> statements are allowed. To create a read-only database, close the database. Then, make the database file read-only. When you open the database now, it is read-only. There are two ways an application can find out whether database is read-only: by calling <code>Connection.isReadOnly()</code> or by executing the SQL statement <code>CALL READONLY()</code>. 

@features_1530_p
 Using the <a href="#custom_access_mode">Custom Access Mode</a> <code>r</code> the database can also be opened in read-only mode, even if the database file is not read only. 

@features_1531_h2
Read Only Databases in Zip or Jar File

@features_1532_p
 To create a read-only database in a zip file, first create a regular persistent database, and then create a backup. The database must not have pending changes, that means you need to close all connections to the database first. If you are using a database named <code>test</code>, an easy way to create a zip file is using the <code>Backup</code> tool. You can start the tool from the command line, or from within the H2 Console (Tools - Backup). Please note that the database must be closed when the backup is created. Therefore, the SQL statement <code>BACKUP TO</code> can not be used. 

@features_1533_p
 When the zip file is created, you can open the database in the zip file using the following database URL: 

@features_1534_p
 Databases in zip files 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; therefore large databases are supported as well. The same indexes are used as when using a regular database. 

@features_1535_h2
Graceful Handling of Low Disk Space Situations

@features_1536_p
 If the database needs more disk space, it calls the database event listener if one is installed. The application may then delete temporary files, or display a message and wait until the user has resolved the problem. To install a listener, run the SQL statement <code>SET DATABASE_EVENT_LISTENER</code> or use a database URL of the form <code>jdbc:h2:~/test;DATABASE_EVENT_LISTENER='com.acme.DbListener'</code> (the quotes around the class name are required). See also the <code>DatabaseEventListener</code> API. 

@features_1537_h3
Opening a Corrupted Database

@features_1538_p
 If a database cannot 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_1539_h2
Computed Columns / Function Based Index

@features_1540_p
 Function indexes are not directly supported by this database, but they can be emulated by using computed columns. For example, if an index on the upper-case version of a column is required, create a computed column with the upper-case version of the original column, and create an index for this column: 

@features_1541_p
 When inserting data, it is not required (and 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_1542_h2
Multi-Dimensional Indexes

@features_1543_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_1544_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_1545_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 <code>TestMultiDimension.java</code>. 

@features_1546_h2
User-Defined Functions and Stored Procedures

@features_1547_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. A function can be defined using source code, or as a reference to a compiled class that is available in the classpath. By default, the function aliases are stored in the current schema. 

@features_1548_h3
Referencing a Compiled Method

@features_1549_p
 When referencing a method, the class must already be compiled and included in the classpath where the database is running. Only static Java methods are supported; both the class and the method must be public. Example Java class: 

@features_1550_p
 The Java function must be registered in the database by calling <code>CREATE ALIAS ... FOR</code>: 

@features_1551_p
 For a complete sample application, see <code>src/test/org/h2/samples/Function.java</code>. 

@features_1552_h3
Declaring Functions as Source Code

@features_1553_p
 When defining a function alias with source code, the database tries to compile the source code using the Sun Java compiler (the class <code>com.sun.tools.javac.Main</code>) if the <code>tools.jar</code> is in the classpath. If not, <code>javac</code> is run as a separate process. Only the source code is stored in the database; the class is compiled each time the database is re-opened. Source code is usually passed as dollar quoted text to avoid escaping problems, however single quotes can be used as well. Example: 

@features_1554_p
 The method name (<code>nextPrime</code> in the example above) is ignored. By default, the three packages <code>java.util, java.math, java.sql</code> are imported. If different import statements are required, they must be declared at the beginning and separated with the tag <code>@CODE</code>: 

@features_1555_p
 The following template is used to create a complete Java class: 

@features_1556_h3
Function Data Type Mapping

@features_1557_p
 Functions that accept non-nullable parameters such as <code>int</code> will not be called if one of those parameters is <code>NULL</code>. Instead, the result of the function is <code>NULL</code>. If the function should be called if a parameter is <code>NULL</code>, you need to use <code>java.lang.Integer</code> instead. 

@features_1558_p
 SQL types are mapped to Java classes and vice-versa as in the JDBC API. For details, see <a href="datatypes.html">Data Types</a>. There are two special cases: <code>java.lang.Object</code> is mapped to <code>OTHER</code> (a serialized object). Therefore, <code>java.lang.Object</code> can not be used to match all SQL types (matching all SQL types is not supported). The second special case is <code>Object[]</code>: arrays of any class are mapped to <code>ARRAY</code>. 

@features_1559_h3
Functions That Require a Connection

@features_1560_p
 If the first parameter of a Java function is a <code>java.sql.Connection</code>, then the connection to database is provided. This connection does not need to be closed before returning. When calling the method from within the SQL statement, this connection parameter does not need to be (can not be) specified. 

@features_1561_h3
Functions Throwing an Exception

@features_1562_p
 If a function throws an exception, then the current statement is rolled back and the exception is thrown to the application. SQLException are directly re-thrown to the calling application; all other exceptions are first converted to a SQLException. 

@features_1563_h3
Functions Returning a Result Set

@features_1564_p
 Functions may returns a result set. Such a function can be called with the <code>CALL</code> statement: 

@features_1565_h3
Using SimpleResultSet

@features_1566_p
 A function can create a result set using the <code>SimpleResultSet</code> tool: 

@features_1567_h3
Using a Function as a Table

@features_1568_p
 A function that returns a result set can be used 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 <code>null</code> where not known at compile time). And then, while executing the statement to get the data (maybe multiple times 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 <code>jdbc:columnlist:connection</code>. Otherwise, the URL of the connection is <code>jdbc:default:connection</code>. 

@features_1569_h2
Triggers

@features_1570_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 <code>src/test/org/h2/samples/TriggerSample.java</code>. A Java trigger must implement the interface <code>org.h2.api.Trigger</code>. The trigger class must be available in the classpath of the database engine (when using the server mode, it must be in the classpath of the server). 

@features_1571_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_1572_p
 The trigger can be used to veto a change by throwing a <code>SQLException</code>. 

@features_1573_h2
Compacting a Database

@features_1574_p
 Empty space in the database file re-used automatically. When closing the database, the database is automatically compacted for up to 200 milliseconds by default. To compact more, use the SQL statement SHUTDOWN COMPACT. However re-creating the database may further reduce the database size because this will re-build the indexes. Here is a sample function to do this: 

@features_1575_p
 See also the sample application <code>org.h2.samples.Compact</code>. The commands <code>SCRIPT / RUNSCRIPT</code> can be used as well to create a backup of a database and re-build the database from the script. 

@features_1576_h2
Cache Settings

@features_1577_p
 The database keeps most frequently used data in the main memory. The amount of memory used for caching can be changed using the setting <code>CACHE_SIZE</code>. This setting can be set in the database connection URL (<code>jdbc:h2:~/test;CACHE_SIZE=131072</code>), or it can be changed at runtime using <code>SET CACHE_SIZE size</code>. The size of the cache, as represented by <code>CACHE_SIZE</code> is measured in KB, with each KB being 1024 bytes. This setting has no effect for in-memory databases. For persistent databases, the setting is stored in the database and re-used when the database is opened the next time. However, when opening an existing database, the cache size is set to at most half the amount of memory available for the virtual machine (Runtime.getRuntime().maxMemory()), even if the cache size setting stored in the database is larger; however the setting stored in the database is kept. Setting the cache size in the database URL or explicitly using <code>SET CACHE_SIZE</code> overrides this value (even if larger than the physical memory). To get the current used maximum cache size, use the query <code>SELECT * FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME = 'info.CACHE_MAX_SIZE'</code> 

@features_1578_p
 Also included is an experimental second level soft reference cache. Rows in this cache are only garbage collected on low memory. By default the second level cache is disabled. To enable it, use the prefix <code>SOFT_</code>. Example: <code>jdbc:h2:~/test;CACHE_TYPE=SOFT_LRU</code>. The cache might not actually improve performance. If you plan to use it, please run your own test cases first. 

@features_1579_p
 To get information about page reads and writes, and the current caching algorithm in use, call <code>SELECT * FROM INFORMATION_SCHEMA.SETTINGS</code>. The number of pages read / written is listed. 

@fragments_1000_label
Search:

@fragments_1001_label
Highlight keyword(s)

@fragments_1002_a
Home

@fragments_1003_a
Download

@fragments_1004_a
Cheat Sheet

@fragments_1005_b
Documentation

@fragments_1006_a
Quickstart

@fragments_1007_a
Installation

@fragments_1008_a
Tutorial

@fragments_1009_a
Features

@fragments_1010_a
Performance

@fragments_1011_a
Advanced

@fragments_1012_b
Reference

@fragments_1013_a
SQL Grammar

@fragments_1014_a
Functions

@fragments_1015_a
Data Types

@fragments_1016_a
Javadoc

@fragments_1017_a
PDF (1 MB)

@fragments_1018_b
Support

@fragments_1019_a
FAQ

@fragments_1020_a
Error Analyzer

@fragments_1021_a
Google Group (English)

@fragments_1022_a
Google Group (Japanese)

@fragments_1023_a
Google Group (Chinese)

@fragments_1024_b
Appendix

@fragments_1025_a
JaQu

@fragments_1026_a
Build

@fragments_1027_a
History &amp; Roadmap

@fragments_1028_a
Links

@fragments_1029_a
License

@fragments_1030_td
&nbsp;

@frame_1000_h1
H2 Database Engine

@frame_1001_p
 Welcome to H2, the free SQL database. The main feature of H2 are: 

@frame_1002_li
It is free to use for everybody, source code is included 

@frame_1003_li
Written in Java, but also available as native executable 

@frame_1004_li
JDBC and (partial) ODBC API 

@frame_1005_li
Embedded and client/server modes 

@frame_1006_li
Clustering is supported 

@frame_1007_li
A web client is included 

@frame_1008_h2
No Javascript

@frame_1009_p
 If you are not automatically redirected to the main page, then Javascript is currently disabled or your browser does not support Javascript. Some features (for example the integrated search) require Javascript. 

@frame_1010_p
 Please enable Javascript, or go ahead without it: <a href="main.html" style="font-size: 16px; font-weight: bold">H2 Database Engine</a> 

@history_1000_h1
History and Roadmap

@history_1001_a
 Change Log

@history_1002_a
 Roadmap

@history_1003_a
 History of this Database Engine

@history_1004_a
 Why Java

@history_1005_a
 Supporters

@history_1006_h2
Change Log

@history_1007_p
 The up-to-date change log is available at <a href="http://www.h2database.com/html/changelog.html"> http://www.h2database.com/html/changelog.html </a> 

@history_1008_h2
Roadmap

@history_1009_p
 The current roadmap is available at <a href="http://www.h2database.com/html/roadmap.html"> http://www.h2database.com/html/roadmap.html </a> 

@history_1010_h2
History of this Database Engine

@history_1011_p
 The development of H2 was started in May 2004, but it was first published on December 14th 2005. The main author of H2, Thomas Mueller, is also the original developer of Hypersonic SQL. In 2001, he joined PointBase Inc. where he wrote PointBase Micro, a commercial Java SQL database. At that point, he had to discontinue Hypersonic SQL. The HSQLDB Group was formed to continued to work on the Hypersonic SQL codebase. The name H2 stands for Hypersonic 2, however H2 does not share code with Hypersonic SQL or HSQLDB. H2 is built from scratch. 

@history_1012_h2
Why Java

@history_1013_p
 The main reasons to use a Java database are: 

@history_1014_li
Very simple to integrate in Java applications 

@history_1015_li
Support for many different platforms 

@history_1016_li
More secure than native applications (no buffer overflows) 

@history_1017_li
User defined functions (or triggers) run very fast 

@history_1018_li
Unicode support 

@history_1019_p
 Some think Java is too slow for low level operations, but this is no longer true. Garbage collection for example is now faster than manual memory management. 

@history_1020_p
 Developing Java code is faster than developing C or C++ code. When using Java, most time can be spent on improving the algorithms instead of porting the code to different platforms or doing memory management. Features such as Unicode and network libraries are already built-in. In Java, writing secure code is easier because buffer overflows can not occur. Features such as reflection can be used for randomized testing. 

@history_1021_p
 Java is future proof: a lot of companies support Java. Java is now open source. 

@history_1022_p
 To increase the portability and ease of use, this software depends on very few libraries. Features that are not available in open source Java implementations (such as Swing) are not used, or only used for optional features. 

@history_1023_h2
Supporters

@history_1024_p
 Many thanks for those who reported bugs, gave valuable feedback, spread the word, and translated this project. Also many thanks to the donors: 

@history_1025_a
Code Lutin, France

@history_1026_a
Code 42 Software, Inc., Minneapolis

@history_1027_a
NetSuxxess GmbH, Germany

@history_1028_a
Poker Copilot, Steve McLeod, Germany

@history_1029_a
SkyCash, Poland

@history_1030_a
Lumber-mill, Inc., Japan

@history_1031_a
StockMarketEye, USA

@history_1032_li
Martin Wildam, Austria 

@history_1033_li
Donald Bleyl, USA 

@history_1034_li
Frank Berger, Germany 

@history_1035_li
Ashwin Jayaprakash, USA 

@history_1036_li
Florent Ramiere, France 

@history_1037_li
Jun Iyama, Japan 

@history_1038_li
Antonio Casqueiro, Portugal 

@history_1039_li
Oliver Computing LLC, USA 

@history_1040_li
Harpal Grover Consulting Inc., USA 

@history_1041_li
Elisabetta Berlini, Italy 

@history_1042_li
William Gilbert, USA 

@history_1043_li
Antonio Dieguez Rojas, Chile 

@history_1044_a
Ontology Works, USA

@history_1045_li
Pete Haidinyak, USA 

@history_1046_li
William Osmond, USA 

@history_1047_li
Joachim Ansorg, Germany 

@history_1048_li
Oliver Soerensen, Germany 

@history_1049_li
Christos Vasilakis, Greece 

@history_1050_li
Fyodor Kupolov, Denmark 

@history_1051_li
Jakob Jenkov, Denmark 

@history_1052_li
St&eacute;phane Chartrand, Switzerland 

@history_1053_li
Glenn Kidd, USA 

@history_1054_li
Gustav Trede, Sweden 

@history_1055_li
Joonas Pulakka, Finland 

@history_1056_li
Bjorn Darri Sigurdsson, Iceland 

@history_1057_li
Iyama Jun, Japan 

@history_1058_li
Gray Watson, USA 

@history_1059_li
Erik Dick, Germany 

@history_1060_li
Pengxiang Shao, China 

@history_1061_li
Bilingual Marketing Group, USA 

@history_1062_li
Philippe Marschall, Switzerland 

@history_1063_li
Knut Staring, Norway 

@history_1064_li
Theis Borg, Denmark 

@installation_1000_h1
Installation

@installation_1001_a
 Requirements

@installation_1002_a
 Supported Platforms

@installation_1003_a
 Installing the Software

@installation_1004_a
 Directory Structure

@installation_1005_h2
Requirements

@installation_1006_p
 To run this database, the following software stack is known to work. Other software most likely also works, but is not tested as much. 

@installation_1007_h3
Database Engine

@installation_1008_li
Windows XP or Vista, Mac OS X, or Linux 

@installation_1009_li
Sun JDK 1.5 or newer (using Retroweaver to convert to JDK 1.4 should work, but is not regularly tested) 

@installation_1010_li
Recommended Windows file system: NTFS (FAT32 only supports files up to 4 GB) 

@installation_1011_h3
H2 Console

@installation_1012_li
Mozilla Firefox 

@installation_1013_h2
Supported Platforms

@installation_1014_p
 As this database is written in Java, it can run on many different platforms. It is tested with Java 1.5 and 1.6 but can also be compiled to native code using GCJ. The source code does not use features of Java 1.6. Currently, the database is developed and tested on Windows XP and Mac OS X using the Sun JDK 1.6, but it also works in many other operating systems and using other Java runtime environments. All major operating systems (Windows XP, Windows Vista, Windows 7, Mac OS, Ubuntu,...) are supported. 

@installation_1015_h2
Installing the Software

@installation_1016_p
 To install the software, run the installer or unzip it to a directory of your choice. 

@installation_1017_h2
Directory Structure

@installation_1018_p
 After installing, you should get the following directory structure: 

@installation_1019_th
Directory

@installation_1020_th
Contents

@installation_1021_td
bin

@installation_1022_td
JAR and batch files

@installation_1023_td
docs

@installation_1024_td
Documentation

@installation_1025_td
docs/html

@installation_1026_td
HTML pages

@installation_1027_td
docs/javadoc

@installation_1028_td
Javadoc files

@installation_1029_td
ext

@installation_1030_td
External dependencies (downloaded when building)

@installation_1031_td
service

@installation_1032_td
Tools to run the database as a Windows Service

@installation_1033_td
src

@installation_1034_td
Source files

@installation_1035_td
src/docsrc

@installation_1036_td
Documentation sources

@installation_1037_td
src/installer

@installation_1038_td
Installer, shell, and release build script

@installation_1039_td
src/main

@installation_1040_td
Database engine source code

@installation_1041_td
src/test

@installation_1042_td
Test source code

@installation_1043_td
src/tools

@installation_1044_td
Tools and database adapters source code

@jaqu_1000_h1
JaQu

@jaqu_1001_a
 What is JaQu

@jaqu_1002_a
 Differences to Other Data Access Tools

@jaqu_1003_a
 Current State

@jaqu_1004_a
 Building the JaQu Library

@jaqu_1005_a
 Requirements

@jaqu_1006_a
 Example Code

@jaqu_1007_a
 Configuration

@jaqu_1008_a
 Natural Syntax

@jaqu_1009_a
 Other Ideas

@jaqu_1010_a
 Similar Projects

@jaqu_1011_h2
What is JaQu

@jaqu_1012_p
 JaQu stands for Java Query and allows to access databases using pure Java. JaQu provides a fluent interface (or internal DSL). JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a Microsoft .NET technology). The following JaQu code: 

@jaqu_1013_p
 stands for the SQL statement: 

@jaqu_1014_h2
Differences to Other Data Access Tools

@jaqu_1015_p
 Unlike SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java, auto-complete in the IDE is supported. Type checking is performed by the compiler. JaQu fully protects against SQL injection. 

@jaqu_1016_p
 JaQu is meant as replacement for JDBC and SQL and not as much as a replacement for tools like Hibernate. With JaQu, you don't write SQL statements as strings. JaQu is much smaller and simpler than other persistence frameworks such as Hibernate, but it also does not provide all the features of those. Unlike iBatis and Hibernate, no XML or annotation based configuration is required; instead the configuration (if required at all) is done in pure Java, within the application. 

@jaqu_1017_p
 JaQu does not require or contain any data caching mechanism. Like JDBC and iBatis, JaQu provides full control over when and what SQL statements are executed (but without having to write SQL statements as strings). 

@jaqu_1018_h3
Restrictions

@jaqu_1019_p
 Primitive types (eg. <code>boolean, int, long, double</code>) are not supported. Use <code>java.lang.Boolean, Integer, Long, Double</code> instead. 

@jaqu_1020_h3
Why in Java?

@jaqu_1021_p
 Most applications are written in Java. Mixing Java and another language (for example Scala or Groovy) in the same application is complicated: you would need to split the application and database code, and write adapter / wrapper code. 

@jaqu_1022_h2
Current State

@jaqu_1023_p
 Currently, JaQu is only tested with the H2 database. The API may change in future versions. JaQu is not part of the h2 jar file, however the source code is included in H2, under: 

@jaqu_1024_code
src/test/org/h2/test/jaqu/*

@jaqu_1025_li
 (samples and tests) 

@jaqu_1026_code
src/tools/org/h2/jaqu/*

@jaqu_1027_li
 (framework) 

@jaqu_1028_h2
Building the JaQu Library

@jaqu_1029_p
 To create the JaQu jar file, run: <code>build jarJaqu</code>. This will create the file <code>bin/h2jaqu.jar</code>. 

@jaqu_1030_h2
Requirements

@jaqu_1031_p
 JaQu requires Java 1.5. Annotations are not need. Currently, JaQu is only tested with the H2 database engine, however in theory it should work with any database that supports the JDBC API. 

@jaqu_1032_h2
Example Code

@jaqu_1033_h2
Configuration

@jaqu_1034_p
 JaQu does not require any configuration when using the default field to column mapping. To define table indices, or if you want to map a class to a table with a different name, or a field to a column with another name, create a function called <code>define</code> in the data class. Example: 

@jaqu_1035_p
 The method <code>define()</code> contains the mapping definition. It is called once when the class is used for the first time. Like annotations, the mapping is defined in the class itself. Unlike when using annotations, the compiler can check the syntax even for multi-column objects (multi-column indexes, multi-column primary keys and so on). Because the definition is written in Java, the configuration can be set at runtime, which is not possible using annotations. Unlike XML mapping configuration, the configuration is integrated in the class itself. 

@jaqu_1036_h2
Natural Syntax

@jaqu_1037_p
The plan is to support more natural (pure Java) syntax in conditions. To do that, the condition class is de-compiled to a SQL condition. A proof of concept decompiler is included (but it doesn't fully work yet; patches are welcome). The planned syntax is: 

@jaqu_1038_h2
Other Ideas

@jaqu_1039_p
 This project has just been started, and nothing is fixed yet. Some ideas are: 

@jaqu_1040_li
Support queries on collections (instead of using a database). 

@jaqu_1041_li
Provide API level compatibility with JPA (so that JaQu can be used as an extension of JPA). 

@jaqu_1042_li
Internally use a JPA implementation (for example Hibernate) instead of SQL directly. 

@jaqu_1043_li
Use PreparedStatements and cache them. 

@jaqu_1044_h2
Similar Projects

@jaqu_1045_a
Cement Framework

@jaqu_1046_a
Dreamsource ORM

@jaqu_1047_a
Empire-db

@jaqu_1048_a
JEQUEL: Java Embedded QUEry Language

@jaqu_1049_a
Joist

@jaqu_1050_a
JoSQL

@jaqu_1051_a
LIQUidFORM

@jaqu_1052_a
Quaere (Alias implementation)

@jaqu_1053_a
Quaere

@jaqu_1054_a
Querydsl

@jaqu_1055_a
Squill

@license_1000_h1
License

@license_1001_a
 Summary and License FAQ

@license_1002_a
 H2 License - Version 1.0

@license_1003_a
 Eclipse Public License - Version 1.0

@license_1004_h2
Summary and License FAQ

@license_1005_p
 H2 is dual licensed and available under a modified version of the MPL 1.1 (<a href="http://www.mozilla.org/MPL">Mozilla Public License</a>) or under the (unmodified) EPL 1.0 (<a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License</a>). The changes to the MPL are 

@license_1006_em
underlined</em>. There is a license FAQ for both the MPL and the EPL, most of that is applicable to the H2 license as well. 

@license_1007_li
You can use H2 for free. You can integrate it into your applications (including in commercial applications), and you can distribute it. 

@license_1008_li
Files containing only your code are not covered by this license (it is 'commercial friendly'). 

@license_1009_li
Modifications to the H2 source code must be published. 

@license_1010_li
You don't need to provide the source code of H2 if you did not modify anything. 

@license_1011_p
 However, nobody is allowed to rename H2, modify it a little, and sell it as a database engine without telling the customers it is in fact H2. This happened to HSQLDB: a company called 'bungisoft' copied HSQLDB, renamed it to 'RedBase', and tried to sell it, hiding the fact that it was in fact just HSQLDB. It seems 'bungisoft' does not exist any more, but you can use the <a href="http://www.archive.org">Wayback Machine</a> and visit old web pages of <code>http://www.bungisoft.com</code>. 

@license_1012_p
 About porting the source code to another language (for example C# or C++): converted source code (even if done manually) stays under the same copyright and license as the original code. The copyright of the ported source code does not (automatically) go to the person who ported the code. 

@license_1013_h2
H2 License - Version 1.0

@license_1014_h3
1. Definitions

@license_1015_b
1.0.1. "Commercial Use"

@license_1016_p
 means distribution or otherwise making the Covered Code available to a third party. 

@license_1017_b
1.1. "Contributor"

@license_1018_p
 means each entity that creates or contributes to the creation of Modifications. 

@license_1019_b
1.2. "Contributor Version"

@license_1020_p
 means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 

@license_1021_b
1.3. "Covered Code"

@license_1022_p
 means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 

@license_1023_b
1.4. "Electronic Distribution Mechanism"

@license_1024_p
 means a mechanism generally accepted in the software development community for the electronic transfer of data. 

@license_1025_b
1.5. "Executable"

@license_1026_p
 means Covered Code in any form other than Source Code. 

@license_1027_b
1.6. "Initial Developer"

@license_1028_p
 means the individual or entity identified as the Initial Developer in the Source Code notice required by <a href="#exhibit-a">Exhibit A</a>. 

@license_1029_b
1.7. "Larger Work"

@license_1030_p
 means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 

@license_1031_b
1.8. "License"

@license_1032_p
 means this document. 

@license_1033_b
1.8.1. "Licensable"

@license_1034_p
 means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 

@license_1035_b
1.9. "Modifications"

@license_1036_p
 means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: 

@license_1037_p
1.9.a. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. 

@license_1038_p
1.9.b. Any new file that contains any part of the Original Code or previous Modifications. 

@license_1039_b
1.10. "Original Code"

@license_1040_p
 means Source Code of computer software code which is described in the Source Code notice required by <a href="#exhibit-a">Exhibit A</a> as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 

@license_1041_b
1.10.1. "Patent Claims"

@license_1042_p
 means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 

@license_1043_b
1.11. "Source Code"

@license_1044_p
 means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 

@license_1045_b
1.12. "You" (or "Your")

@license_1046_p
 means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under <a href="#section-6.1">Section 6.1.</a> For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 

@license_1047_h3
2. Source Code License

@license_1048_h4
2.1. The Initial Developer Grant

@license_1049_p
 The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: 

@license_1050_p
2.1.a. under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and 

@license_1051_p
2.1.b. under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). 

@license_1052_p
2.1.c. the licenses granted in this Section 2.1 (<a href="#section-2.1-a">a</a>) and (<a href="#section-2.1-b">b</a>) are effective on the date Initial Developer first distributes Original Code under the terms of this License. 

@license_1053_p
2.1.d. Notwithstanding Section 2.1 (<a href="#section-2.1-b">b</a>) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 

@license_1054_h4
2.2. Contributor Grant

@license_1055_p
 Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license 

@license_1056_p
2.2.a. under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and 

@license_1057_p
2.2.b. under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). 

@license_1058_p
2.2.c. the licenses granted in Sections 2.2 (<a href="#section-2.2-a">a</a>) and 2.2 (<a href="#section-2.2-b">b</a>) are effective on the date Contributor first makes Commercial Use of the Covered Code. 

@license_1059_p
2.2.c. Notwithstanding Section 2.2 (<a href="#section-2.2-b">b</a>) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 

@license_1060_h3
3. Distribution Obligations

@license_1061_h4
3.1. Application of License

@license_1062_p
 The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section <a href="#section-2.2">2.2</a>. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section <a href="#section-6.1">6.1</a>, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section <a href="#section-3.5">3.5</a>. 

@license_1063_h4
3.2. Availability of Source Code

@license_1064_p
 Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 

@license_1065_h4
3.3. Description of Modifications

@license_1066_p
 You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 

@license_1067_h4
3.4. Intellectual Property Matters

@license_1068_b
3.4.a. Third Party Claims:

@license_1069_p
 If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections <a href="#section-2.1">2.1</a> or <a href="#section-2.2">2.2</a>, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section <a href="#section-3.2">3.2</a>, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. 

@license_1070_b
3.4.b. Contributor APIs:

@license_1071_p
 If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the legal file. 

@license_1072_b
3.4.c. Representations:

@license_1073_p
 Contributor represents that, except as disclosed pursuant to Section 3.4 (<a href="#section-3.4-a">a</a>) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 

@license_1074_h4
3.5. Required Notices

@license_1075_p
 You must duplicate the notice in <a href="#exhibit-a">Exhibit A</a> in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in <a href="#exhibit-a">Exhibit A</a>. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 

@license_1076_h4
3.6. Distribution of Executable Versions

@license_1077_p
 You may distribute Covered Code in Executable form only if the requirements of Sections <a href="#section-3.1">3.1</a>, <a href="#section-3.2">3.2</a>, <a href="#section-3.3">3.3</a>, <a href="#section-3.4">3.4</a> and <a href="#section-3.5">3.5</a> have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section <a href="#section-3.2">3.2</a>. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. 

@license_1078_h4
3.7. Larger Works

@license_1079_p
 You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 

@license_1080_h3
4. Inability to Comply Due to Statute or Regulation.

@license_1081_p
 If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the <b>legal</b> file described in Section <a href="#section-3.4">3.4</a> and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 

@license_1082_h3
5. Application of this License.

@license_1083_p
 This License applies to code to which the Initial Developer has attached the notice in <a href="#exhibit-a">Exhibit A</a> and to related Covered Code. 

@license_1084_h3
6. Versions of the License.

@license_1085_h4
6.1. New Versions

@license_1086_p
 The 

@license_1087_em
H2 Group</em> may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 

@license_1088_h4
6.2. Effect of New Versions

@license_1089_p
 Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by the 

@license_1090_em
H2 Group</em>. No one other than the 

@license_1091_em
H2 Group</em> has the right to modify the terms applicable to Covered Code created under this License. 

@license_1092_h4
6.3. Derivative Works

@license_1093_p
 If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases 

@license_1094_em
"H2 Group", "H2"</em> or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the 

@license_1095_em
H2 License</em>. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in <a href="#exhibit-a">Exhibit A</a> shall not of themselves be deemed to be modifications of this License.) 

@license_1096_h3
7. Disclaimer of Warranty

@license_1097_p
 Covered code is provided under this license on an "as is" basis, without warranty of any kind, either expressed or implied, including, without limitation, warranties that the covered code is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the covered code is with you. Should any covered code prove defective in any respect, you (not the initial developer or any other contributor) assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty constitutes an essential part of this license. No use of any covered code is authorized hereunder except under this disclaimer. 

@license_1098_h3
8. Termination

@license_1099_p
8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 

@license_1100_p
8.2. If You initiate litigation by asserting a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: 

@license_1101_p
8.2.a. such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections <a href="#section-2.1">2.1</a> and/or <a href="#section-2.2">2.2</a> of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections <a href="#section-2.1">2.1</a> and/or <a href="#section-2.2">2.2</a> automatically terminate at the expiration of the 60 day notice period specified above. 

@license_1102_p
8.2.b. any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(<a href="#section-2.1-b">b</a>) and 2.2(<a href="#section-2.2-b">b</a>) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 

@license_1103_p
8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections <a href="#section-2.1">2.1</a> or <a href="#section-2.2">2.2</a> shall be taken into account in determining the amount or value of any payment or license. 

@license_1104_p
8.4. In the event of termination under Sections <a href="#section-8.1">8.1</a> or <a href="#section-8.2">8.2</a> above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 

@license_1105_h3
9. Limitation of Liability

@license_1106_p
 Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall you, the initial developer, any other contributor, or any distributor of covered code, or any supplier of any of such parties, be liable to any person for any indirect, special, incidental, or consequential damages of any character including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to you. 

@license_1107_h3
10. United States Government End Users

@license_1108_p
 The Covered Code is a "commercial item", as that term is defined in 48 C.F.R. 2.101 (October 1995), consisting of "commercial computer software" and "commercial computer software documentation", as such terms are used in 48 C.F.R. 12.212 (September 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 

@license_1109_h3
11. Miscellaneous

@license_1110_p
 This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 

@license_1111_h3
12. Responsibility for Claims

@license_1112_p
 As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 

@license_1113_h3
13. Multiple-Licensed Code

@license_1114_p
 Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of this or the alternative licenses, if any, specified by the Initial Developer in the file described in <a href="#exhibit-a">Exhibit A</a>. 

@license_1115_h3
Exhibit A

@license_1116_h2
Eclipse Public License - Version 1.0

@license_1117_p
 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 

@license_1118_h3
1. DEFINITIONS

@license_1119_p
 "Contribution" means: 

@license_1120_p
 a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and 

@license_1121_p
 b) in the case of each subsequent Contributor: 

@license_1122_p
 i) changes to the Program, and 

@license_1123_p
 ii) additions to the Program; 

@license_1124_p
 where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. 

@license_1125_p
 "Contributor" means any person or entity that distributes the Program. 

@license_1126_p
 "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. 

@license_1127_p
 "Program" means the Contributions distributed in accordance with this Agreement. 

@license_1128_p
 "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 

@license_1129_h3
2. GRANT OF RIGHTS

@license_1130_p
 a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. 

@license_1131_p
 b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. 

@license_1132_p
 c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. 

@license_1133_p
 d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 

@license_1134_h3
3. REQUIREMENTS

@license_1135_p
 A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: 

@license_1136_p
 a) it complies with the terms and conditions of this Agreement; and 

@license_1137_p
 b) its license agreement: 

@license_1138_p
 i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; 

@license_1139_p
 ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; 

@license_1140_p
 iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and 

@license_1141_p
 iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. 

@license_1142_p
 When the Program is made available in source code form: 

@license_1143_p
 a) it must be made available under this Agreement; and 

@license_1144_p
 b) a copy of this Agreement must be included with each copy of the Program. 

@license_1145_p
 Contributors may not remove or alter any copyright notices contained within the Program. 

@license_1146_p
 Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 

@license_1147_h3
4. COMMERCIAL DISTRIBUTION

@license_1148_p
 Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. 

@license_1149_p
 For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 

@license_1150_h3
5. NO WARRANTY

@license_1151_p
 EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 

@license_1152_h3
6. DISCLAIMER OF LIABILITY

@license_1153_p
 EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 

@license_1154_h3
7. GENERAL

@license_1155_p
 If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. 

@license_1156_p
 If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. 

@license_1157_p
 All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. 

@license_1158_p
 Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. 

@license_1159_p
 This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. 

@links_1000_h1
H2 In Use and Links

@links_1001_p
 Listed below are just a few links to products using or supporting H2. If you want to add a link, please send it to the support email address or post it to the group. 

@links_1002_a
 Books

@links_1003_a
 Extensions

@links_1004_a
 Blog Articles

@links_1005_a
 Database Frontends / Tools

@links_1006_a
 Products and Projects

@links_1007_h2
Books

@links_1008_a
 Seam In Action

@links_1009_h2
Extensions

@links_1010_a
 Grails H2 Database Plugin

@links_1011_a
 h2osgi: OSGi for the H2 Database

@links_1012_a
 H2Sharp: ADO.NET interface for the H2 database engine

@links_1013_a
 H2 Spatial: spatial functions to H2 database

@links_1014_h2
Blog Articles

@links_1015_a
 Analyzing CSVs with H2 in under 10 minutes (2009-12-07)

@links_1016_a
 Efficient sorting and iteration on large databases (2009-06-15)

@links_1017_a
 Porting Flexive to the H2 Database (2008-12-05)

@links_1018_a
 H2 Database with GlassFish (2008-11-24)

@links_1019_a
 Using H2 Database with Glassfish and Toplink (2008-08-07)

@links_1020_a
 H2 Database - Performance Tracing (2008-04-30)

@links_1021_a
 Testing your JDBC data access layer with DBUnit and H2 (2007-09-18)

@links_1022_a
 Open Source Databases Comparison (2007-09-11)

@links_1023_a
 The Codist: The Open Source Frameworks I Use (2007-07-23)

@links_1024_a
 The Codist: SQL Injections: How Not To Get Stuck (2007-05-08)

@links_1025_a
 One Man Band: (Helma + H2) == "to easy" (2007-03-11)

@links_1026_a
 David Coldrick's Weblog: New Version of H2 Database Released (2007-01-06)

@links_1027_a
 The Codist: Write Your Own Database, Again (2006-11-13)

@links_1028_h2
Project Pages

@links_1029_a
 Ohloh

@links_1030_a
 Freshmeat Project Page

@links_1031_a
 Free Open Source Software For Us

@links_1032_a
 Wikipedia

@links_1033_a
 Java Source Net

@links_1034_a
 Linux Package Manager

@links_1035_h2
Database Frontends / Tools

@links_1036_a
 DB Solo

@links_1037_p
 SQL query tool. 

@links_1038_a
 DbVisualizer

@links_1039_p
 Database tool. 

@links_1040_a
 Execute Query

@links_1041_p
 Database utility written in Java. 

@links_1042_a
 [fleXive]

@links_1043_p
 JavaEE 5 open source framework for the development of complex and evolving (web-)applications. 

@links_1044_a
 HenPlus

@links_1045_p
 HenPlus is a SQL shell written in Java. 

@links_1046_a
 OpenOffice

@links_1047_p
 Base is OpenOffice.org's database application. It provides access to relational data sources. 

@links_1048_a
 RazorSQL

@links_1049_p
 An SQL query tool, database browser, SQL editor, and database administration tool. 

@links_1050_a
 SQL Developer

@links_1051_p
 Universal Database Frontend. 

@links_1052_a
 SQL Workbench/J

@links_1053_p
 Free DBMS-independent SQL tool. 

@links_1054_a
 SQuirreL SQL Client

@links_1055_p
 Graphical tool to view the structure of a database, browse the data, issue SQL commands etc. 

@links_1056_a
 SQuirreL DB Copy Plugin

@links_1057_p
 Tool to copy data from one database to another. 

@links_1058_h2
Products and Projects

@links_1059_a
 AccuProcess

@links_1060_p
 Visual business process modeling and simulation software for business users. 

@links_1061_a
 Adeptia BPM

@links_1062_p
 A Business Process Management (BPM) suite to quickly and easily automate business processes and workflows. 

@links_1063_a
 Adeptia Integration

@links_1064_p
 Process-centric, services-based application integration suite. 

@links_1065_a
 Aejaks

@links_1066_p
 A server-side scripting environment to build AJAX enabled web applications. 

@links_1067_a
 Axiom Stack

@links_1068_p
 A web framework that let's you write dynamic web applications with Zen-like simplicity. 

@links_1069_a
 Apache Cayenne

@links_1070_p
 Open source persistence framework providing object-relational mapping (ORM) and remoting services. 

@links_1071_a
 Apache Jackrabbit

@links_1072_p
 Open source implementation of the Java Content Repository API (JCR). 

@links_1073_a
 Apache OpenJPA

@links_1074_p
 Open source implementation of the Java Persistence API (JPA). 

@links_1075_a
 AppFuse

@links_1076_p
 Helps building web applications. 

@links_1077_a
 BGBlitz

@links_1078_p
 The Swiss army knife of Backgammon. 

@links_1079_a
 Blojsom

@links_1080_p
 Java-based multi-blog, multi-user software package (Mac OS X Weblog Server). 

@links_1081_a
 Bonita

@links_1082_p
 Open source workflow solution for handing long-running, user-oriented processes providing out of the box workflow and business process management features. 

@links_1083_a
 Bookmarks Portlet

@links_1084_p
 JSR 168 compliant bookmarks management portlet application. 

@links_1085_a
 Claros inTouch

@links_1086_p
 Ajax communication suite with mail, addresses, notes, IM, and rss reader. 

@links_1087_a
 CrashPlan PRO Server

@links_1088_p
 Easy and cross platform backup solution for business and service providers. 

@links_1089_a
 DbUnit

@links_1090_p
 A JUnit extension (also usable with Ant) targeted for database-driven projects. 

@links_1091_a
 DiffKit

@links_1092_p
 DiffKit is a tool for comparing two tables of data, field-by-field. DiffKit is like the Unix diff utility, but for tables instead of lines of text. 

@links_1093_a
 Dinamica Framework

@links_1094_p
 Ajax/J2EE framework for RAD development (mainly oriented toward hispanic markets). 

@links_1095_a
 District Health Information Software 2 (DHIS)

@links_1096_p
 The DHIS 2 is a tool for collection, validation, analysis, and presentation of aggregate statistical data, tailored (but not limited) to integrated health information management activities. 

@links_1097_a
 Ebean ORM Persistence Layer

@links_1098_p
 Open source Java Object Relational Mapping tool. 

@links_1099_a
 Eclipse CDO

@links_1100_p
 The CDO (Connected Data Objects) Model Repository is a distributed shared model framework for EMF models, and a fast server-based O/R mapping solution. 

@links_1101_a
 Epictetus

@links_1102_p
 Free cross platform database tool. 

@links_1103_a
 Fabric3

@links_1104_p
 Fabric3 is a project implementing a federated service network based on the Service Component Architecture specification (http://www.osoa.org). 

@links_1105_a
 FIT4Data

@links_1106_p
 A testing framework for data management applications built on the Java implementation of FIT. 

@links_1107_a
 Flux

@links_1108_p
 Java job scheduler, file transfer, workflow, and BPM. 

@links_1109_a
 GeoServer

@links_1110_p
 GeoServer is a Java-based software server that allows users to view and edit geospatial data. Using open standards set forth by the Open Geospatial Consortium (OGC), GeoServer allows for great flexibility in map creation and data sharing. 

@links_1111_a
 GBIF Integrated Publishing Toolkit (IPT)

@links_1112_p
 The GBIF IPT is an open source, Java based web application that connects and serves three types of biodiversity data: taxon primary occurrence data, taxon checklists and general resource metadata. 

@links_1113_a
 GNU Gluco Control

@links_1114_p
 Helps you to manage your diabetes. 

@links_1115_a
 Golden T Studios

@links_1116_p
 Fun-to-play games with a simple interface. 

@links_1117_a
 Group Session

@links_1118_p
 Open source web groupware. 

@links_1119_a
 HA-JDBC

@links_1120_p
 High-Availability JDBC: A JDBC proxy that provides light-weight, transparent, fault tolerant clustering capability to any underlying JDBC driver. 

@links_1121_a
 Harbor

@links_1122_p
 Pojo Application Server. 

@links_1123_a
 Hibernate

@links_1124_p
 Relational persistence for idiomatic Java (O-R mapping tool). 

@links_1125_a
 Hibicius

@links_1126_p
 Online Banking Client for the HBCI protocol. 

@links_1127_a
 ImageMapper

@links_1128_p
 ImageMapper frees users from having to use file browsers to view their images. They get fast access to images and easy cataloguing of them via a user friendly interface. 

@links_1129_a
 JAMWiki

@links_1130_p
 Java-based Wiki engine. 

@links_1131_a
 Jala

@links_1132_p
 Open source collection of JavaScript modules. 

@links_1133_a
 Java Simon

@links_1134_p
 Simple Monitoring API. 

@links_1135_a
 JBoss jBPM

@links_1136_p
 A platform for executable process languages ranging from business process management (BPM) over workflow to service orchestration. 

@links_1137_a
 JBoss Jopr

@links_1138_p
 An enterprise management solution for JBoss middleware projects and other application technologies. 

@links_1139_a
 JGeocoder

@links_1140_p
 Free Java geocoder. Geocoding is the process of estimating a latitude and longitude for a given location. 

@links_1141_a
 JGrass

@links_1142_p
 Java Geographic Resources Analysis Support System. Free, multi platform, open source GIS based on the GIS framework of uDig. 

@links_1143_a
 Jena

@links_1144_p
 Java framework for building Semantic Web applications. 

@links_1145_a
 JMatter

@links_1146_p
 Framework for constructing workgroup business applications based on the Naked Objects Architectural Pattern. 

@links_1147_a
 jOOQ (Java Object Oriented Querying)

@links_1148_p
 jOOQ takes your database schema as a base for code generation. 

@links_1149_a
 JotBot

@links_1150_p
 Records your day at user defined intervals. 

@links_1151_a
 JPOX

@links_1152_p
 Java persistent objects. 

@links_1153_a
 Liftweb

@links_1154_p
 A Scala-based, secure, developer friendly web framework. 

@links_1155_a
 LiquiBase

@links_1156_p
 A tool to manage database changes and refactorings. 

@links_1157_a
 Luntbuild

@links_1158_p
 Build automation and management tool. 

@links_1159_a
 localdb

@links_1160_p
 A tool that locates the full file path of the folder containing the database files. 

@links_1161_a
 Magnolia

@links_1162_p
 Microarray Data Management and Export System for PFGRC (Pathogen Functional Genomics Resource Center) Microarrays. 

@links_1163_a
 MiniConnectionPoolManager

@links_1164_p
 A lightweight standalone JDBC connection pool manager. 

@links_1165_a
 Mr. Persister

@links_1166_p
 Simple, small and fast object relational mapping. 

@links_1167_a
 Myna Application Server

@links_1168_p
 Java web app that provides dynamic web content and Java libraries access from JavaScript. 

@links_1169_a
 MyTunesRss

@links_1170_p
 MyTunesRSS lets you listen to your music wherever you are. 

@links_1171_a
 NCGC CurveFit

@links_1172_p
 From: NIH Chemical Genomics Center, National Institutes of Health, USA. An open source application in the life sciences research field. This application handles chemical structures and biological responses of thousands of compounds with the potential to handle million+ compounds. It utilizes an embedded H2 database to enable flexible query/retrieval of all data including advanced chemical substructure and similarity searching. The application highlights an automated curve fitting and classification algorithm that outperforms commercial packages in the field. Commercial alternatives are typically small desktop software that handle a few dose response curves at a time. A couple of commercial packages that do handle several thousand curves are very expensive tools (&gt;60k USD) that require manual curation of analysis by the user; require a license to Oracle; lack advanced query/retrieval; and the ability to handle chemical structures. 

@links_1173_a
 Nuxeo

@links_1174_p
 Standards-based, open source platform for building ECM applications. 

@links_1175_a
 nWire

@links_1176_p
 Eclipse plug-in which expedites Java development. It's main purpose is to help developers find code quicker and easily understand how it relates to the rest of the application, thus, understand the application structure. 

@links_1177_a
 Ontology Works

@links_1178_p
 This company provides semantic technologies including deductive information repositories (the Ontology Works Knowledge Servers), semantic information fusion and semantic federation of legacy databases, ontology-based domain modeling, and management of the distributed enterprise. 

@links_1179_a
 Ontoprise OntoBroker

@links_1180_p
 SemanticWeb-Middleware. It supports all W3C Semantic Web recommendations: OWL, RDF, RDFS, SPARQL, and F-Logic. 

@links_1181_a
 Open Anzo

@links_1182_p
 Semantic Application Server. 

@links_1183_a
 OpenTelegard

@links_1184_p
 An OpenSource BBS Software written in JRuby. 

@links_1185_a
 OpenGroove

@links_1186_p
 OpenGroove is a groupware program that allows users to synchronize data. 

@links_1187_a
 OpenSocial Development Environment (OSDE)

@links_1188_p
 Development tool for OpenSocial application. 

@links_1189_a
 Orion

@links_1190_p
 J2EE Application Server. 

@links_1191_a
 P5H2

@links_1192_p
 A library for the <a href="http://www.processing.org">Processing</a> programming language and environment. 

@links_1193_a
 Phase-6

@links_1194_p
 A computer based learning software. 

@links_1195_a
 Pickle

@links_1196_p
 Pickle is a Java library containing classes for persistence, concurrency, and logging. 

@links_1197_a
 Piman

@links_1198_p
 Water treatment projects data management. 

@links_1199_a
 PolePosition

@links_1200_p
 Open source database benchmark. 

@links_1201_a
 Poormans

@links_1202_p
 Very basic CMS running as a SWT application and generating static html pages. 

@links_1203_a
 Railo

@links_1204_p
 Railo is an alternative engine for the Cold Fusion Markup Language, that compiles code programmed in CFML into Java bytecode and executes it on a servlet engine. 

@links_1205_a
 Razuna

@links_1206_p
 Open source Digital Asset Management System with integrated Web Content Management. 

@links_1207_a
 RIFE

@links_1208_p
 A full-stack web application framework with tools and APIs to implement most common web features. 

@links_1209_a
 Rutema

@links_1210_p
 Rutema is a test execution and management tool for heterogeneous development environments written in Ruby. 

@links_1211_a
 Sava

@links_1212_p
 Open-source web-based content management system. 

@links_1213_a
 Scriptella

@links_1214_p
 ETL (Extract-Transform-Load) and script execution tool. 

@links_1215_a
 Sesar

@links_1216_p
 Dependency Injection Container with Aspect Oriented Programming. 

@links_1217_a
 SemmleCode

@links_1218_p
 Eclipse plugin to help you improve software quality. 

@links_1219_a
 SeQuaLite

@links_1220_p
 A free, light-weight, java data access framework. 

@links_1221_a
 ShapeLogic

@links_1222_p
 Toolkit for declarative programming, image processing and computer vision. 

@links_1223_a
 Shellbook

@links_1224_p
 Desktop publishing application. 

@links_1225_a
 Signsoft intelliBO

@links_1226_p
 Persistence middleware supporting the JDO specification. 

@links_1227_a
 SimpleORM

@links_1228_p
 Simple Java Object Relational Mapping. 

@links_1229_a
 SymmetricDS

@links_1230_p
 A web-enabled, database independent, data synchronization/replication software. 

@links_1231_a
 SmartFoxServer

@links_1232_p
 Platform for developing multiuser applications and games with Macromedia Flash. 

@links_1233_a
 Social Bookmarks Friend Finder

@links_1234_p
 A GUI application that allows you to find users with similar bookmarks to the user specified (for delicious.com). 

@links_1235_a
 Springfuse

@links_1236_p
 Code generation For Spring, Spring MVC &amp; Hibernate. 

@links_1237_a
 SQLOrm

@links_1238_p
 Java Object Relation Mapping. 

@links_1239_a
 StorYBook

@links_1240_p
 A summary-based tool for novelist and script writers. It helps to keep the overview over the various traces a story has. 

@links_1241_a
 StreamCruncher

@links_1242_p
 Event (stream) processing kernel. 

@links_1243_a
 Tune Backup

@links_1244_p
 Easy-to-use backup solution for your iTunes library. 

@links_1245_a
 weblica

@links_1246_p
 Desktop CMS. 

@links_1247_a
 Web of Web

@links_1248_p
 Collaborative and realtime interactive media platform for the web. 

@links_1249_a
 Werkzeugkasten

@links_1250_p
 Minimum Java Toolset. 

@links_1251_a
 VPDA

@links_1252_p
 View providers driven applications is a Java based application framework for building applications composed from server components - view providers. 

@links_1253_a
 Volunteer database

@links_1254_p
 A database front end to register volunteers, partnership and donation for a Non Profit organization. 

@mainWeb_1000_h1
H2 Database Engine

@mainWeb_1001_p
 Welcome to H2, the Java SQL database. The main features of H2 are: 

@mainWeb_1002_li
Very fast, open source, JDBC API 

@mainWeb_1003_li
Embedded and server modes; in-memory databases 

@mainWeb_1004_li
Browser based Console application 

@mainWeb_1005_li
Small footprint: around 1 MB jar file size 

@mainWeb_1006_h2
Download

@mainWeb_1007_td
 Version 1.3.148 (2010-12-12), Beta 

@mainWeb_1008_a
Windows Installer (4 MB)

@mainWeb_1009_a
All Platforms (zip, 5 MB)

@mainWeb_1010_a
All Downloads

@mainWeb_1011_td
&nbsp;&nbsp;&nbsp;

@mainWeb_1012_h2
Support

@mainWeb_1013_a
Google Group English

@mainWeb_1014_p
, <a href="http://groups.google.co.jp/group/h2-database-jp">Japanese</a>

@mainWeb_1015_a
Stack Overflow (tag H2)

@mainWeb_1016_p
 For non-technical issues, use: 

@mainWeb_1017_h2
Features

@mainWeb_1018_th
H2

@mainWeb_1019_a
Derby

@mainWeb_1020_a
HSQLDB

@mainWeb_1021_a
MySQL

@mainWeb_1022_a
PostgreSQL

@mainWeb_1023_td
Pure Java

@mainWeb_1024_td
Yes

@mainWeb_1025_td
Yes

@mainWeb_1026_td
Yes

@mainWeb_1027_td
No

@mainWeb_1028_td
No

@mainWeb_1029_td
Memory Mode

@mainWeb_1030_td
Yes

@mainWeb_1031_td
Yes

@mainWeb_1032_td
Yes

@mainWeb_1033_td
No

@mainWeb_1034_td
No

@mainWeb_1035_td
Encrypted Database

@mainWeb_1036_td
Yes

@mainWeb_1037_td
Yes

@mainWeb_1038_td
Yes

@mainWeb_1039_td
No

@mainWeb_1040_td
No

@mainWeb_1041_td
ODBC Driver

@mainWeb_1042_td
Yes

@mainWeb_1043_td
No

@mainWeb_1044_td
No

@mainWeb_1045_td
Yes

@mainWeb_1046_td
Yes

@mainWeb_1047_td
Fulltext Search

@mainWeb_1048_td
Yes

@mainWeb_1049_td
No

@mainWeb_1050_td
No

@mainWeb_1051_td
Yes

@mainWeb_1052_td
Yes

@mainWeb_1053_td
Multi Version Concurrency

@mainWeb_1054_td
Yes

@mainWeb_1055_td
No

@mainWeb_1056_td
Yes

@mainWeb_1057_td
Yes

@mainWeb_1058_td
Yes

@mainWeb_1059_td
Footprint (jar/dll size)

@mainWeb_1060_td
~1 MB

@mainWeb_1061_td
~2 MB

@mainWeb_1062_td
~1 MB

@mainWeb_1063_td
~4 MB

@mainWeb_1064_td
~6 MB

@mainWeb_1065_p
 See also the <a href="features.html#comparison">detailed comparison</a>. 

@mainWeb_1066_h2
News

@mainWeb_1067_b
Newsfeeds:

@mainWeb_1068_a
Full text (Atom)

@mainWeb_1069_p
 or <a href="http://www.h2database.com/html/newsfeed-rss.xml">Header only (RSS)</a>. 

@mainWeb_1070_b
Email Newsletter:

@mainWeb_1071_p
 Subscribe to <a href="http://groups.google.com/group/h2database-news/subscribe"> H2 Database News (Google account required)</a> to get informed about new releases. Your email address is only used in this context. 

@mainWeb_1072_td
&nbsp;

@mainWeb_1073_h2
Contribute

@mainWeb_1074_p
 You can contribute to the development of H2 by sending feedback and bug reports, or translate the H2 Console application (for details, start the H2 Console and select Options / Translate). To donate money, click on the PayPal button below. You will be listed as a supporter: 

@main_1000_h1
H2 Database Engine

@main_1001_p
 Welcome to H2, the free Java SQL database engine. 

@main_1002_a
Quickstart

@main_1003_p
 Get a fast overview. 

@main_1004_a
Tutorial

@main_1005_p
 Go through the samples. 

@main_1006_a
Features

@main_1007_p
 See what this database can do and how to use these features. 

@performance_1000_h1
Performance

@performance_1001_a
 Performance Comparison

@performance_1002_a
 PolePosition Benchmark

@performance_1003_a
 Database Performance Tuning

@performance_1004_a
 Using the Built-In Profiler

@performance_1005_a
 Application Profiling

@performance_1006_a
 Database Profiling

@performance_1007_a
 Statement Execution Plans

@performance_1008_a
 Fast Database Import

@performance_1009_h2
Performance Comparison

@performance_1010_p
 In many cases H2 is faster than other (open source and not open source) database engines. Please note this is mostly a single connection benchmark run on one computer. 

@performance_1011_h3
Embedded

@performance_1012_th
Test Case

@performance_1013_th
Unit

@performance_1014_th
H2

@performance_1015_th
HSQLDB

@performance_1016_th
Derby

@performance_1017_td
Simple: Init

@performance_1018_td
ms

@performance_1019_td
241

@performance_1020_td
431

@performance_1021_td
1027

@performance_1022_td
Simple: Query (random)

@performance_1023_td
ms

@performance_1024_td
193

@performance_1025_td
267

@performance_1026_td
748

@performance_1027_td
Simple: Query (sequential)

@performance_1028_td
ms

@performance_1029_td
89

@performance_1030_td
179

@performance_1031_td
658

@performance_1032_td
Simple: Update (random)

@performance_1033_td
ms

@performance_1034_td
406

@performance_1035_td
772

@performance_1036_td
12175

@performance_1037_td
Simple: Delete (sequential)

@performance_1038_td
ms

@performance_1039_td
155

@performance_1040_td
266

@performance_1041_td
6281

@performance_1042_td
Simple: Memory Usage

@performance_1043_td
MB

@performance_1044_td
7

@performance_1045_td
13

@performance_1046_td
16

@performance_1047_td
BenchA: Init

@performance_1048_td
ms

@performance_1049_td
200

@performance_1050_td
251

@performance_1051_td
1075

@performance_1052_td
BenchA: Transactions

@performance_1053_td
ms

@performance_1054_td
1071

@performance_1055_td
1458

@performance_1056_td
8142

@performance_1057_td
BenchA: Memory Usage

@performance_1058_td
MB

@performance_1059_td
8

@performance_1060_td
14

@performance_1061_td
12

@performance_1062_td
BenchB: Init

@performance_1063_td
ms

@performance_1064_td
787

@performance_1065_td
1584

@performance_1066_td
4163

@performance_1067_td
BenchB: Transactions

@performance_1068_td
ms

@performance_1069_td
465

@performance_1070_td
875

@performance_1071_td
2744

@performance_1072_td
BenchB: Memory Usage

@performance_1073_td
MB

@performance_1074_td
17

@performance_1075_td
13

@performance_1076_td
10

@performance_1077_td
BenchC: Init

@performance_1078_td
ms

@performance_1079_td
348

@performance_1080_td
225

@performance_1081_td
922

@performance_1082_td
BenchC: Transactions

@performance_1083_td
ms

@performance_1084_td
1382

@performance_1085_td
865

@performance_1086_td
3527

@performance_1087_td
BenchC: Memory Usage

@performance_1088_td
MB

@performance_1089_td
12

@performance_1090_td
20

@performance_1091_td
11

@performance_1092_td
Executed statements

@performance_1093_td
#

@performance_1094_td
322929

@performance_1095_td
322929

@performance_1096_td
322929

@performance_1097_td
Total time

@performance_1098_td
ms

@performance_1099_td
5337

@performance_1100_td
7173

@performance_1101_td
41462

@performance_1102_td
Statements per second

@performance_1103_td
#

@performance_1104_td
60507

@performance_1105_td
45020

@performance_1106_td
7788

@performance_1107_h3
Client-Server

@performance_1108_th
Test Case

@performance_1109_th
Unit

@performance_1110_th
H2

@performance_1111_th
HSQLDB

@performance_1112_th
Derby

@performance_1113_th
PostgreSQL

@performance_1114_th
MySQL

@performance_1115_td
Simple: Init

@performance_1116_td
ms

@performance_1117_td
1715

@performance_1118_td
2096

@performance_1119_td
3008

@performance_1120_td
3093

@performance_1121_td
3084

@performance_1122_td
Simple: Query (random)

@performance_1123_td
ms

@performance_1124_td
2615

@performance_1125_td
2119

@performance_1126_td
4450

@performance_1127_td
3201

@performance_1128_td
3313

@performance_1129_td
Simple: Query (sequential)

@performance_1130_td
ms

@performance_1131_td
2531

@performance_1132_td
1944

@performance_1133_td
4019

@performance_1134_td
3163

@performance_1135_td
3295

@performance_1136_td
Simple: Update (random)

@performance_1137_td
ms

@performance_1138_td
1862

@performance_1139_td
2486

@performance_1140_td
13929

@performance_1141_td
4404

@performance_1142_td
4391

@performance_1143_td
Simple: Delete (sequential)

@performance_1144_td
ms

@performance_1145_td
778

@performance_1146_td
1118

@performance_1147_td
7032

@performance_1148_td
1682

@performance_1149_td
1882

@performance_1150_td
Simple: Memory Usage

@performance_1151_td
MB

@performance_1152_td
8

@performance_1153_td
14

@performance_1154_td
18

@performance_1155_td
1

@performance_1156_td
2

@performance_1157_td
BenchA: Init

@performance_1158_td
ms

@performance_1159_td
1264

@performance_1160_td
1686

@performance_1161_td
2734

@performance_1162_td
2867

@performance_1163_td
3225

@performance_1164_td
BenchA: Transactions

@performance_1165_td
ms

@performance_1166_td
5998

@performance_1167_td
6829

@performance_1168_td
14323

@performance_1169_td
11491

@performance_1170_td
10571

@performance_1171_td
BenchA: Memory Usage

@performance_1172_td
MB

@performance_1173_td
9

@performance_1174_td
18

@performance_1175_td
14

@performance_1176_td
1

@performance_1177_td
2

@performance_1178_td
BenchB: Init

@performance_1179_td
ms

@performance_1180_td
5571

@performance_1181_td
7553

@performance_1182_td
11636

@performance_1183_td
12226

@performance_1184_td
12553

@performance_1185_td
BenchB: Transactions

@performance_1186_td
ms

@performance_1187_td
1931

@performance_1188_td
3417

@performance_1189_td
3435

@performance_1190_td
2407

@performance_1191_td
2149

@performance_1192_td
BenchB: Memory Usage

@performance_1193_td
MB

@performance_1194_td
18

@performance_1195_td
16

@performance_1196_td
13

@performance_1197_td
2

@performance_1198_td
2

@performance_1199_td
BenchC: Init

@performance_1200_td
ms

@performance_1201_td
1333

@performance_1202_td
968

@performance_1203_td
1769

@performance_1204_td
1693

@performance_1205_td
2645

@performance_1206_td
BenchC: Transactions

@performance_1207_td
ms

@performance_1208_td
6508

@performance_1209_td
4330

@performance_1210_td
7910

@performance_1211_td
7564

@performance_1212_td
6108

@performance_1213_td
BenchC: Memory Usage

@performance_1214_td
MB

@performance_1215_td
12

@performance_1216_td
21

@performance_1217_td
14

@performance_1218_td
2

@performance_1219_td
2

@performance_1220_td
Executed statements

@performance_1221_td
#

@performance_1222_td
322929

@performance_1223_td
322929

@performance_1224_td
322929

@performance_1225_td
322929

@performance_1226_td
322929

@performance_1227_td
Total time

@performance_1228_td
ms

@performance_1229_td
32106

@performance_1230_td
34546

@performance_1231_td
74245

@performance_1232_td
53791

@performance_1233_td
53216

@performance_1234_td
Statements per second

@performance_1235_td
#

@performance_1236_td
10058

@performance_1237_td
9347

@performance_1238_td
4349

@performance_1239_td
6003

@performance_1240_td
6068

@performance_1241_h3
Benchmark Results and Comments

@performance_1242_h4
H2

@performance_1243_p
 Version 1.2.137 (2010-06-06) was used for the test. For most operations, the performance of H2 is about the same as for HSQLDB. One situation where H2 is slow is large result sets, because they are buffered to disk if more than a certain number of records are returned. The advantage of buffering is: there is no limit on the result set size. 

@performance_1244_h4
HSQLDB

@performance_1245_p
 Version 2.0.0 was used for the test. Cached tables are used in this test (<code>hsqldb.default_table_type=cached</code>), and the write delay is 1 second (<code>SET WRITE_DELAY 1</code>). 

@performance_1246_h4
Derby

@performance_1247_p
 Version 10.6.1.0 was used for the test. Derby is clearly the slowest embedded database in this test. This seems to be a structural problem, because all operations are really slow. It will be hard for the developers of Derby to improve the performance to a reasonable level. A few problems have been identified: leaving autocommit on is a problem for Derby. If it is switched off during the whole test, the results are about 20% better for Derby. Derby calls <code>FileChannel.force(false)</code>, but only twice per log file (not on each commit). Disabling this call improves performance for Derby by about 2%. Unlike H2, Derby does not call <code>FileDescriptor.sync()</code> on each checkpoint. Derby supports a testing mode (system property <code>derby.system.durability=test</code>) where durability is disabled. According to the documentation, this setting should be used for testing only, as the database may not recover after a crash. Enabling this setting improves performance by a factor of 2.6 (embedded mode) or 1.4 (server mode). Even if enabled, Derby is still less than half as fast as H2 in default mode. 

@performance_1248_h4
PostgreSQL

@performance_1249_p
 Version 8.4.4 was used for the test. The following options where changed in <code>postgresql.conf: fsync = off, commit_delay = 1000</code>. PostgreSQL is run in server mode. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured. 

@performance_1250_h4
MySQL

@performance_1251_p
 Version 5.1.47-community was used for the test. MySQL was run with the InnoDB backend. The setting <code>innodb_flush_log_at_trx_commit</code> (found in the <code>my.ini / my.cnf</code> file) was set to 0. Otherwise (and by default), MySQL is slow (around 140 statements per second in this test) because it tries to flush the data to disk for each commit. For small transactions (when autocommit is on) this is really slow. But many use cases use small or relatively small transactions. Too bad this setting is not listed in the configuration wizard, and it always overwritten when using the wizard. You need to change this setting manually in the file <code>my.ini / my.cnf</code>, and then restart the service. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured. 

@performance_1252_h4
Firebird

@performance_1253_p
 Firebird 1.5 (default installation) was tested, but the results are not published currently. It is possible to run the performance test with the Firebird database, and any information on how to configure Firebird for higher performance are welcome. 

@performance_1254_h4
Why Oracle / MS SQL Server / DB2 are Not Listed

@performance_1255_p
 The license of these databases does not allow to publish benchmark results. This doesn't mean that they are fast. They are in fact quite slow, and need a lot of memory. But you will need to test this yourself. SQLite was not tested because the JDBC driver doesn't support transactions. 

@performance_1256_h3
About this Benchmark

@performance_1257_h4
How to Run

@performance_1258_p
 This test was as follows: 

@performance_1259_h4
Separate Process per Database

@performance_1260_p
 For each database, a new process is started, to ensure the previous test does not impact the current test. 

@performance_1261_h4
Number of Connections

@performance_1262_p
 This is mostly a single-connection benchmark. BenchB uses multiple connections; the other tests use one connection. 

@performance_1263_h4
Real-World Tests

@performance_1264_p
 Good benchmarks emulate real-world use cases. This benchmark includes 4 test cases: BenchSimple uses one table and many small updates / deletes. BenchA is similar to the TPC-A test, but single connection / single threaded (see also: www.tpc.org). BenchB is similar to the TPC-B test, using multiple connections (one thread per connection). BenchC is similar to the TPC-C test, but single connection / single threaded. 

@performance_1265_h4
Comparing Embedded with Server Databases

@performance_1266_p
 This is mainly a benchmark for embedded databases (where the application runs in the same virtual machine as the database engine). However MySQL and PostgreSQL are not Java databases and cannot be embedded into a Java application. For the Java databases, both embedded and server modes are tested. 

@performance_1267_h4
Test Platform

@performance_1268_p
 This test is run on Mac OS X 10.6. No virus scanner was used, and disk indexing was disabled. The VM used is Sun JDK 1.6. 

@performance_1269_h4
Multiple Runs

@performance_1270_p
 When a Java benchmark is run first, the code is not fully compiled and therefore runs slower than when running multiple times. A benchmark should always run the same test multiple times and ignore the first run(s). This benchmark runs three times, but only the last run is measured. 

@performance_1271_h4
Memory Usage

@performance_1272_p
 It is not enough to measure the time taken, the memory usage is important as well. Performance can be improved by using a bigger cache, but the amount of memory is limited. HSQLDB tables are kept fully in memory by default; this benchmark uses 'disk based' tables for all databases. Unfortunately, it is not so easy to calculate the memory usage of PostgreSQL and MySQL, because they run in a different process than the test. This benchmark currently does not print memory usage of those databases. 

@performance_1273_h4
Delayed Operations

@performance_1274_p
 Some databases delay some operations (for example flushing the buffers) until after the benchmark is run. This benchmark waits between each database tested, and each database runs in a different process (sequentially). 

@performance_1275_h4
Transaction Commit / Durability

@performance_1276_p
 Durability means transaction committed to the database will not be lost. Some databases (for example MySQL) try to enforce this by default by calling <code>fsync()</code> to flush the buffers, but most hard drives don't actually flush all data. Calling the method slows down transaction commit a lot, but doesn't always make data durable. When comparing the results, it is important to think about the effect. Many database suggest to 'batch' operations when possible. This benchmark switches off autocommit when loading the data, and calls commit after each 1000 inserts. However many applications need 'short' transactions at runtime (a commit after each update). This benchmark commits after each update / delete in the simple benchmark, and after each business transaction in the other benchmarks. For databases that support delayed commits, a delay of one second is used. 

@performance_1277_h4
Using Prepared Statements

@performance_1278_p
 Wherever possible, the test cases use prepared statements. 

@performance_1279_h4
Currently Not Tested: Startup Time

@performance_1280_p
 The startup time of a database engine is important as well for embedded use. This time is not measured currently. Also, not tested is the time used to create a database and open an existing database. Here, one (wrapper) connection is opened at the start, and for each step a new connection is opened and then closed. 

@performance_1281_h2
PolePosition Benchmark

@performance_1282_p
 The PolePosition is an open source benchmark. The algorithms are all quite simple. It was developed / sponsored by db4o. This test was not run for a longer time, so please be aware that the results below are for older database versions (H2 version 1.1, HSQLDB 1.8, Java 1.4). 

@performance_1283_th
Test Case

@performance_1284_th
Unit

@performance_1285_th
H2

@performance_1286_th
HSQLDB

@performance_1287_th
MySQL

@performance_1288_td
Melbourne write

@performance_1289_td
ms

@performance_1290_td
369

@performance_1291_td
249

@performance_1292_td
2022

@performance_1293_td
Melbourne read

@performance_1294_td
ms

@performance_1295_td
47

@performance_1296_td
49

@performance_1297_td
93

@performance_1298_td
Melbourne read_hot

@performance_1299_td
ms

@performance_1300_td
24

@performance_1301_td
43

@performance_1302_td
95

@performance_1303_td
Melbourne delete

@performance_1304_td
ms

@performance_1305_td
147

@performance_1306_td
133

@performance_1307_td
176

@performance_1308_td
Sepang write

@performance_1309_td
ms

@performance_1310_td
965

@performance_1311_td
1201

@performance_1312_td
3213

@performance_1313_td
Sepang read

@performance_1314_td
ms

@performance_1315_td
765

@performance_1316_td
948

@performance_1317_td
3455

@performance_1318_td
Sepang read_hot

@performance_1319_td
ms

@performance_1320_td
789

@performance_1321_td
859

@performance_1322_td
3563

@performance_1323_td
Sepang delete

@performance_1324_td
ms

@performance_1325_td
1384

@performance_1326_td
1596

@performance_1327_td
6214

@performance_1328_td
Bahrain write

@performance_1329_td
ms

@performance_1330_td
1186

@performance_1331_td
1387

@performance_1332_td
6904

@performance_1333_td
Bahrain query_indexed_string

@performance_1334_td
ms

@performance_1335_td
336

@performance_1336_td
170

@performance_1337_td
693

@performance_1338_td
Bahrain query_string

@performance_1339_td
ms

@performance_1340_td
18064

@performance_1341_td
39703

@performance_1342_td
41243

@performance_1343_td
Bahrain query_indexed_int

@performance_1344_td
ms

@performance_1345_td
104

@performance_1346_td
134

@performance_1347_td
678

@performance_1348_td
Bahrain update

@performance_1349_td
ms

@performance_1350_td
191

@performance_1351_td
87

@performance_1352_td
159

@performance_1353_td
Bahrain delete

@performance_1354_td
ms

@performance_1355_td
1215

@performance_1356_td
729

@performance_1357_td
6812

@performance_1358_td
Imola retrieve

@performance_1359_td
ms

@performance_1360_td
198

@performance_1361_td
194

@performance_1362_td
4036

@performance_1363_td
Barcelona write

@performance_1364_td
ms

@performance_1365_td
413

@performance_1366_td
832

@performance_1367_td
3191

@performance_1368_td
Barcelona read

@performance_1369_td
ms

@performance_1370_td
119

@performance_1371_td
160

@performance_1372_td
1177

@performance_1373_td
Barcelona query

@performance_1374_td
ms

@performance_1375_td
20

@performance_1376_td
5169

@performance_1377_td
101

@performance_1378_td
Barcelona delete

@performance_1379_td
ms

@performance_1380_td
388

@performance_1381_td
319

@performance_1382_td
3287

@performance_1383_td
Total

@performance_1384_td
ms

@performance_1385_td
26724

@performance_1386_td
53962

@performance_1387_td
87112

@performance_1388_p
 There are a few problems with the PolePosition test: 

@performance_1389_li
 HSQLDB uses in-memory tables by default while H2 uses persistent tables. The HSQLDB version included in PolePosition does not support changing this, so you need to replace <code>poleposition-0.20/lib/hsqldb.jar</code> with a newer version (for example <code>hsqldb-1.8.0.7.jar</code>), and then use the setting <code>hsqldb.connecturl=jdbc:hsqldb:file:data/hsqldb/dbbench2;hsqldb.default_table_type=cached;sql.enforce_size=true</code> in the file <code>Jdbc.properties</code>. 

@performance_1390_li
HSQLDB keeps the database open between tests, while H2 closes the database (losing all the cache). To change that, use the database URL <code>jdbc:h2:file:data/h2/dbbench;DB_CLOSE_DELAY=-1</code> 

@performance_1391_li
The amount of cache memory is quite important, specially for the PolePosition test. Unfortunately, the PolePosition test does not take this into account. 

@performance_1392_h2
Database Performance Tuning

@performance_1393_h3
Keep Connections Open or Use a Connection Pool

@performance_1394_p
 If your application opens and closes connections a lot (for example, for each request), you should consider using a <a href="tutorial.html#connection_pool">connection pool</a>. Opening a connection using <code>DriverManager.getConnection</code> is specially slow if the database is closed. By default the database is closed if the last connection is closed. 

@performance_1395_p
 If you open and close connections a lot but don't want to use a connection pool, consider keeping a 'sentinel' connection open for as long as the application runs, or use delayed database closing. See also <a href="features.html#closing_a_database">Closing a database</a>. 

@performance_1396_h3
Use a Modern JVM

@performance_1397_p
 Newer JVMs are faster. Upgrading to the latest version of your JVM can provide a "free" boost to performance. Switching from the default Client JVM to the Server JVM using the <code>-server</code> command-line option improves performance at the cost of a slight increase in start-up time. 

@performance_1398_h3
Virus Scanners

@performance_1399_p
 Some virus scanners scan files every time they are accessed. It is very important for performance that database files are not scanned for viruses. The database engine never interprets the data stored in the files as programs, that means even if somebody would store a virus in a database file, this would be harmless (when the virus does not run, it cannot spread). Some virus scanners allow to exclude files by suffix. Ensure files ending with <code>.db</code> are not scanned. 

@performance_1400_h3
Using the Trace Options

@performance_1401_p
 If the performance hot spots are in the database engine, in many cases the performance can be optimized by creating additional indexes, or changing the schema. Sometimes the application does not directly generate the SQL statements, for example if an O/R mapping tool is used. To view the SQL statements and JDBC API calls, you can use the trace options. For more information, see <a href="features.html#trace_options">Using the Trace Options</a>. 

@performance_1402_h3
Index Usage

@performance_1403_p
 This database uses indexes to improve the performance of <code>SELECT, UPDATE, DELETE</code>. If a column is used in the <code>WHERE</code> clause of a query, and if an index exists on this column, then the index can be used. Multi-column indexes are used if all or the first columns of the index are used. Both equality lookup and range scans are supported. Indexes are used to order result sets, but only if the condition uses the same index or no index at all. The results are sorted in memory if required. Indexes are created automatically for primary key and unique constraints. Indexes are also created for foreign key constraints, if required. For other columns, indexes need to be created manually using the <code>CREATE INDEX</code> statement. 

@performance_1404_h3
How Data is Stored Internally

@performance_1405_p
 For persistent databases, if a table is created with a single column primary key of type <code>BIGINT, INT, SMALLINT, TINYINT</code>, then the data of the table is organized in this way. This is sometimes also called a "clustered index" or "index organized table". 

@performance_1406_p
 H2 internally stores table data and indexes in the form of b-trees. Each b-tree stores entries as a list of unique keys (one or more columns) and data (zero or more columns). The table data is always organized in the form of a "data b-tree" with a single column key of type <code>long</code>. If a single column primary key of type <code>BIGINT, INT, SMALLINT, TINYINT</code> is specified when creating the table (or just after creating the table, but before inserting any rows), then this column is used as the key of the data b-tree. If no primary key has been specified, if the primary key column is of another data type, or if the primary key contains more than one column, then a hidden auto-increment column of type <code>BIGINT</code> is added to the table, which is used as the key for the data b-tree. All other columns of the table are stored within the data area of this data b-tree (except for large <code>BLOB, CLOB</code> columns, which are stored externally). 

@performance_1407_p
 For each additional index, one new "index b-tree" is created. The key of this b-tree consists of the indexed columns, plus the key of the data b-tree. If a primary key is created after the table has been created, or if the primary key contains multiple column, or if the primary key is not of the data types listed above, then the primary key is stored in a new index b-tree. 

@performance_1408_h3
Optimizer

@performance_1409_p
 This database uses a cost based optimizer. For simple and queries and queries with medium complexity (less than 7 tables in the join), the expected cost (running time) of all possible plans is calculated, and the plan with the lowest cost is used. For more complex queries, the algorithm first tries all possible combinations for the first few tables, and the remaining tables added using a greedy algorithm (this works well for most joins). Afterwards a genetic algorithm is used to test at most 2000 distinct plans. Only left-deep plans are evaluated. 

@performance_1410_h3
Expression Optimization

@performance_1411_p
 After the statement is parsed, all expressions are simplified automatically if possible. Operations are evaluated only once if all parameters are constant. Functions are also optimized, but only if the function is constant (always returns the same result for the same parameter values). If the <code>WHERE</code> clause is always false, then the table is not accessed at all. 

@performance_1412_h3
COUNT(*) Optimization

@performance_1413_p
 If the query only counts all rows of a table, then the data is not accessed. However, this is only possible if no <code>WHERE</code> clause is used, that means it only works for queries of the form <code>SELECT COUNT(*) FROM table</code>. 

@performance_1414_h3
Updating Optimizer Statistics / Column Selectivity

@performance_1415_p
 When executing a query, at most one index per join can be used. If the same table is joined multiple times, for each join only one index is used (the same index could be used for both joins, or each join could use a different index). Example: for the query <code>SELECT * FROM TEST T1, TEST T2 WHERE T1.NAME='A' AND T2.ID=T1.ID</code>, two index can be used, in this case the index on NAME for T1 and the index on ID for T2. 

@performance_1416_p
 If a table has multiple indexes, sometimes more than one index could be used. Example: if there is a table <code>TEST(ID, NAME, FIRSTNAME)</code> and an index on each column, then two indexes could be used for the query <code>SELECT * FROM TEST WHERE NAME='A' AND FIRSTNAME='B'</code>, the index on NAME or the index on FIRSTNAME. It is not possible to use both indexes at the same time. Which index is used depends on the selectivity of the column. The selectivity describes the 'uniqueness' of values in a column. A selectivity of 100 means each value appears only once, and a selectivity of 1 means the same value appears in many or most rows. For the query above, the index on NAME should be used if the table contains more distinct names than first names. 

@performance_1417_p
 The SQL statement <code>ANALYZE</code> can be used to automatically estimate the selectivity of the columns in the tables. This command should be run from time to time to improve the query plans generated by the optimizer. 

@performance_1418_h3
In-Memory (Hash) Indexes

@performance_1419_p
 Using in-memory indexes, specially in-memory hash indexes, can speed up queries and data manipulation. 

@performance_1420_p
In-memory indexes are automatically used for in-memory databases, but can also be created for persistent databases using <code>CREATE MEMORY TABLE</code>. In many cases, the rows itself will also be kept in-memory. Please note this may cause memory problems for large tables. 

@performance_1421_p
 In-memory hash indexes are backed by a hash table and are usually faster than regular indexes. However, hash indexes only supports direct lookup (<code>WHERE ID = ?</code>) but not range scan (<code>WHERE ID &lt; ?</code>). To use hash indexes, use HASH as in: <code>CREATE UNIQUE HASH INDEX</code> and <code>CREATE TABLE ...(ID INT PRIMARY KEY HASH,...)</code>. 

@performance_1422_h3
Use Prepared Statements

@performance_1423_p
 If possible, use prepared statements with parameters. 

@performance_1424_h3
Prepared Statements and IN(...)

@performance_1425_p
 Avoid generating SQL statements with a variable size IN(...) list. Instead, use a prepared statement with arrays as in the following example: 

@performance_1426_h3
Optimization Examples

@performance_1427_p
 See <code>src/test/org/h2/samples/optimizations.sql</code> for a few examples of queries that benefit from special optimizations built into the database. 

@performance_1428_h3
Cache Size and Type

@performance_1429_p
 By default the cache size of H2 is quite small. Consider using a larger cache size, or enable the second level soft reference cache. See also <a href="features.html#cache_settings">Cache Settings</a>. 

@performance_1430_h3
Data Types

@performance_1431_p
 Each data type has different storage and performance characteristics: 

@performance_1432_li
The <code>DECIMAL/NUMERIC</code> type is slower and requires more storage than the <code>REAL</code> and <code>DOUBLE</code> types. 

@performance_1433_li
Text types are slower to read, write, and compare than numeric types and generally require more storage. 

@performance_1434_li
See <a href="advanced.html#large_objects">Large Objects</a> for information on <code>BINARY</code> vs. <code>BLOB</code> and <code>VARCHAR</code> vs. <code>CLOB</code> performance. 

@performance_1435_li
Parsing and formatting takes longer for the <code>TIME</code>, <code>DATE</code>, and <code>TIMESTAMP</code> types than the numeric types. 

@performance_1436_code
SMALLINT/TINYINT/BOOLEAN

@performance_1437_li
 are not significantly smaller or faster to work with than <code>INTEGER</code> in most modes. 

@performance_1438_h3
Sorted Insert Optimization

@performance_1439_p
 To reduce disk space usage and speed up table creation, an optimization for sorted inserts is available. When used, b-tree pages are split at the insertion point. To use this optimization, add <code>SORTED</code> before the <code>SELECT</code> statement: 

@performance_1440_h2
Using the Built-In Profiler

@performance_1441_p
 A very simple Java profiler is built-in. To use it, use the following template: 

@performance_1442_h2
Application Profiling

@performance_1443_h3
Analyze First

@performance_1444_p
 Before trying to optimize performance, it is important to understand where the problem is (what part of the application is slow). Blind optimization or optimization based on guesses should be avoided, because usually it is not an efficient strategy. There are various ways to analyze an application. Sometimes two implementations can be compared using <code>System.currentTimeMillis()</code>. But this does not work for complex applications with many modules, and for memory problems. 

@performance_1445_p
 A simple way to profile an application is to use the built-in profiling tool of java. Example: 

@performance_1446_p
 Unfortunately, it is only possible to profile the application from start to end. Another solution is to create a number of full thread dumps. To do that, first run <code>jps -l</code> to get the process id, and then run <code>jstack &lt;pid&gt;</code> or <code>kill -QUIT &lt;pid&gt;</code> (Linux) or press Ctrl+C (Windows). 

@performance_1447_p
 A simple profiling tool is included in H2. To use it, the application needs to be changed slightly. Example: 

@performance_1448_p
 The profiler is built into the H2 Console tool, to analyze databases that open slowly. To use it, run the H2 Console, and then click on 'Test Connection'. Afterwards, click on "Test successful" and you get the most common stack traces, which helps to find out why it took so long to connect. You will only get the stack traces if opening the database took more than a few seconds. 

@performance_1449_h2
Database Profiling

@performance_1450_p
 The <code>ConvertTraceFile</code> tool generates SQL statement statistics at the end of the SQL script file. The format used is similar to the profiling data generated when using <code>java -Xrunhprof</code>. For this to work, the trace level needs to be 2 or higher (<code>TRACE_LEVEL_FILE=2</code>). The easiest way to set the trace level is to append the setting to the database URL, for example: <code>jdbc:h2:~/test;TRACE_LEVEL_FILE=2</code> or <code>jdbc:h2:tcp://localhost/~/test;TRACE_LEVEL_FILE=2</code>. As an example, execute the the following script using the H2 Console: 

@performance_1451_p
 After running the test case, convert the <code>.trace.db</code> file using the <code>ConvertTraceFile</code> tool. The trace file is located in the same directory as the database file. 

@performance_1452_p
 The generated file <code>test.sql</code> will contain the SQL statements as well as the following profiling data (results vary): 

@performance_1453_h2
Statement Execution Plans

@performance_1454_p
 The SQL statement <code>EXPLAIN</code> displays the indexes and optimizations the database uses for a statement. The following statements support <code>EXPLAIN</code>: <code>SELECT, UPDATE, DELETE, MERGE, INSERT</code>. The following query shows that the database uses the primary key index to search for rows: 

@performance_1455_p
 For joins, the tables in the execution plan are sorted in the order they are processed. The following query shows the database first processes the table <code>INVOICE</code> (using the primary key). For each row, it will additionally check that the value of the column <code>AMOUNT</code> is larger than zero, and for those rows the database will search in the table <code>CUSTOMER</code> (using the primary key). The query plan contains some redundancy so it is a valid statement. 

@performance_1456_h3
Displaying the Scan Count

@performance_1457_code
EXPLAIN ANALYZE

@performance_1458_p
 additionally shows the scanned rows per table and pages read from disk per table or index. This will actually execute the query, unlike <code>EXPLAIN</code> which only prepares it. The following query scanned 1000 rows, and to do that had to read 85 pages from the data area of the table. Running the query twice will not list the pages read from disk, because they are now in the cache. The <code>tableScan</code> means this query doesn't use an index. 

@performance_1459_h3
Special Optimizations

@performance_1460_p
 For certain queries, the database doesn't need to read all rows, or doesn't need to sort the result even if <code>ORDER BY</code> is used. 

@performance_1461_p
 For queries of the form <code>SELECT COUNT(*), MIN(ID), MAX(ID) FROM TEST</code>, the query plan includes the line <code>/* direct lookup */</code> if the data can be read from an index. 

@performance_1462_p
 For queries of the form <code>SELECT DISTINCT CUSTOMER_ID FROM INVOICE</code>, the query plan includes the line <code>/* distinct */</code> if there is an non-unique or multi-column index on this column, and if this column has a low selectivity. 

@performance_1463_p
 For queries of the form <code>SELECT * FROM TEST ORDER BY ID</code>, the query plan includes the line <code>/* index sorted */</code> to indicate there is no separate sorting required. 

@performance_1464_p
 For queries of the form <code>SELECT * FROM TEST GROUP BY ID ORDER BY ID</code>, the query plan includes the line <code>/* group sorted */</code> to indicate there is no separate sorting required. 

@performance_1465_h2
Fast Database Import

@performance_1466_p
 To speed up large imports, consider using the following options temporarily: 

@performance_1467_code
SET LOG 0

@performance_1468_li
 (disabling the transaction log) 

@performance_1469_code
SET CACHE_SIZE

@performance_1470_li
 (a large cache is faster) 

@performance_1471_code
SET LOCK_MODE 0

@performance_1472_li
 (disable locking) 

@performance_1473_code
SET UNDO_LOG 0

@performance_1474_li
 (disable the session undo log) 

@performance_1475_p
 These options can be set in the database URL: <code>jdbc:h2:~/test;LOG=0;CACHE_SIZE=65536;LOCK_MODE=0;UNDO_LOG=0</code>. Most of those options are not recommended for regular use, that means you need to reset them after use. 

@performance_1476_p
 If you have to import a lot of rows, use a PreparedStatement or use CSV import. Please note that <code>CREATE TABLE(...) ... AS SELECT ...</code> is faster than <code>CREATE TABLE(...); INSERT INTO ... SELECT ...</code>. 

@quickstart_1000_h1
Quickstart

@quickstart_1001_a
 Embedding H2 in an Application

@quickstart_1002_a
 The H2 Console Application

@quickstart_1003_h2
Embedding H2 in an Application

@quickstart_1004_p
 This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to: 

@quickstart_1005_li
Add the <code>h2*.jar</code> to the classpath (H2 does not have any dependencies) 

@quickstart_1006_li
Use the JDBC driver class: <code>org.h2.Driver</code> 

@quickstart_1007_li
The database URL <code>jdbc:h2:~/test</code> opens the database <code>test</code> in your user home directory 

@quickstart_1008_li
A new database is automatically created 

@quickstart_1009_h2
The H2 Console Application

@quickstart_1010_p
 The Console lets you access a SQL database using a browser interface. 

@quickstart_1011_p
 If you don't have Windows XP, or if something does not work as expected, please see the detailed description in the <a href="tutorial.html">Tutorial</a>. 

@quickstart_1012_h3
Step-by-Step

@quickstart_1013_h4
Installation

@quickstart_1014_p
 Install the software using the Windows Installer (if you did not yet do that). 

@quickstart_1015_h4
Start the Console

@quickstart_1016_p
 Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]:

@quickstart_1017_p
 A new console window appears:

@quickstart_1018_p
 Also, a new browser page should open with the URL <a href="http://localhost:8082" class="notranslate">http://localhost:8082</a>. You may get a security warning from the firewall. If you don't want other computers in the network to access the database on your machine, you can let the firewall block these connections. Only local connections are required at this time. 

@quickstart_1019_h4
Login

@quickstart_1020_p
 Select [Generic H2] and click [Connect]:

@quickstart_1021_p
 You are now logged in. 

@quickstart_1022_h4
Sample

@quickstart_1023_p
 Click on the [Sample SQL Script]:

@quickstart_1024_p
 The SQL commands appear in the command area.

@quickstart_1025_h4
Execute

@quickstart_1026_p
 Click [Run]

@quickstart_1027_p
 On the left side, a new entry TEST is added below the database icon. The operations and results of the statements are shown below the script.

@quickstart_1028_h4
Disconnect

@quickstart_1029_p
 Click on [Disconnect]:

@quickstart_1030_p
 to close the connection. 

@quickstart_1031_h4
End

@quickstart_1032_p
 Close the console window. For more information, see the <a href="tutorial.html">Tutorial</a>. 

@roadmap_1000_h1
Roadmap

@roadmap_1001_p
 New (feature) requests will usually be added at the very end of the list. The priority is increased for important and popular requests. Of course, patches are always welcome, but are not always applied as is. See also <a href="build.html#providing_patches">Providing Patches</a>. 

@roadmap_1002_h2
Version 1.3.x: Planned Changes

@roadmap_1003_li
Enable h2.lobInDatabase (store CLOB and BLOB in the database file). 

@roadmap_1004_li
Set ANALYZE_AUTO to 2000 (automatic ANALYZE). 

@roadmap_1005_li
Enable FUNCTIONS_IN_SCHEMA (allow to store functions in a schema). 

@roadmap_1006_li
Enable SELECT_FOR_UPDATE_MVCC (MVCC and SELECT FOR UPDATE). 

@roadmap_1007_li
Enable LARGE_TRANSACTIONS (support for very large transactions). Change documentation for MAX_MEMORY_UNDO in help.csv, because now changes to tables without a primary key can be buffered to disk. Later, change MAX_MEMORY_UNDO to reflect number of bytes instead of record (also remove Constants.UNDO_BLOCK_SIZE). Later, change undo log file format (fillAligned no longer required; var int). 

@roadmap_1008_li
Enable NESTED_JOINS (nested joins and right outer joins). 

@roadmap_1009_li
Enable OPTIMIZE_OR (convert OR conditions to IN(..) if possible). 

@roadmap_1010_li
Enable DROP_RESTRICT (default action for DROP is RESTRICT). Change documentation. 

@roadmap_1011_li
Set MAX_MEMORY_ROWS_DISTINCT to a lower value. 

@roadmap_1012_li
Enable OPTIMIZE_INSERT_FROM_SELECT (speed up CREATE TABLE ... AS SELECT). 

@roadmap_1013_li
Possibly enable QUERY_CACHE_SIZE. 

@roadmap_1014_li
Disable DB_CLOSE_ON_EXIT (the shutdown hook) by default. 

@roadmap_1015_li
For RUNSCRIPT and SCRIPT (commands and tools), use UTF-8 by default (ScriptCommand.charset). 

@roadmap_1016_li
Use Lucene 3 by default. 

@roadmap_1017_h2
Priority 1

@roadmap_1018_li
Bugfixes 

@roadmap_1019_li
Test if out of disk space can corrupt a database. 

@roadmap_1020_li
More tests with MULTI_THREADED=1 

@roadmap_1021_li
Server side cursors 

@roadmap_1022_h2
Priority 2

@roadmap_1023_li
Improve test code coverage. 

@roadmap_1024_li
Maybe disable shutdown hook (DB_CLOSE_ON_EXIT=FALSE) by default. 

@roadmap_1025_li
Access rights: remember the owner of an object. Create, alter and drop privileges. COMMENT: allow owner of object to change it. Issue 208. Access rights for schemas. 

@roadmap_1026_li
Test multi-threaded in-memory db access. 

@roadmap_1027_li
Support hints for the optimizer (which index to use, enforce the join order). 

@roadmap_1028_li
Migrate database tool (also from other database engines). For Oracle, maybe use DBMS_METADATA.GET_DDL / GET_DEPENDENT_DDL. 

@roadmap_1029_li
Full outer joins. 

@roadmap_1030_li
Clustering: support mixed clustering mode (one embedded, others in server mode). 

@roadmap_1031_li
Clustering: reads should be randomly distributed (optional) or to a designated database on RAM (parameter: READ_FROM=3). 

@roadmap_1032_li
PostgreSQL catalog: use BEFORE SELECT triggers instead of views over metadata tables. 

@roadmap_1033_li
Compatibility: automatically load functions from a script depending on the mode - see FunctionsMySQL.java, issue 211. 

@roadmap_1034_li
Test very large databases and LOBs (up to 256 GB). 

@roadmap_1035_li
Sequence: add features [NO] MINVALUE, MAXVALUE, CYCLE. 

@roadmap_1036_li
Deferred integrity checking (DEFERRABLE INITIALLY DEFERRED). 

@roadmap_1037_li
Groovy Stored Procedures: http://groovy.codehaus.org/Groovy+SQL 

@roadmap_1038_li
Add a migration guide (list differences between databases). 

@roadmap_1039_li
Optimization: automatic index creation suggestion using the trace file? 

@roadmap_1040_li
Compression performance: don't allocate buffers, compress / expand in to out buffer. 

@roadmap_1041_li
Rebuild index functionality to shrink index size and improve performance. 

@roadmap_1042_li
Don't use deleteOnExit (bug 4513817: File.deleteOnExit consumes memory). 

@roadmap_1043_li
Console: add accesskey to most important commands (A, AREA, BUTTON, INPUT, LABEL, LEGEND, TEXTAREA). 

@roadmap_1044_li
Test performance again with SQL Server, Oracle, DB2. 

@roadmap_1045_li
Test with Spatial DB in a box / JTS: http://www.opengeospatial.org/standards/sfs - OpenGIS Implementation Specification. 

@roadmap_1046_li
Write more tests and documentation for MVCC (Multi Version Concurrency Control). 

@roadmap_1047_li
Find a tool to view large text file (larger than 100 MB), with find, page up and down (like less), truncate before / after. 

@roadmap_1048_li
Implement, test, document XAConnection and so on. 

@roadmap_1049_li
Pluggable data type (for streaming, hashing, compression, validation, conversion, encryption). 

@roadmap_1050_li
CHECK: find out what makes CHECK=TRUE slow, move to CHECK2. 

@roadmap_1051_li
Drop with invalidate views (so that source code is not lost). Check what other databases do exactly. 

@roadmap_1052_li
Index usage for (ID, NAME)=(1, 'Hi'); document. 

@roadmap_1053_li
Make DDL (Data Definition) operations transactional. 

@roadmap_1054_li
RANK() and DENSE_RANK(), Partition using OVER(). 

@roadmap_1055_li
Set a connection read only (Connection.setReadOnly) or using a connection parameter. 

@roadmap_1056_li
Optimizer: use an index for IS NULL and IS NOT NULL (including linked tables). ID IS NOT NULL could be converted to ID &gt;= Integer.MIN_VALUE. 

@roadmap_1057_li
Access rights: finer grained access control (grant access for specific functions). 

@roadmap_1058_li
Version check: docs / web console (using Javascript), and maybe in the library (using TCP/IP). 

@roadmap_1059_li
Web server classloader: override findResource / getResourceFrom. 

@roadmap_1060_li
Cost for embedded temporary view is calculated wrong, if result is constant. 

@roadmap_1061_li
Comparison: pluggable sort order: natural sort. 

@roadmap_1062_li
Count index range query (count(*) where id between 10 and 20). 

@roadmap_1063_li
Performance: update in-place. 

@roadmap_1064_li
Eclipse plugin. 

@roadmap_1065_li
Asynchronous queries to support publish/subscribe: SELECT ... FOR READ WAIT [maxMillisToWait]. See also MS SQL Server "Query Notification". 

@roadmap_1066_li
Fulltext search Lucene: analyzer configuration. 

@roadmap_1067_li
Fulltext search (native): reader / tokenizer / filter. 

@roadmap_1068_li
Linked schema using CSV files: one schema for a directory of files; support indexes for CSV files. 

@roadmap_1069_li
iReport to support H2. 

@roadmap_1070_li
Implement missing JDBC API (CallableStatement,...). 

@roadmap_1071_li
Compression of the cache. 

@roadmap_1072_li
Include SMPT (mail) client (alert on cluster failure, low disk space,...). 

@roadmap_1073_li
JSON parser and functions. 

@roadmap_1074_li
Server: client ping from time to time (to avoid timeout - is timeout a problem?). 

@roadmap_1075_li
Copy database: tool with config GUI and batch mode, extensible (example: compare). 

@roadmap_1076_li
Document, implement tool for long running transactions using user-defined compensation statements. 

@roadmap_1077_li
Support SET TABLE DUAL READONLY. 

@roadmap_1078_li
GCJ: what is the state now? 

@roadmap_1079_li
Events for: database Startup, Connections, Login attempts, Disconnections, Prepare (after parsing), Web Server. See http://docs.openlinksw.com/virtuoso/fn_dbev_startup.html 

@roadmap_1080_li
Optimization: log compression. 

@roadmap_1081_li
ROW_NUMBER() OVER([ORDER BY columnName]). 

@roadmap_1082_li
Support standard INFORMATION_SCHEMA tables, as defined in http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt - specially KEY_COLUMN_USAGE: http://dev.mysql.com/doc/refman/5.0/en/information-schema.html, http://www.xcdsql.org/Misc/INFORMATION_SCHEMA%20With%20Rolenames.gif 

@roadmap_1083_li
Compatibility: in MySQL, HSQLDB, /0.0 is NULL; in PostgreSQL, Derby: division by zero. 

@roadmap_1084_li
Functional tables should accept parameters from other tables (see FunctionMultiReturn) SELECT * FROM TEST T, P2C(T.A, T.R). 

@roadmap_1085_li
Custom class loader to reload functions on demand. 

@roadmap_1086_li
Clustering: when a database is back alive, automatically synchronize with the master. 

@roadmap_1087_li
Test http://mysql-je.sourceforge.net/ 

@roadmap_1088_li
Performance: automatically build in-memory indexes if the whole table is in memory. 

@roadmap_1089_li
H2 Console: the webclient could support more features like phpMyAdmin. 

@roadmap_1090_li
Database file name suffix: a way to use no or a different suffix (for example using a slash). 

@roadmap_1091_li
Use Janino to convert Java to C++. 

@roadmap_1092_li
The HELP information schema can be directly exposed in the Console. 

@roadmap_1093_li
Maybe use the 0x1234 notation for binary fields, see MS SQL Server. 

@roadmap_1094_li
Support Oracle CONNECT BY in some way: http://www.adp-gmbh.ch/ora/sql/connect_by.html http://philip.greenspun.com/sql/trees.html 

@roadmap_1095_li
SQL Server 2005, Oracle: support COUNT(*) OVER(). See http://www.orafusion.com/art_anlytc.htm 

@roadmap_1096_li
SQL 2003: http://www.wiscorp.com/sql_2003_standard.zip 

@roadmap_1097_li
Version column (number/sequence and timestamp based). 

@roadmap_1098_li
Optimize getGeneratedKey: send last identity after each execute (server). 

@roadmap_1099_li
Test and document UPDATE TEST SET (ID, NAME) = (SELECT ID*10, NAME || '!' FROM TEST T WHERE T.ID=TEST.ID). 

@roadmap_1100_li
Max memory rows / max undo log size: use block count / row size not row count. 

@roadmap_1101_li
Support 123L syntax as in Java; example: SELECT (2000000000*2). 

@roadmap_1102_li
Implement point-in-time recovery. 

@roadmap_1103_li
Option for SCRIPT to only process one or a set of schemas or tables, and append to a file. 

@roadmap_1104_li
LIKE: improved version for larger texts (currently using naive search). 

@roadmap_1105_li
Automatically convert to the next 'higher' data type whenever there is an overflow. 

@roadmap_1106_li
Throw an exception when the application calls getInt on a Long (optional). 

@roadmap_1107_li
Default date format for input and output (local date constants). 

@roadmap_1108_li
Support custom Collators. 

@roadmap_1109_li
Document ROWNUM usage for reports: SELECT ROWNUM, * FROM (subquery). 

@roadmap_1110_li
File system that writes to two file systems (replication, replicating file system). 

@roadmap_1111_li
Standalone tool to get relevant system properties and add it to the trace output. 

@roadmap_1112_li
Support 'call proc(1=value)' (PostgreSQL, Oracle). 

@roadmap_1113_li
Console: improve editing data (Tab, Shift-Tab, Enter, Up, Down, Shift+Del?). 

@roadmap_1114_li
Console: autocomplete Ctrl+Space inserts template. 

@roadmap_1115_li
Option to encrypt .trace.db file. 

@roadmap_1116_li
Write Behind Cache on SATA leads to data corruption See also http://sr5tech.com/write_back_cache_experiments.htm and http://www.jasonbrome.com/blog/archives/2004/04/03/writecache_enabled.html 

@roadmap_1117_li
Functions with unknown return or parameter data types: serialize / deserialize. 

@roadmap_1118_li
Auto-Update feature for database, .jar file. 

@roadmap_1119_li
ResultSet SimpleResultSet.readFromURL(String url): id varchar, state varchar, released timestamp. 

@roadmap_1120_li
Partial indexing (see PostgreSQL). 

@roadmap_1121_li
Add GUI to build a custom version (embedded, fulltext,...) using build flags. 

@roadmap_1122_li
http://rubyforge.org/projects/hypersonic/ 

@roadmap_1123_li
Add a sample application that runs the H2 unit test and writes the result to a file (so it can be included in the user app). 

@roadmap_1124_li
Count on a column that can not be null could be optimized to COUNT(*). 

@roadmap_1125_li
Table order: ALTER TABLE TEST ORDER BY NAME DESC (MySQL compatibility). 

@roadmap_1126_li
Backup tool should work with other databases as well. 

@roadmap_1127_li
Console: -ifExists doesn't work for the console. Add a flag to disable other dbs. 

@roadmap_1128_li
Check if 'FSUTIL behavior set disablelastaccess 1' improves the performance (fsutil behavior query disablelastaccess). 

@roadmap_1129_li
Java static code analysis: http://pmd.sourceforge.net/ 

@roadmap_1130_li
Java static code analysis: http://www.eclipse.org/tptp/ 

@roadmap_1131_li
Compatibility for CREATE SCHEMA AUTHORIZATION. 

@roadmap_1132_li
Implement Clob / Blob truncate and the remaining functionality. 

@roadmap_1133_li
Tree join functionality. 

@roadmap_1134_li
Add multiple columns at the same time with ALTER TABLE .. ADD .. ADD ... 

@roadmap_1135_li
Use JDK 1.4 file locking for the database file and for the lock file (but not yet by default); writing a system property to detect concurrent access from the same VM (different classloaders). 

@roadmap_1136_li
Pure SQL triggers (example: update parent table if the child table is changed). 

@roadmap_1137_li
Add H2 to Gem (Ruby install system). 

@roadmap_1138_li
Order conditions inside AND / OR to optimize the performance. 

@roadmap_1139_li
Support Oracle functions: TRUNC, NVL2, TO_CHAR, TO_DATE, TO_NUMBER. 

@roadmap_1140_li
Support linked JCR tables. 

@roadmap_1141_li
Read InputStream when executing, as late as possible (maybe only embedded mode). Problem with re-execute. 

@roadmap_1142_li
Native fulltext search: min word length; store word positions. 

@roadmap_1143_li
Add an option to the SCRIPT command to generate only portable / standard SQL. 

@roadmap_1144_li
Updatable Views (simple cases first). 

@roadmap_1145_li
Improve create index performance. 

@roadmap_1146_li
Compact databases without having to close the database (vacuum). 

@roadmap_1147_li
Implement more JDBC 4.0 features. 

@roadmap_1148_li
Support TRANSFORM / PIVOT as in MS Access. 

@roadmap_1149_li
SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...). 

@roadmap_1150_li
Support updatable views with join on primary keys (to extend a table). 

@roadmap_1151_li
Public interface for functions (not public static). 

@roadmap_1152_li
Support reading the transaction log. 

@roadmap_1153_li
Support GRANT SELECT, UPDATE ON *. 

@roadmap_1154_li
Eliminate undo log records if stored on disk (just one pointer per block, not per record). 

@roadmap_1155_li
Feature matrix as in <a href="http://www.inetsoftware.de/products/jdbc/mssql/features/default.asp">i-net software</a>. 

@roadmap_1156_li
Updatable result set on table without primary key or unique index. 

@roadmap_1157_li
Compatibility with Derby and PostgreSQL: VALUES(1), (2); SELECT * FROM (VALUES (1), (2)) AS myTable(c1). Issue 221. 

@roadmap_1158_li
Use LinkedList instead of ArrayList where applicable. 

@roadmap_1159_li
Allow execution time prepare for SELECT * FROM CSVREAD(?, 'columnNameString') 

@roadmap_1160_li
Support data type INTERVAL 

@roadmap_1161_li
Support % operator (modulo). 

@roadmap_1162_li
Support JMX: create an MBean for each database and server (support JConsole). See http://thedevcloud.blogspot.com/2008/10/displaying-hsql-database-manager-in.html http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ManagementFactory.html#getPlatformMBeanServer() http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html 

@roadmap_1163_li
Support nested transactions. 

@roadmap_1164_li
Add a benchmark for big databases, and one for many users. 

@roadmap_1165_li
Compression in the result set (repeating values in the same column) over TCP/IP. 

@roadmap_1166_li
Support curtimestamp (like curtime, curdate). 

@roadmap_1167_li
Support ANALYZE {TABLE|INDEX} tableName COMPUTE|ESTIMATE|DELETE STATISTICS ptnOption options. 

@roadmap_1168_li
Release locks (shared or exclusive) on demand 

@roadmap_1169_li
Support OUTER UNION 

@roadmap_1170_li
Support parameterized views (similar to CSVREAD, but using just SQL for the definition) 

@roadmap_1171_li
A way (JDBC driver) to map an URL (jdbc:h2map:c1) to a connection object 

@roadmap_1172_li
Support linked tables to the current database 

@roadmap_1173_li
Support dynamic linked schema (automatically adding/updating/removing tables) 

@roadmap_1174_li
Clustering: adding a node should be very fast and without interrupting clients (very short lock) 

@roadmap_1175_li
Compatibility: # is the start of a single line comment (MySQL) but date quote (Access). Mode specific 

@roadmap_1176_li
Run benchmarks with JDK 1.5, JDK 1.6, java -server 

@roadmap_1177_li
Optimizations: faster hash function for strings, byte arrays 

@roadmap_1178_li
DatabaseEventListener: callback for all operations (including expected time, RUNSCRIPT) and cancel functionality 

@roadmap_1179_li
Benchmark: add a graph to show how databases scale (performance/database size) 

@roadmap_1180_li
Implement a SQLData interface to map your data over to a custom object 

@roadmap_1181_li
In the MySQL and PostgreSQL mode, use lower case identifiers by default (DatabaseMetaData.storesLowerCaseIdentifiers = true) 

@roadmap_1182_li
Support multiple directories (on different hard drives) for the same database 

@roadmap_1183_li
Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response 

@roadmap_1184_li
Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server) 

@roadmap_1185_li
Support native XML data type 

@roadmap_1186_li
Support triggers with a string property or option: SpringTrigger, OSGITrigger 

@roadmap_1187_li
Ability to resize the cache array when resizing the cache 

@roadmap_1188_li
Time based cache writing (one second after writing the log) 

@roadmap_1189_li
Check state of H2 driver for DDLUtils: https://issues.apache.org/jira/browse/DDLUTILS-185 

@roadmap_1190_li
Index usage for REGEXP LIKE. 

@roadmap_1191_li
Compatibility: add a role DBA (like ADMIN). 

@roadmap_1192_li
Better support multiple processors for in-memory databases. 

@roadmap_1193_li
Support N'text' 

@roadmap_1194_li
Support compatibility for jdbc:hsqldb:res: 

@roadmap_1195_li
Provide an Java SQL builder with standard and H2 syntax 

@roadmap_1196_li
Trace: write OS, file system, JVM,... when opening the database 

@roadmap_1197_li
Support indexes for views (probably requires materialized views) 

@roadmap_1198_li
Document SET SEARCH_PATH, BEGIN, EXECUTE, parameters 

@roadmap_1199_li
Browser: use Desktop.isDesktopSupported and browse when using JDK 1.6 

@roadmap_1200_li
Server: use one listener (detect if the request comes from an PG or TCP client) 

@roadmap_1201_li
Optimize SELECT MIN(ID), MAX(ID), COUNT(*) FROM TEST WHERE ID BETWEEN 100 AND 200 

@roadmap_1202_li
Sequence: PostgreSQL compatibility (rename, create) http://www.postgresql.org/docs/8.2/static/sql-altersequence.html 

@roadmap_1203_li
DISTINCT: support large result sets by sorting on all columns (additionally) and then removing duplicates. 

@roadmap_1204_li
Support a special trigger on all tables to allow building a transaction log reader. 

@roadmap_1205_li
File system with a background writer thread; test if this is faster 

@roadmap_1206_li
Better document the source code 

@roadmap_1207_li
Support select * from dual a left join dual b on b.x=(select max(x) from dual) 

@roadmap_1208_li
Optimization: don't lock when the database is read-only 

@roadmap_1209_li
Issue 146: Support merge join. 

@roadmap_1210_li
Integrate spatial functions from http://geosysin.iict.ch/irstv-trac/wiki/H2spatial/Download 

@roadmap_1211_li
Cluster: hot deploy (adding a node at runtime) 

@roadmap_1212_li
Support DatabaseMetaData.insertsAreDetected: updatable result sets should detect inserts. 

@roadmap_1213_li
Support COSH, SINH, and TANH functions 

@roadmap_1214_li
Oracle: support DECODE method (convert to CASE WHEN). 

@roadmap_1215_li
Native search: support "phrase search", wildcard search (* and ?), case-insensitive search, boolean operators, and grouping 

@roadmap_1216_li
Improve documentation of access rights 

@roadmap_1217_li
Support opening a database that is in the classpath, maybe using a new file system. Workaround: detect jar file using getClass().getProtectionDomain().getCodeSource().getLocation(). 

@roadmap_1218_li
Support ENUM data type (see MySQL, PostgreSQL, MS SQL Server, maybe others) 

@roadmap_1219_li
Remember the user defined data type (domain) of a column 

@roadmap_1220_li
MVCC: support multi-threaded kernel with multi-version concurrency. 

@roadmap_1221_li
Support Jackcess (MS Access databases) 

@roadmap_1222_li
Built-in methods to write large objects (BLOB and CLOB): FILE_WRITE('test.txt', 'Hello World') 

@roadmap_1223_li
Improve time to open large databases (see mail 'init time for distributed setup') 

@roadmap_1224_li
Move Maven 2 repository from hsql.sf.net to h2database.sf.net 

@roadmap_1225_li
Java 1.5 tool: JdbcUtils.closeSilently(s1, s2,...) 

@roadmap_1226_li
Javadoc: document design patterns used 

@roadmap_1227_li
Write an article about SQLInjection (h2/src/docsrc/html/images/SQLInjection.txt) 

@roadmap_1228_li
Convert SQL-injection-2.txt to html document, include SQLInjection.java sample 

@roadmap_1229_li
Support OUT parameters in user-defined procedures. 

@roadmap_1230_li
Web site design: http://www.igniterealtime.org/projects/openfire/index.jsp 

@roadmap_1231_li
HSQLDB compatibility: Openfire server uses: CREATE SCHEMA PUBLIC AUTHORIZATION DBA; CREATE USER SA PASSWORD ""; GRANT DBA TO SA; SET SCHEMA PUBLIC 

@roadmap_1232_li
Translation: use ?? in help.csv 

@roadmap_1233_li
Translated .pdf 

@roadmap_1234_li
MySQL compatibility: update test1 t1, test2 t2 set t1.id = t2.id where t1.id = t2.id; 

@roadmap_1235_li
Recovery tool: bad blocks should be converted to INSERT INTO SYSTEM_ERRORS(...), and things should go into the .trace.db file 

@roadmap_1236_li
RECOVER=2 to backup the database, run recovery, open the database 

@roadmap_1237_li
Recovery should work with encrypted databases 

@roadmap_1238_li
Corruption: new error code, add help 

@roadmap_1239_li
Space reuse: after init, scan all storages and free those that don't belong to a live database object 

@roadmap_1240_li
Use FilterIn / FilterOut putStream? 

@roadmap_1241_li
Access rights: add missing features (users should be 'owner' of objects; missing rights for sequences; dropping objects) 

@roadmap_1242_li
Support NOCACHE table option (Oracle). 

@roadmap_1243_li
Support table partitioning. 

@roadmap_1244_li
Index usage for UPDATE ... WHERE .. IN (SELECT...) 

@roadmap_1245_li
Add regular javadocs (using the default doclet, but another css) to the homepage. 

@roadmap_1246_li
The database should be kept open for a longer time when using the server mode. 

@roadmap_1247_li
Javadocs: for each tool, add a copy &amp; paste sample in the class level. 

@roadmap_1248_li
Javadocs: add @author tags. 

@roadmap_1249_li
Fluent API for tools: Server.createTcpServer().setPort(9081).setPassword(password).start(); 

@roadmap_1250_li
MySQL compatibility: real SQL statement for DESCRIBE TEST 

@roadmap_1251_li
Use a default delay of 1 second before closing a database. 

@roadmap_1252_li
Write (log) to system table before adding to internal data structures. 

@roadmap_1253_li
Doclet (javadocs): constructors are not listed. 

@roadmap_1254_li
Support direct lookup for MIN and MAX when using WHERE (see todo.txt / Direct Lookup). 

@roadmap_1255_li
Support other array types (String[], double[]) in PreparedStatement.setObject(int, Object); 

@roadmap_1256_li
MVCC should not be memory bound (uncommitted data is kept in memory in the delta index; maybe using a regular b-tree index solves the problem). 

@roadmap_1257_li
Oracle compatibility: support NLS_DATE_FORMAT. 

@roadmap_1258_li
Cluster: add feature to make sure cluster nodes can not get out of sync (for example by stopping one process). 

@roadmap_1259_li
H2 Console: support CLOB/BLOB download using a link. 

@roadmap_1260_li
Support flashback queries as in Oracle. 

@roadmap_1261_li
Import / Export of fixed with text files. 

@roadmap_1262_li
Support getGeneratedKeys to return multiple rows when used with batch updates. This is supported by MySQL, but not Derby. Both PostgreSQL and HSQLDB don't support getGeneratedKeys. Also support it when using INSERT ... SELECT. 

@roadmap_1263_li
HSQLDB compatibility: automatic data type for SUM if value is the value is too big (by default use the same type as the data). 

@roadmap_1264_li
Improve the optimizer to select the right index for special cases: where id between 2 and 4 and booleanColumn 

@roadmap_1265_li
Linked tables: make hidden columns available (Oracle: rowid and ora_rowscn columns). 

@roadmap_1266_li
H2 Console: in-place autocomplete. 

@roadmap_1267_li
Support large databases: split database files to multiple directories / disks (similar to tablespaces). 

@roadmap_1268_li
Support to assign a primary key index a user defined name. 

@roadmap_1269_li
H2 Console: support configuration option for fixed width (monospace) font. 

@roadmap_1270_li
Native fulltext search: support analyzers (specially for Chinese, Japanese). 

@roadmap_1271_li
Automatically compact databases from time to time (as a background process). 

@roadmap_1272_li
Test Eclipse DTP. 

@roadmap_1273_li
H2 Console: autocomplete: keep the previous setting 

@roadmap_1274_li
MySQL, MS SQL Server compatibility: support case sensitive (mixed case) identifiers without quotes. 

@roadmap_1275_li
executeBatch: option to stop at the first failed statement. 

@roadmap_1276_li
Implement OLAP features as described here: http://www.devx.com/getHelpOn/10MinuteSolution/16573/0/page/5 

@roadmap_1277_li
Support Oracle ROWID (unique identifier for each row). 

@roadmap_1278_li
Server mode: improve performance for batch updates. 

@roadmap_1279_li
Applets: support read-only databases in a zip file (accessed as a resource). 

@roadmap_1280_li
Long running queries / errors / trace system table. 

@roadmap_1281_li
H2 Console should support JaQu directly. 

@roadmap_1282_li
Document FTL_SEARCH, FTL_SEARCH_DATA. 

@roadmap_1283_li
Sequences: CURRVAL should be session specific. Compatibility with PostgreSQL. 

@roadmap_1284_li
Auto-server: add option to define the IP address range or list. 

@roadmap_1285_li
Index creation using deterministic functions. 

@roadmap_1286_li
Support DELETE with TOP or LIMIT. See also: http://dev.mysql.com/doc/refman/5.1/de/delete.html 

@roadmap_1287_li
ANALYZE: for unique indexes that allow null, count the number of null. 

@roadmap_1288_li
AUTO_SERVER: support changing IP addresses (disable a network while the database is open). 

@roadmap_1289_li
Avoid using java.util.Calendar internally because it's slow, complicated, and buggy. 

@roadmap_1290_li
Support TRUNCATE .. CASCADE like PostgreSQL. 

@roadmap_1291_li
Fulltext search: lazy result generation using SimpleRowSource. 

@roadmap_1292_li
Support transformation to join for user defined functions, as for IN(SELECT...). 

@roadmap_1293_li
Fulltext search: support alternative syntax: WHERE FTL_CONTAINS(name, 'hello'). 

@roadmap_1294_li
MySQL compatibility: support REPLACE, see http://dev.mysql.com/doc/refman/6.0/en/replace.html and issue 73. 

@roadmap_1295_li
MySQL compatibility: support INSERT INTO table SET column1 = value1, column2 = value2 

@roadmap_1296_li
Docs: add a one line description for each functions and SQL statements at the top (in the link section). 

@roadmap_1297_li
Javadoc search: weight for titles should be higher ('random' should list Functions as the best match). 

@roadmap_1298_li
Replace information_schema tables with regular tables that are automatically re-built when needed. Use indexes. 

@roadmap_1299_li
Delete temporary files or objects using finalize. 

@roadmap_1300_li
Oracle compatibility: support calling 0-parameters functions without parenthesis. Make constants obsolete. 

@roadmap_1301_li
MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL) 

@roadmap_1302_li
Allow calling function with no parameters without parenthesis. See http://code.google.com/p/h2database/issues/detail?id=50 

@roadmap_1303_li
CSV: currently # is a line comment and can start at any field. Make it optional. 

@roadmap_1304_li
Support a data type "timestamp with timezone" using java.util.Calendar. 

@roadmap_1305_li
Finer granularity for SLF4J trace - See http://code.google.com/p/h2database/issues/detail?id=62 

@roadmap_1306_li
Add database creation date and time to the database. 

@roadmap_1307_li
Support ASSERTION. 

@roadmap_1308_li
MySQL compatibility: support comparing 1='a' 

@roadmap_1309_li
Support PostgreSQL lock modes: http://www.postgresql.org/docs/8.3/static/explicit-locking.html 

@roadmap_1310_li
PostgreSQL compatibility: test DbVisualizer and Squirrel SQL using a new PostgreSQL JDBC driver. 

@roadmap_1311_li
RunScript should be able to read from system in (or quite mode for Shell). 

@roadmap_1312_li
Natural join: support select x from dual natural join dual. 

@roadmap_1313_li
Support using system properties in database URLs (may be a security problem). 

@roadmap_1314_li
Natural join: somehow support this: select a.x, b.x, x from dual a natural join dual b 

@roadmap_1315_li
Use the Java service provider mechanism to register file systems and function libraries. 

@roadmap_1316_li
MySQL compatibility: for auto_increment columns, convert 0 to next value (as when inserting NULL). 

@roadmap_1317_li
Optimization for multi-column IN: use an index if possible. Example: (A, B) IN((1, 2), (2, 3)). 

@roadmap_1318_li
Optimization for EXISTS: convert to inner join or IN(..) if possible. 

@roadmap_1319_li
Functions: support hashcode(value); cryptographic and fast 

@roadmap_1320_li
Serialized file lock: support long running queries. 

@roadmap_1321_li
Network: use 127.0.0.1 if other addresses don't work. 

@roadmap_1322_li
Pluggable network protocol (currently Socket/ServerSocket over TCP/IP) - see also TransportServer with master slave replication. 

@roadmap_1323_li
Select for update in mvcc mode: only lock the selected records. 

@roadmap_1324_li
Support reading JCR data: one table per node type; query table; cache option 

@roadmap_1325_li
OSGi: create a sample application, test, document. 

@roadmap_1326_li
help.csv: use complete examples for functions; run as test case. 

@roadmap_1327_li
Functions to calculate the memory and disk space usage of a table, a row, or a value. 

@roadmap_1328_li
Re-implement PooledConnection; use a lightweight connection object. 

@roadmap_1329_li
Doclet: convert tests in javadocs to a java class. 

@roadmap_1330_li
Doclet: format fields like methods, but support sorting by name and value. 

@roadmap_1331_li
Doclet: shrink the html files. 

@roadmap_1332_li
MySQL compatibility: support SET NAMES 'latin1' - See also http://code.google.com/p/h2database/issues/detail?id=56 

@roadmap_1333_li
MySQL compatibility: DELETE .. FROM .. USING - See http://dev.mysql.com/doc/refman/5.0/en/delete.html 

@roadmap_1334_li
Allow to scan index backwards starting with a value (to better support ORDER BY DESC). 

@roadmap_1335_li
Java Service Wrapper: try http://yajsw.sourceforge.net/ 

@roadmap_1336_li
Batch parameter for INSERT, UPDATE, and DELETE, and commit after each batch. See also MySQL DELETE. 

@roadmap_1337_li
MySQL compatibility: support ALTER TABLE .. MODIFY COLUMN. 

@roadmap_1338_li
Use a lazy and auto-close input stream (open resource when reading, close on eof). 

@roadmap_1339_li
PostgreSQL compatibility: generate_series. 

@roadmap_1340_li
Connection pool: 'reset session' command (delete temp tables, rollback, auto-commit true). 

@roadmap_1341_li
Improve SQL documentation, see http://www.w3schools.com/sql/ 

@roadmap_1342_li
MySQL compatibility: DatabaseMetaData.stores*() methods should return the same values. Test with SquirrelSQL. 

@roadmap_1343_li
MS SQL Server compatibility: support DATEPART syntax. 

@roadmap_1344_li
Sybase/DB2/Oracle compatibility: support out parameters in stored procedures - See http://code.google.com/p/h2database/issues/detail?id=83 

@roadmap_1345_li
Support INTERVAL data type (see Oracle and others). 

@roadmap_1346_li
Combine Server and Console tool (only keep Server). 

@roadmap_1347_li
Store the Lucene index in the database itself. 

@roadmap_1348_li
Support standard MERGE statement: http://en.wikipedia.org/wiki/Merge_%28SQL%29 

@roadmap_1349_li
Oracle compatibility: support DECODE(x, ...). 

@roadmap_1350_li
MVCC: compare concurrent update behavior with PostgreSQL and Oracle. 

@roadmap_1351_li
HSQLDB compatibility: CREATE FUNCTION (maybe using a Function interface). 

@roadmap_1352_li
HSQLDB compatibility: support CALL "java.lang.Math.sqrt"(2.0) 

@roadmap_1353_li
Support comma as the decimal separator in the CSV tool. 

@roadmap_1354_li
Compatibility: Support jdbc:default:connection using ThreadLocal (part of SQLJ) 

@roadmap_1355_li
Compatibility: Java functions with SQLJ Part1 http://www.acm.org/sigmod/record/issues/9912/standards.pdf.gz 

@roadmap_1356_li
Compatibility: Java functions with SQL/PSM (Persistent Stored Modules) - need to find the documentation. 

@roadmap_1357_li
CACHE_SIZE: automatically use a fraction of Runtime.maxMemory - maybe automatically the second level cache. 

@roadmap_1358_li
Support date/time/timestamp as documented in http://en.wikipedia.org/wiki/ISO_8601 

@roadmap_1359_li
PostgreSQL compatibility: when in PG mode, treat BYTEA data like PG. 

@roadmap_1360_li
Support =ANY(array) as in PostgreSQL. See also http://www.postgresql.org/docs/8.0/interactive/arrays.html 

@roadmap_1361_li
IBM DB2 compatibility: support PREVIOUS VALUE FOR sequence. 

@roadmap_1362_li
MySQL compatibility: alter table add index i(c), add constraint c foreign key(c) references t(c); 

@roadmap_1363_li
Compatibility: use different LIKE ESCAPE characters depending on the mode (disable for Derby, HSQLDB, DB2, Oracle, MSSQLServer). 

@roadmap_1364_li
Oracle compatibility: support CREATE SYNONYM table FOR schema.table. 

@roadmap_1365_li
Optimize A=? OR B=? to UNION if the cost is lower. 

@roadmap_1366_li
FTP: document the server, including -ftpTask option to execute / kill remote processes 

@roadmap_1367_li
FTP: problems with multithreading? 

@roadmap_1368_li
FTP: implement SFTP / FTPS 

@roadmap_1369_li
FTP: access to a database (.csv for a table, a directory for a schema, a file for a lob, a script.sql file). 

@roadmap_1370_li
More secure default configuration if remote access is enabled. 

@roadmap_1371_li
Improve database file locking (maybe use native file locking). The current approach seems to be problematic if the file system is on a remote share (see Google Group 'Lock file modification time is in the future'). 

@roadmap_1372_li
Document internal features such as BELONGS_TO_TABLE, NULL_TO_DEFAULT, SEQUENCE. 

@roadmap_1373_li
Issue 107: Prefer using the ORDER BY index if LIMIT is used. 

@roadmap_1374_li
An index on (id, name) should be used for a query: select * from t where s=? order by i 

@roadmap_1375_li
Support reading sequences using DatabaseMetaData.getTables(null, null, null, new String[]{"SEQUENCE"}). See PostgreSQL. 

@roadmap_1376_li
Add option to enable TCP_NODELAY using Socket.setTcpNoDelay(true). 

@roadmap_1377_li
Maybe disallow = within database names (jdbc:h2:mem:MODE=DB2 means database name MODE=DB2). 

@roadmap_1378_li
Fast alter table add column. 

@roadmap_1379_li
Improve concurrency for in-memory database operations. 

@roadmap_1380_li
Issue 122: Support for connection aliases for remote tcp connections. 

@roadmap_1381_li
Fast scrambling (strong encryption doesn't help if the password is included in the application). 

@roadmap_1382_li
H2 Console: support -webPassword to require a password to access preferences or shutdown. 

@roadmap_1383_li
Issue 126: The index name should be "IDX_" plus the constraint name unless there is a conflict, in which case append a number. 

@roadmap_1384_li
Issue 127: Support activation/deactivation of triggers 

@roadmap_1385_li
Issue 130: Custom log event listeners 

@roadmap_1386_li
Issue 131: IBM DB2 compatibility: sysibm.sysdummy1 

@roadmap_1387_li
Issue 132: Use Java enum trigger type. 

@roadmap_1388_li
Issue 134: IBM DB2 compatibility: session global variables. 

@roadmap_1389_li
Cluster: support load balance with values for each server / auto detect. 

@roadmap_1390_li
FTL_SET_OPTION(keyString, valueString) with key stopWords at first. 

@roadmap_1391_li
Pluggable access control mechanism. 

@roadmap_1392_li
Fulltext search (Lucene): support streaming CLOB data. 

@roadmap_1393_li
Document/example how to create and read an encrypted script file. 

@roadmap_1394_li
Check state of https://issues.apache.org/jira/browse/OPENJPA-1367 (H2 does support cross joins). 

@roadmap_1395_li
Fulltext search (Lucene): only prefix column names with _ if they already start with _. Instead of DATA / QUERY / modified use _DATA, _QUERY, _MODIFIED if possible. 

@roadmap_1396_li
Support a way to create or read compressed encrypted script files using an API. 

@roadmap_1397_li
Scripting language support (Javascript). 

@roadmap_1398_li
The network client should better detect if the server is not an H2 server and fail early. 

@roadmap_1399_li
H2 Console: support CLOB/BLOB upload. 

@roadmap_1400_li
Database file lock: detect hibernate / standby / very slow threads (compare system time). 

@roadmap_1401_li
Automatic detection of redundant indexes. 

@roadmap_1402_li
Maybe reject join without "on" (except natural join). 

@roadmap_1403_li
Implement GiST (Generalized Search Tree for Secondary Storage). 

@roadmap_1404_li
Function to read a number of bytes/characters from an BLOB or CLOB. 

@roadmap_1405_li
Issue 156: Support SELECT ? UNION SELECT ?. 

@roadmap_1406_li
Automatic mixed mode: support a port range list (to avoid firewall problems). 

@roadmap_1407_li
Support the pseudo column rowid, oid, _rowid_. 

@roadmap_1408_li
H2 Console / large result sets: stream early instead of keeping a whole result in-memory 

@roadmap_1409_li
Support TRUNCATE for linked tables. 

@roadmap_1410_li
UNION: evaluate INTERSECT before UNION (like most other database except Oracle). 

@roadmap_1411_li
Delay creating the information schema, and share metadata columns. 

@roadmap_1412_li
TCP Server: use a nonce (number used once) to protect unencrypted channels against replay attacks. 

@roadmap_1413_li
Simplify running scripts and recovery: CREATE FORCE USER (overwrites an existing user). 

@roadmap_1414_li
Support CREATE DATABASE LINK (a custom JDBC driver is already supported). 

@roadmap_1415_li
Support large GROUP BY operations. Issue 216. 

@roadmap_1416_li
Issue 163: Allow to create foreign keys on metadata types. 

@roadmap_1417_li
Logback: write a native DBAppender. 

@roadmap_1418_li
Cache size: don't use more cache than what is available. 

@roadmap_1419_li
Allow to defragment at runtime (similar to SHUTDOWN DEFRAG) in a background thread. 

@roadmap_1420_li
Tree index: Instead of an AVL tree, use a general balanced trees or a scapegoat tree. 

@roadmap_1421_li
User defined functions: allow to store the bytecode (of just the class, or the jar file of the extension) in the database. 

@roadmap_1422_li
Compatibility: ResultSet.getObject() on a CLOB (TEXT) should return String for PostgreSQL and MySQL. 

@roadmap_1423_li
Optimizer: WHERE X=? AND Y IN(?), it always uses the index on Y. Should be cost based. 

@roadmap_1424_li
Make the cache scan resistant (currently a small cache is faster than a large cache for large table scans). 

@roadmap_1425_li
Issue 178: Optimizer: index usage when both ascending and descending indexes are available. 

@roadmap_1426_li
Issue 179: Related subqueries in HAVING clause 

@roadmap_1427_li
IBM DB2 compatibility: NOT NULL WITH DEFAULT. Similar to MySQL Mode.convertInsertNullToZero. 

@roadmap_1428_li
Creating primary key: always create a constraint. 

@roadmap_1429_li
Maybe use a different page layout: keep the data at the head of the page, and ignore the tail (don't store / read it). This may increase write / read performance depending on the file system. 

@roadmap_1430_li
Indexes of temporary tables are currently kept in-memory. Is this how it should be? 

@roadmap_1431_li
The Shell tool should support the same built-in commands as the H2 Console. 

@roadmap_1432_li
Maybe use PhantomReference instead of finalize. 

@roadmap_1433_li
Database file name suffix: should only have one dot by default. Example: .h2db 

@roadmap_1434_li
Issue 196: Function based indexes 

@roadmap_1435_li
Fix the disk space leak (killing the process at the exact right moment will increase the disk space usage; this space is not re-used). See TestDiskSpaceLeak.java 

@roadmap_1436_li
ROWNUM: Oracle compatibility when used within a subquery. Issue 198. 

@roadmap_1437_li
Allow to access the database over HTTP (possibly using port 80) and a servlet in a REST way. 

@roadmap_1438_li
ODBC: encrypted databases are not supported because the ;CIPHER= can not be set. 

@roadmap_1439_li
Support CLOB and BLOB update, specially conn.createBlob().setBinaryStream(1); 

@roadmap_1440_li
Optimizer: index usage when both ascending and descending indexes are available. Issue 178. 

@roadmap_1441_li
Triggers: support user defined execution order. Oracle: CREATE OR REPLACE TRIGGER TEST_2 BEFORE INSERT ON TEST FOR EACH ROW FOLLOWS TEST_1. SQL specifies that multiple triggers should be fired in time-of-creation order. PostgreSQL uses name order, which was judged to be more convenient. Derby: triggers are fired in the order in which they were created. 

@roadmap_1442_li
PostgreSQL compatibility: combine "users" and "roles". See: http://www.postgresql.org/docs/8.1/interactive/user-manag.html 

@roadmap_1443_li
Improve documentation of system properties: only list the property names, default values, and description. 

@roadmap_1444_li
Support running totals / cumulative sum using SUM(..) OVER(..). 

@roadmap_1445_li
Improve object memory size calculation. Use constants for known VMs, or use reflection to call java.lang.instrument.Instrumentation.getObjectSize(Object objectToSize) 

@roadmap_1446_li
Triggers: NOT NULL checks should be done after running triggers (Oracle behavior, maybe others). 

@roadmap_1447_li
Common Table Expression (CTE) / recursive queries: support INSERT INTO ... SELECT ... Issue 219. 

@roadmap_1448_li
Common Table Expression (CTE) / recursive queries: support non-recursive queries. Issue 217. 

@roadmap_1449_li
Common Table Expression (CTE) / recursive queries: avoid endless loop. Issue 218. 

@roadmap_1450_li
Common Table Expression (CTE) / recursive queries: support multiple named queries. Issue 220. 

@roadmap_1451_li
Common Table Expression (CTE) / recursive queries: identifier scope may be incorrect. Issue 222. 

@roadmap_1452_li
Common Table Expression (CTE) / recursive queries: support parameters. 

@roadmap_1453_li
Log long running transactions (similar to long running statements). 

@roadmap_1454_li
Support schema specific domains. 

@roadmap_1455_li
Parameter data type is data type of other operand. Issue 205. 

@roadmap_1456_li
Some combinations of nested join with right outer join are not supported. 

@roadmap_1457_li
DatabaseEventListener.openConnection(id) and closeConnection(id). 

@roadmap_1458_li
Listener or authentication module for new connections, or a way to restrict the number of different connections to a tcp server, or to prevent to login with the same username and password from different IPs. Possibly using the DatabaseEventListener API, or a new API. 

@roadmap_1459_li
Compatibility for data type CHAR (Derby, HSQLDB). Issue 212. 

@roadmap_1460_li
Compatibility with MySQL TIMESTAMPDIFF. Issue 209. 

@roadmap_1461_li
Optimizer: use a histogram of the data, specially for non-normal distributions. 

@roadmap_1462_li
Trigger: allow declaring as source code (like functions). 

@roadmap_1463_li
User defined aggregate: allow declaring as source code (like functions). 

@roadmap_1464_li
The error "table not found" is sometimes caused by using the wrong database. Add "(this database is empty)" to the exception message if applicable. 

@roadmap_1465_li
PostgreSQL compatibility: support escape with double \\. 

@roadmap_1466_li
Document the TCP server "management_db". Maybe include the IP address of the client. 

@roadmap_1467_li
Use javax.tools.JavaCompilerTool instead of com.sun.tools.javac.Main 

@roadmap_1468_li
If a database object was not found in the current schema, but one with the same name existed in another schema, included that in the error message. 

@roadmap_1469_li
Optimization to use an index for OR when using multiple keys: where (key1 = ? and key2 = ?) OR (key1 = ? and key2 = ?) 

@roadmap_1470_li
JaQu should support a DataSource and a way to create a Db object using a Connection (for multi-threaded usage with a connection pool). 

@roadmap_1471_li
Move table to a different schema (rename table to a different schema), possibly using ALTER TABLE ... SET SCHEMA ...; 

@roadmap_1472_li
nioMapped file system: automatically fall back to regular (non mapped) IO if there is a problem (out of memory exception for example). 

@roadmap_1473_li
Column as parameter of function table. Issue 228. 

@roadmap_1474_li
Connection pool: detect ;AUTOCOMMIT=FALSE in the database URL, and if set, disable autocommit for all connections. 

@roadmap_1475_li
Compatibility with MS Access: support "&amp;" to concatenate text. 

@roadmap_1476_li
The BACKUP statement should not synchronize on the database, and therefore should not block other users. 

@roadmap_1477_li
Support ALTER TABLE ADD COLUMN IF NOT EXISTS. 

@roadmap_1478_li
Document the database file format. 

@roadmap_1479_li
Support reading LOBs. 

@roadmap_1480_li
Require appending DANGEROUS=TRUE when using certain dangerous settings such as LOG=0, LOG=1, LOCK_MODE=0, disabling FILE_LOCK,... 

@roadmap_1481_li
Support for Thread.interrupt to cancel running statements. 

@roadmap_1482_li
Oracle compatibility: support INSERT ALL. 

@roadmap_1483_h2
Not Planned

@roadmap_1484_li
HSQLDB (did) support this: select id i from test where i&lt;0 (other databases don't). Supporting it may break compatibility. 

@roadmap_1485_li
String.intern (so that Strings can be compared with ==) will not be used because some VMs have problems when used extensively. 

@roadmap_1486_li
In prepared statements, identifier names (table names and so on) can not be parameterized. Adding such a feature would complicate the source code without providing reasonable speedup, and would slow down regular prepared statements. 

@sourceError_1000_h1
Error Analyzer

@sourceError_1001_a
Home

@sourceError_1002_a
Input

@sourceError_1003_h2
&nbsp; <a href="javascript:select('details')" id = "detailsTab">Details</a>&nbsp; <a href="javascript:select('source')" id = "sourceTab">Source Code</a> 

@sourceError_1004_p
Paste the error message and stack trace below and click on 'Details' or 'Source Code': 

@sourceError_1005_b
Error Code: 

@sourceError_1006_b
Product Version: 

@sourceError_1007_b
Message: 

@sourceError_1008_b
More Information:

@sourceError_1009_b
Stack Trace: 

@sourceError_1010_b
Source File: 

@sourceError_1011_p
 Raw file 

@sourceError_1012_p
 (fast; only Firefox)

@tutorial_1000_h1
Tutorial

@tutorial_1001_a
 Starting and Using the H2 Console

@tutorial_1002_a
 Special H2 Console Syntax

@tutorial_1003_a
 Settings of the H2 Console

@tutorial_1004_a
 Connecting to a Database using JDBC

@tutorial_1005_a
 Creating New Databases

@tutorial_1006_a
 Using the Server

@tutorial_1007_a
 Using Hibernate

@tutorial_1008_a
 Using TopLink and Glassfish

@tutorial_1009_a
 Using EclipseLink

@tutorial_1010_a
 Using Apache ActiveMQ

@tutorial_1011_a
 Using H2 within NetBeans

@tutorial_1012_a
 Using Databases in Web Applications

@tutorial_1013_a
 Android

@tutorial_1014_a
 CSV (Comma Separated Values) Support

@tutorial_1015_a
 Upgrade, Backup, and Restore

@tutorial_1016_a
 Command Line Tools

@tutorial_1017_a
 The Shell Tool

@tutorial_1018_a
 Using OpenOffice Base

@tutorial_1019_a
 Java Web Start / JNLP

@tutorial_1020_a
 Using a Connection Pool

@tutorial_1021_a
 Fulltext Search

@tutorial_1022_a
 User-Defined Variables

@tutorial_1023_a
 Date and Time

@tutorial_1024_a
 Using Spring

@tutorial_1025_a
 Java Management Extension (JMX)

@tutorial_1026_h2
Starting and Using the H2 Console

@tutorial_1027_p
 The H2 Console application lets you access a SQL database using a browser interface. This can be a H2 database, or another database that supports the JDBC API. 

@tutorial_1028_p
 This is a client / server application, so both a server and a client (a browser) are required to run it. 

@tutorial_1029_p
 Depending on your platform and environment, there are multiple ways to start the application: 

@tutorial_1030_th
OS

@tutorial_1031_th
Start

@tutorial_1032_td
Windows

@tutorial_1033_td
 Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]

@tutorial_1034_td
 When using the Sun JDK 1.5, a window with the title 'H2 Console ' should appear. When using the Sun JDK 1.6, an icon will be added to the system tray: 

@tutorial_1035_td
 If you don't get the window and the system tray icon, then maybe Java is not installed correctly (in this case, try another way to start the application). A browser window should open and point to the Login page at <code>http://localhost:8082</code>. 

@tutorial_1036_td
Windows

@tutorial_1037_td
 Open a file browser, navigate to <code>h2/bin</code>, and double click on <code>h2.bat</code>.

@tutorial_1038_td
 A console window appears. If there is a problem, you will see an error message in this window. A browser window will open and point to the Login page (URL: <code>http://localhost:8082</code>). 

@tutorial_1039_td
Any

@tutorial_1040_td
 Double click on the <code>h2*.jar</code> file. This only works if the <code>.jar</code> suffix is associated with java. 

@tutorial_1041_td
Any

@tutorial_1042_td
 Open a console window, navigate to the directory <code>h2/bin</code> and type: 

@tutorial_1043_h3
Firewall

@tutorial_1044_p
 If you start the server, you may get a security warning from the firewall (if you have installed one). If you don't want other computers in the network to access the application on your machine, you can let the firewall block those connections. The connection from the local machine will still work. Only if you want other computers to access the database on this computer, you need allow remote connections in the firewall. 

@tutorial_1045_p
 It has been reported that when using Kaspersky 7.0 with firewall, the H2 Console is very slow when connecting over the IP address. A workaround is to connect using localhost, however this only works on the local machine. 

@tutorial_1046_p
 A small firewall is already built into the server: other computers may not connect to the server by default. To change this, go to 'Preferences' and select 'Allow connections from other computers'. 

@tutorial_1047_h3
Testing Java

@tutorial_1048_p
 To find out which version of Java is installed, open a command prompt and type: 

@tutorial_1049_p
 If you get an error message, you may need to add the Java binary directory to the path environment variable. 

@tutorial_1050_h3
Error Message 'Port may be in use'

@tutorial_1051_p
 You can only start one instance of the H2 Console, otherwise you will get the following error message: "The Web server could not be started. Possible cause: another server is already running...". It is possible to start multiple console applications on the same computer (using different ports), but this is usually not required as the console supports multiple concurrent connections. 

@tutorial_1052_h3
Using another Port

@tutorial_1053_p
 If the port is in use by another application, you may want to start the H2 Console on a different port. This can be done by changing the port in the file <code>.h2.server.properties</code>. This file is stored in the user directory (for Windows, this is usually in <code>Documents and Settings/&lt;username&gt;</code>). The relevant entry is webPort. 

@tutorial_1054_h3
Connecting to the Server using a Browser

@tutorial_1055_p
 If the server started successfully, you can connect to it using a web browser. JavaScript needs to be enabled. If you started the server on the same computer as the browser, open the URL <code>http://localhost:8082</code>. If you want to connect to the application from another computer, you need to provide the IP address of the server, for example: <code>http://192.168.0.2:8082</code>. If you enabled SSL on the server side, the URL needs to start with <code>https://</code>. 

@tutorial_1056_h3
Multiple Concurrent Sessions

@tutorial_1057_p
 Multiple concurrent browser sessions are supported. As that the database objects reside on the server, the amount of concurrent work is limited by the memory available to the server application. 

@tutorial_1058_h3
Login

@tutorial_1059_p
 At the login page, you need to provide connection information to connect to a database. Set the JDBC driver class of your database, the JDBC URL, user name and password. If you are done, click [Connect]. 

@tutorial_1060_p
 You can save and reuse previously saved settings. The settings are stored in a properties file (see <a href="#console_settings">Settings of the H2 Console</a>). 

@tutorial_1061_h3
Error Messages

@tutorial_1062_p
 Error messages in are shown in red. You can show/hide the stack trace of the exception by clicking on the message. 

@tutorial_1063_h3
Adding Database Drivers

@tutorial_1064_p
 Additional database drivers to connect to other databases (MySQL, PostgreSQL, HSQLDB,...) can be registered by adding the Jar file location of the driver to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. Example (Windows): to add the database driver library <code>C:\Programs\hsqldb\lib\hsqldb.jar</code>, set the environment variable <code>H2DRIVERS</code> to <code>C:\Programs\hsqldb\lib\hsqldb.jar</code>. 

@tutorial_1065_p
 Multiple drivers can be set; each entry needs to be separated with a <code>;</code> (Windows) or <code>:</code> (other operating systems). Spaces in the path names are supported. The settings must not be quoted. 

@tutorial_1066_h3
Using the H2 Console

@tutorial_1067_p
 The H2 Console application has three main panels: the toolbar on top, the tree on the left, and the query / result panel on the right. The database objects (for example, tables) are listed on the left panel. Type in a SQL command on the query panel and click 'Run'. The result of the command appears just below the command. 

@tutorial_1068_h3
Inserting Table Names or Column Names

@tutorial_1069_p
 The table name and column names can be inserted in the script by clicking them in the tree. If you click on a table while the query is empty, then <code>SELECT * FROM ...</code> is added as well. While typing a query, the table that was used is automatically expanded in the tree. For example if you type <code>SELECT * FROM TEST T WHERE T.</code> then the table TEST is automatically expanded in the tree. 

@tutorial_1070_h3
Disconnecting and Stopping the Application

@tutorial_1071_p
 To log out of the database, click 'Disconnect' in the toolbar panel. However, the server is still running and ready to accept new sessions. 

@tutorial_1072_p
 To stop the server, right click on the system tray icon and select [Exit]. If you don't have the system tray icon, navigate to [Preferences] and click [Shutdown], press [Ctrl]+[C] in the console where the server was started (Windows), or close the console window. 

@tutorial_1073_h2
Special H2 Console Syntax

@tutorial_1074_p
 The H2 Console supports a few built-in commands. Those are interpreted within the H2 Console, that means they work with any database. They need to be at the beginning of a statement (before any remarks), otherwise they are not parsed correctly. If in doubt, add ';' before the command. 

@tutorial_1075_th
Command(s)

@tutorial_1076_th
Description

@tutorial_1077_td
 @autocommit_true;

@tutorial_1078_td
 @autocommit_false; 

@tutorial_1079_td
 Enable or disable autocommit. 

@tutorial_1080_td
 @cancel; 

@tutorial_1081_td
 Cancel the currently running statement. 

@tutorial_1082_td
 @columns null null TEST;

@tutorial_1083_td
 @index_info&nbsp;null&nbsp;null&nbsp;TEST;

@tutorial_1084_td
 @tables;

@tutorial_1085_td
 @tables null null TEST;

@tutorial_1086_td
 Call the corresponding DatabaseMetaData.get method. Patterns are case sensitive (usually identifiers are uppercase). For information about the parameters, see the Javadoc documentation. Missing parameters at the end are set to null. The complete list of commands is: <code> @attributes @best_row_identifier @catalogs @columns @column_privileges @cross_references @exported_keys @imported_keys @index_info @primary_keys @procedures @procedure_columns @schemas @super_tables @super_types @tables @table_privileges @table_types @type_info @udts @version_columns </code> 

@tutorial_1087_td
 @edit select * from test; 

@tutorial_1088_td
 Use an updatable result set. 

@tutorial_1089_td
 @generated&nbsp;insert&nbsp;into&nbsp;test()&nbsp;values(); 

@tutorial_1090_td
 Show the result of <code>Statement.getGeneratedKeys()</code>. 

@tutorial_1091_td
 @history; 

@tutorial_1092_td
 Show the command history. 

@tutorial_1093_td
 @info; 

@tutorial_1094_td
 Display the result of various <code>Connection</code> and <code>DatabaseMetaData</code> methods. 

@tutorial_1095_td
 @list select * from test; 

@tutorial_1096_td
 Show the result set in list format (each column on its own line, with row numbers). 

@tutorial_1097_td
 @loop 1000 select ?, ?/*rnd*/;

@tutorial_1098_td
 @loop 1000 @statement select ?; 

@tutorial_1099_td
 Run the statement this many times. Parameters (<code>?</code>) are set using a loop from 0 up to x - 1. Random values are used for each <code>?/*rnd*/</code>. A Statement object is used instead of a PreparedStatement if <code>@statement</code> is used. Result sets are read until <code>ResultSet.next()</code> returns <code>false</code>. Timing information is printed. 

@tutorial_1100_td
 @maxrows&nbsp;20; 

@tutorial_1101_td
 Set the maximum number of rows to display. 

@tutorial_1102_td
 @memory; 

@tutorial_1103_td
 Show the used and free memory. This will call <code>System.gc()</code>. 

@tutorial_1104_td
 @meta&nbsp;select&nbsp;1; 

@tutorial_1105_td
 List the <code>ResultSetMetaData</code> after running the query. 

@tutorial_1106_td
 @parameter_meta&nbsp;select&nbsp;?; 

@tutorial_1107_td
 Show the result of the <code>PreparedStatement.getParameterMetaData()</code> calls. The statement is not executed. 

@tutorial_1108_td
 @prof_start;

@tutorial_1109_td
 call&nbsp;hash('SHA256',&nbsp;'',&nbsp;1000000);

@tutorial_1110_td
 @prof_stop; 

@tutorial_1111_td
 Start / stop the built-in profiling tool. The top 3 stack traces of the statement(s) between start and stop are listed (if there are 3). 

@tutorial_1112_td
 @prof_stop;

@tutorial_1113_td
 @sleep 10;

@tutorial_1114_td
 @prof_stop; 

@tutorial_1115_td
 Sleep for a number of seconds. Used to profile a long running query or operation that is running in another session (but in the same process). 

@tutorial_1116_td
 @transaction_isolation;

@tutorial_1117_td
 @transaction_isolation&nbsp;2; 

@tutorial_1118_td
 Display (without parameters) or change (with parameters 1, 2, 4, 8) the transaction isolation level. 

@tutorial_1119_h2
Settings of the H2 Console

@tutorial_1120_p
 The settings of the H2 Console are stored in a configuration file called <code>.h2.server.properties</code> in you user home directory. For Windows installations, the user home directory is usually <code>C:\Documents and Settings\[username]</code>. The configuration file contains the settings of the application and is automatically created when the H2 Console is first started. 

@tutorial_1121_h2
Connecting to a Database using JDBC

@tutorial_1122_p
 To connect to a database, a Java application first needs to load the database driver, and then get a connection. A simple way to do that is using the following code: 

@tutorial_1123_p
 This code first loads the driver (<code>Class.forName(...)</code>) and then opens a connection (using <code>DriverManager.getConnection()</code>). The driver name is <code>"org.h2.Driver"</code>. The database URL always needs to start with <code>jdbc:h2:</code> to be recognized by this database. The second parameter in the <code>getConnection()</code> call is the user name (<code>sa</code> for System Administrator in this example). The third parameter is the password. In this database, user names are not case sensitive, but passwords are. 

@tutorial_1124_h2
Creating New Databases

@tutorial_1125_p
 By default, if the database specified in the URL does not yet exist, a new (empty) database is created automatically. The user that created the database automatically becomes the administrator of this database. 

@tutorial_1126_p
 Auto-creating new database can be disabled, see <a href="features.html#database_only_if_exists">Opening a Database Only if it Already Exists</a>. 

@tutorial_1127_h2
Using the Server

@tutorial_1128_p
 H2 currently supports three server: a web server (for the H2 Console), a TCP server (for client/server connections) and an PG server (for PostgreSQL clients). Please note that only the web server supports browser connections. The servers can be started in different ways, one is using the <code>Server</code> tool. 

@tutorial_1129_h3
Starting the Server Tool from Command Line

@tutorial_1130_p
 To start the <code>Server</code> tool from the command line with the default settings, run: 

@tutorial_1131_p
 This will start the tool with the default options. To get the list of options and default values, run: 

@tutorial_1132_p
 There are options available to use other ports, and start or not start parts. 

@tutorial_1133_h3
Connecting to the TCP Server

@tutorial_1134_p
 To remotely connect to a database using the TCP server, use the following driver and database URL: 

@tutorial_1135_li
JDBC driver class: <code>org.h2.Driver</code> 

@tutorial_1136_li
Database URL: <code>jdbc:h2:tcp://localhost/~/test</code> 

@tutorial_1137_p
 For details about the database URL, see also in Features. Please note that you can't connection with a web browser to this URL. You can only connect using a H2 client (over JDBC). 

@tutorial_1138_h3
Starting the TCP Server within an Application

@tutorial_1139_p
 Servers can also be started and stopped from within an application. Sample code: 

@tutorial_1140_h3
Stopping a TCP Server from Another Process

@tutorial_1141_p
 The TCP server can be stopped from another process. To stop the server from the command line, run: 

@tutorial_1142_p
 To stop the server from a user application, use the following code: 

@tutorial_1143_p
 This function will only stop the TCP server. If other server were started in the same process, they will continue to run. To avoid recovery when the databases are opened the next time, all connections to the databases should be closed before calling this method. To stop a remote server, remote connections must be enabled on the server. Shutting down a TCP server can be protected using the option <code>-tcpPassword</code> (the same password must be used to start and stop the TCP server). 

@tutorial_1144_h2
Using Hibernate

@tutorial_1145_p
 This database supports Hibernate version 3.1 and newer. You can use the HSQLDB Dialect, or the native H2 Dialect. Unfortunately the H2 Dialect included in some old versions of Hibernate was buggy. A <a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-3401">patch for Hibernate</a> has been submitted and is now applied. You can rename it to <code>H2Dialect.java</code> and include this as a patch in your application, or upgrade to a version of Hibernate where this is fixed. 

@tutorial_1146_p
 When using compatibility modes such as <code>MODE=MySQL</code> when using Hibernate is not supported when using <code>H2Dialect</code>. 

@tutorial_1147_h2
Using TopLink and Glassfish

@tutorial_1148_p
 To use H2 with Glassfish (or Sun AS), set the Datasource Classname to <code>org.h2.jdbcx.JdbcDataSource</code>. You can set this in the GUI at Application Server - Resources - JDBC - Connection Pools, or by editing the file <code>sun-resources.xml</code>: at element <code>jdbc-connection-pool</code>, set the attribute <code>datasource-classname</code> to <code>org.h2.jdbcx.JdbcDataSource</code>. 

@tutorial_1149_p
 The H2 database is compatible with HSQLDB and PostgreSQL. To take advantage of H2 specific features, use the <code>H2Platform</code>. The source code of this platform is included in H2 at <code>src/tools/oracle/toplink/essentials/platform/database/DatabasePlatform.java.txt</code>. You will need to copy this file to your application, and rename it to .java. To enable it, change the following setting in persistence.xml: 

@tutorial_1150_p
 In old versions of Glassfish, the property name is <code>toplink.platform.class.name</code>. 

@tutorial_1151_p
 To use H2 within Glassfish, copy the h2*.jar to the directory <code>glassfish/glassfish/lib</code>. 

@tutorial_1152_h2
Using EclipseLink

@tutorial_1153_p
 To use H2 in EclipseLink, use the platform class <code>org.eclipse.persistence.platform.database.H2Platform</code>. If this platform is not available in your version of EclipseLink, you can use the OraclePlatform instead in many case. See also <a href="http://wiki.eclipse.org/EclipseLink/Development/Incubator/Extensions/H2Platform">H2Platform</a>. 

@tutorial_1154_h2
Using Apache ActiveMQ

@tutorial_1155_p
 When using H2 as the backend database for Apache ActiveMQ, please use the <code>TransactDatabaseLocker</code> instead of the default locking mechanism. Otherwise the database file will grow without bounds. The problem is that the default locking mechanism uses an uncommitted <code>UPDATE</code> transaction, which keeps the transaction log from shrinking (causes the database file to grow). Instead of using an <code>UPDATE</code> statement, the <code>TransactDatabaseLocker</code> uses <code>SELECT ... FOR UPDATE</code> which is not problematic. To use it, change the ApacheMQ configuration element <code>&lt;jdbcPersistenceAdapter&gt;</code> element, property <code>databaseLocker="org.apache.activemq.store.jdbc.adapter.TransactDatabaseLocker"</code>. However, using the MVCC mode will again result in the same problem. Therefore, please do not use the MVCC mode in this case. Another (more dangerous) solution is to set <code>useDatabaseLock</code> to false. 

@tutorial_1156_h2
Using H2 within NetBeans

@tutorial_1157_p
 The project <a href="http://kenai.com/projects/nbh2">H2 Database Engine Support For NetBeans</a> allows you to start and stop the H2 server from within the IDE. 

@tutorial_1158_h2
Using Databases in Web Applications

@tutorial_1159_p
 There are multiple ways to access a database from within web applications. Here are some examples if you use Tomcat or JBoss. 

@tutorial_1160_h3
Embedded Mode

@tutorial_1161_p
 The (currently) simplest solution is to use the database in the embedded mode, that means open a connection in your application when it starts (a good solution is using a Servlet Listener, see below), or when a session starts. A database can be accessed from multiple sessions and applications at the same time, as long as they run in the same process. Most Servlet Containers (for example Tomcat) are just using one process, so this is not a problem (unless you run Tomcat in clustered mode). Tomcat uses multiple threads and multiple classloaders. If multiple applications access the same database at the same time, you need to put the database jar in the <code>shared/lib</code> or <code>server/lib</code> directory. It is a good idea to open the database when the web application starts, and close it when the web application stops. If using multiple applications, only one (any) of them needs to do that. In the application, an idea is to use one connection per Session, or even one connection per request (action). Those connections should be closed after use if possible (but it's not that bad if they don't get closed). 

@tutorial_1162_h3
Server Mode

@tutorial_1163_p
 The server mode is similar, but it allows you to run the server in another process. 

@tutorial_1164_h3
Using a Servlet Listener to Start and Stop a Database

@tutorial_1165_p
 Add the h2*.jar file to your web application, and add the following snippet to your web.xml file (between the <code>context-param</code> and the <code>filter</code> section): 

@tutorial_1166_p
 For details on how to access the database, see the file <code>DbStarter.java</code>. By default this tool opens an embedded connection using the database URL <code>jdbc:h2:~/test</code>, user name <code>sa</code>, and password <code>sa</code>. If you want to use this connection within your servlet, you can access as follows: 

@tutorial_1167_code
DbStarter

@tutorial_1168_p
 can also start the TCP server, however this is disabled by default. To enable it, use the parameter <code>db.tcpServer</code> in the file <code>web.xml</code>. Here is the complete list of options. These options need to be placed between the <code>description</code> tag and the <code>listener</code> / <code>filter</code> tags: 

@tutorial_1169_p
 When the web application is stopped, the database connection will be closed automatically. If the TCP server is started within the <code>DbStarter</code>, it will also be stopped automatically. 

@tutorial_1170_h3
Using the H2 Console Servlet

@tutorial_1171_p
 The H2 Console is a standalone application and includes its own web server, but it can be used as a servlet as well. To do that, include the the <code>h2*.jar</code> file in your application, and add the following configuration to your <code>web.xml</code>: 

@tutorial_1172_p
 For details, see also <code>src/tools/WEB-INF/web.xml</code>. 

@tutorial_1173_p
 To create a web application with just the H2 Console, run the following command: 

@tutorial_1174_h2
Android

@tutorial_1175_p
 You can use this database on an Android device (using the Dalvik VM) instead of or in addition to SQLite. So far, only very few tests and benchmarks were run, but it seems that performance is very similar to SQLite, except for opening and closing a database, which is not yet optimized in H2 (H2 takes about 0.2 seconds, and SQLite about 0.02 seconds). So far, only very few tests have been run, and everything seems to work as expected. Fulltext search was not yet tested, however the native fulltext search should work. 

@tutorial_1176_p
 Reasons to use H2 instead of SQLite are: 

@tutorial_1177_li
Full Unicode support including UPPER() and LOWER() (unlike SQLite). 

@tutorial_1178_li
Streaming API for BLOB and CLOB data. 

@tutorial_1179_li
Fulltext search. 

@tutorial_1180_li
Multiple connections. 

@tutorial_1181_li
User defined functions and triggers. 

@tutorial_1182_li
Database file encryption. 

@tutorial_1183_li
Reading and writing CSV files (this feature can be used out side the database as well). 

@tutorial_1184_li
Referential integrity and check constraints. 

@tutorial_1185_li
Better data type and SQL support. 

@tutorial_1186_li
In-memory databases, read-only databases, linked tables. 

@tutorial_1187_li
Better compatibility with other databases which simplifies porting applications. 

@tutorial_1188_li
Possibly better performance. 

@tutorial_1189_p
 Currently only the JDBC API is supported (it is planned to support the Android database API in future releases). Both the regular H2 jar file and the smaller <code>h2small-*.jar</code> can be used. To create the smaller jar file, run the command <code>./build.sh jarSmall</code> (Linux / Mac OS) or <code>build.bat jarSmall</code> (Windows). 

@tutorial_1190_p
 The database files needs to be stored in a place that is accessible for the application. Example: 

@tutorial_1191_h2
CSV (Comma Separated Values) Support

@tutorial_1192_p
 The CSV file support can be used inside the database using the functions <code>CSVREAD</code> and <code>CSVWRITE</code>, or it can be used outside the database as a standalone tool. 

@tutorial_1193_h3
Reading a CSV File from Within a Database

@tutorial_1194_p
 A CSV file can be read using the function <code>CSVREAD</code>. Example: 

@tutorial_1195_h3
Importing Data from a CSV File

@tutorial_1196_p
 A fast way to load or import data (sometimes called 'bulk load') from a CSV file is to combine table creation with import. Optionally, the column names and data types can be set when creating the table. Another option is to use <code>INSERT INTO ... SELECT</code>. 

@tutorial_1197_h3
Writing a CSV File from Within a Database

@tutorial_1198_p
 The built-in function <code>CSVWRITE</code> can be used to create a CSV file from a query. Example: 

@tutorial_1199_h3
Writing a CSV File from a Java Application

@tutorial_1200_p
 The <code>Csv</code> tool can be used in a Java application even when not using a database at all. Example: 

@tutorial_1201_h3
Reading a CSV File from a Java Application

@tutorial_1202_p
 It is possible to read a CSV file without opening a database. Example: 

@tutorial_1203_h2
Upgrade, Backup, and Restore

@tutorial_1204_h3
Database Upgrade

@tutorial_1205_p
 The recommended way to upgrade from one version of the database engine to the next version is to create a backup of the database (in the form of a SQL script) using the old engine, and then execute the SQL script using the new engine. 

@tutorial_1206_h3
Backup using the Script Tool

@tutorial_1207_p
 There are different ways to backup a database. For example, it is possible to copy the database files. However, this is not recommended while the database is in use. Also, the database files are not human readable and quite large. The recommended way to backup a database is to create a compressed SQL script file. This can be done using the <code>Script</code> tool: 

@tutorial_1208_p
 It is also possible to use the SQL command <code>SCRIPT</code> to create the backup of the database. For more information about the options, see the SQL command <code>SCRIPT</code>. The backup can be done remotely, however the file will be created on the server side. The built in FTP server could be used to retrieve the file from the server. 

@tutorial_1209_h3
Restore from a Script

@tutorial_1210_p
 To restore a database from a SQL script file, you can use the <code>RunScript</code> tool: 

@tutorial_1211_p
 For more information about the options, see the SQL command <code>RUNSCRIPT</code>. The restore can be done remotely, however the file needs to be on the server side. The built in FTP server could be used to copy the file to the server. It is also possible to use the SQL command <code>RUNSCRIPT</code> to execute a SQL script. SQL script files may contain references to other script files, in the form of <code>RUNSCRIPT</code> commands. However, when using the server mode, the references script files need to be available on the server side. 

@tutorial_1212_h3
Online Backup

@tutorial_1213_p
 The <code>BACKUP</code> SQL statement and the <code>Backup</code> tool both create a zip file with all database files. However, the contents of this file are not human readable. 

@tutorial_1214_p
 The resulting backup is transactionally consistent, meaning the consistency and atomicity rules apply. 

@tutorial_1215_p
 The <code>Backup</code> tool (<code>org.h2.tools.Backup</code>) can not be used to create a online backup; the database must not be in use while running this program. 

@tutorial_1216_p
 Creating a backup by copying the database files while the database is running is not supported, except if the file systems support creating snapshots. The problem is that it can't be guaranteed that the data is copied in the right order. 

@tutorial_1217_h2
Command Line Tools

@tutorial_1218_p
 This database comes with a number of command line tools. To get more information about a tool, start it with the parameter '-?', for example: 

@tutorial_1219_p
 The command line tools are: 

@tutorial_1220_code
Backup

@tutorial_1221_li
 creates a backup of a database. 

@tutorial_1222_code
ChangeFileEncryption

@tutorial_1223_li
 allows changing the file encryption password or algorithm of a database. 

@tutorial_1224_code
Console

@tutorial_1225_li
 starts the browser based H2 Console. 

@tutorial_1226_code
ConvertTraceFile

@tutorial_1227_li
 converts a .trace.db file to a Java application and SQL script. 

@tutorial_1228_code
CreateCluster

@tutorial_1229_li
 creates a cluster from a standalone database. 

@tutorial_1230_code
DeleteDbFiles

@tutorial_1231_li
 deletes all files belonging to a database. 

@tutorial_1232_code
Recover

@tutorial_1233_li
 helps recovering a corrupted database. 

@tutorial_1234_code
Restore

@tutorial_1235_li
 restores a backup of a database. 

@tutorial_1236_code
RunScript

@tutorial_1237_li
 runs a SQL script against a database. 

@tutorial_1238_code
Script

@tutorial_1239_li
 allows converting a database to a SQL script for backup or migration. 

@tutorial_1240_code
Server

@tutorial_1241_li
 is used in the server mode to start a H2 server. 

@tutorial_1242_code
Shell

@tutorial_1243_li
 is a command line database tool. 

@tutorial_1244_p
 The tools can also be called from an application by calling the main or another public method. For details, see the Javadoc documentation. 

@tutorial_1245_h2
The Shell Tool

@tutorial_1246_p
 The Shell tool is a simple interactive command line tool. To start it, type: 

@tutorial_1247_p
 You will be asked for a database URL, JDBC driver, user name, and password. The connection setting can also be set as command line parameters. After connecting, you will get the list of options. The built-in commands don't need to end with a semicolon, but SQL statements are only executed if the line ends with a semicolon <code>;</code>. This allows to enter multi-line statements: 

@tutorial_1248_p
 By default, results are printed as a table. For results with many column, consider using the list mode: 

@tutorial_1249_h2
Using OpenOffice Base

@tutorial_1250_p
 OpenOffice.org Base supports database access over the JDBC API. To connect to a H2 database using OpenOffice Base, you first need to add the JDBC driver to OpenOffice. The steps to connect to a H2 database are: 

@tutorial_1251_li
Start OpenOffice Writer, go to [Tools], [Options] 

@tutorial_1252_li
Make sure you have selected a Java runtime environment in OpenOffice.org / Java 

@tutorial_1253_li
Click [Class Path...], [Add Archive...] 

@tutorial_1254_li
Select your h2 jar file (location is up to you, could be wherever you choose) 

@tutorial_1255_li
Click [OK] (as much as needed), stop OpenOffice (including the Quickstarter) 

@tutorial_1256_li
Start OpenOffice Base 

@tutorial_1257_li
Connect to an existing database; select [JDBC]; [Next] 

@tutorial_1258_li
Example datasource URL: <code>jdbc:h2:~/test</code> 

@tutorial_1259_li
JDBC driver class: <code>org.h2.Driver</code> 

@tutorial_1260_p
 Now you can access the database stored in the current users home directory. 

@tutorial_1261_p
 To use H2 in NeoOffice (OpenOffice without X11): 

@tutorial_1262_li
In NeoOffice, go to [NeoOffice], [Preferences] 

@tutorial_1263_li
Look for the page under [NeoOffice], [Java] 

@tutorial_1264_li
Click [Class Path], [Add Archive...] 

@tutorial_1265_li
Select your h2 jar file (location is up to you, could be wherever you choose) 

@tutorial_1266_li
Click [OK] (as much as needed), restart NeoOffice. 

@tutorial_1267_p
 Now, when creating a new database using the "Database Wizard" : 

@tutorial_1268_li
Click [File], [New], [Database]. 

@tutorial_1269_li
Select [Connect to existing database] and the select [JDBC]. Click next. 

@tutorial_1270_li
Example datasource URL: <code>jdbc:h2:~/test</code> 

@tutorial_1271_li
JDBC driver class: <code>org.h2.Driver</code> 

@tutorial_1272_p
 Another solution to use H2 in NeoOffice is: 

@tutorial_1273_li
Package the h2 jar within an extension package 

@tutorial_1274_li
Install it as a Java extension in NeoOffice 

@tutorial_1275_p
 This can be done by create it using the NetBeans OpenOffice plugin. See also <a href="http://wiki.services.openoffice.org/wiki/Extensions_development_java">Extensions Development</a>. 

@tutorial_1276_h2
Java Web Start / JNLP

@tutorial_1277_p
 When using Java Web Start / JNLP (Java Network Launch Protocol), permissions tags must be set in the .jnlp file, and the application .jar file must be signed. Otherwise, when trying to write to the file system, the following exception will occur: <code>java.security.AccessControlException</code>: access denied (<code>java.io.FilePermission ... read</code>). Example permission tags: 

@tutorial_1278_h2
Using a Connection Pool

@tutorial_1279_p
 For H2, opening a connection is fast if the database is already open. Still, using a connection pool improves performance if you open and close connections a lot. A simple connection pool is included in H2. It is based on the <a href="http://www.source-code.biz/snippets/java/8.htm">Mini Connection Pool Manager</a> from Christian d'Heureuse. There are other, more complex, open source connection pools available, for example the <a href="http://jakarta.apache.org/commons/dbcp/">Apache Commons DBCP</a>. For H2, it is about twice as faster to get a connection from the built-in connection pool than to get one using <code>DriverManager.getConnection()</code>.The build-in connection pool is used as follows: 

@tutorial_1280_h2
Fulltext Search

@tutorial_1281_p
 H2 includes two fulltext search implementations. One is using Apache Lucene, and the other (the native implementation) stores the index data in special tables in the database. 

@tutorial_1282_h3
Using the Native Fulltext Search

@tutorial_1283_p
 To initialize, call: 

@tutorial_1284_p
 You need to initialize it in each database where you want to use it. Afterwards, you can create a fulltext index for a table using: 

@tutorial_1285_p
 PUBLIC is the schema name, TEST is the table name. The list of column names (column separated) is optional, in this case all columns are indexed. The index is updated in realtime. To search the index, use the following query: 

@tutorial_1286_p
 This will produce a result set that contains the query needed to retrieve the data: 

@tutorial_1287_p
 To get the raw data, use <code>FT_SEARCH_DATA('Hello', 0, 0);</code>. The result contains the columns <code>SCHEMA</code> (the schema name), <code>TABLE</code> (the table name), <code>COLUMNS</code> (an array of column names), and <code>KEYS</code> (an array of objects). To join a table, use a join as in: <code>SELECT T.* FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T WHERE FT.TABLE='TEST' AND T.ID=FT.KEYS[0];</code> 

@tutorial_1288_p
 You can also call the index from within a Java application: 

@tutorial_1289_h3
Using the Lucene Fulltext Search

@tutorial_1290_p
 To use the Lucene full text search, you need the Lucene library in the classpath. Currently Apache Lucene version 2.x is used by default for H2 version 1.2.x, and Lucene version 3.x is used by default for H2 version 1.3.x. How to do that depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. To initialize the Lucene fulltext search in a database, call: 

@tutorial_1291_p
 You need to initialize it in each database where you want to use it. Afterwards, you can create a full text index for a table using: 

@tutorial_1292_p
 PUBLIC is the schema name, TEST is the table name. The list of column names (column separated) is optional, in this case all columns are indexed. The index is updated in realtime. To search the index, use the following query: 

@tutorial_1293_p
 This will produce a result set that contains the query needed to retrieve the data: 

@tutorial_1294_p
 To get the raw data, use <code>FTL_SEARCH_DATA('Hello', 0, 0);</code>. The result contains the columns <code>SCHEMA</code> (the schema name), <code>TABLE</code> (the table name), <code>COLUMNS</code> (an array of column names), and <code>KEYS</code> (an array of objects). To join a table, use a join as in: <code>SELECT T.* FROM FTL_SEARCH_DATA('Hello', 0, 0) FT, TEST T WHERE FT.TABLE='TEST' AND T.ID=FT.KEYS[0];</code> 

@tutorial_1295_p
 You can also call the index from within a Java application: 

@tutorial_1296_h2
User-Defined Variables

@tutorial_1297_p
 This database supports user-defined variables. Variables start with <code>@</code> and can be used wherever expressions or parameters are allowed. Variables are not persisted and session scoped, that means only visible from within the session in which they are defined. A value is usually assigned using the SET command: 

@tutorial_1298_p
 The value can also be changed using the SET() method. This is useful in queries: 

@tutorial_1299_p
 Variables that are not set evaluate to <code>NULL</code>. The data type of a user-defined variable is the data type of the value assigned to it, that means it is not necessary (or possible) to declare variable names before using them. There are no restrictions on the assigned values; large objects (LOBs) are supported as well. 

@tutorial_1300_h2
Date and Time

@tutorial_1301_p
 Date, time and timestamp values support ISO 8601 formatting, including time zone: 

@tutorial_1302_p
 If the time zone is not set, the value is parsed using the current time zone setting of the system. Date and time information is stored in H2 database files without time zone information. If the database is opened using another system time zone, the date and time will be the same. That means if you store the value '2000-01-01 12:00:00' in one time zone, then close the database and open the database again in a different time zone, you will also get '2000-01-01 12:00:00'. Please note that changing the time zone after the H2 driver is loaded is not supported. 

@tutorial_1303_h2
Using Spring

@tutorial_1304_p
 Use the following configuration to start and stop the H2 TCP server using the Spring Framework: 

@tutorial_1305_p
 The <code>destroy-method</code> will help prevent exceptions on hot-redeployment or when restarting the server. 

@tutorial_1306_h2
Java Management Extension (JMX)

@tutorial_1307_p
 Management over JMX is supported, but not enabled by default. To enable JMX, append <code>;JMX=TRUE</code> to the database URL when opening the database. Various tools support JMX, one such tool is the <code>jconsole</code>. When opening the <code>jconsole</code>, connect to the process where the database is open (when using the server mode, you need to connect to the server process). Then go to the <code>MBeans</code> section. Under <code>org.h2</code> you will find one entry per database. The object name of the entry is the database short name, plus the path (each colon is replaced with an underscore character). 

@tutorial_1308_p
 The following attributes and operations are supported: 

@tutorial_1309_code
CacheSize

@tutorial_1310_li
: the cache size currently in use in KB. 

@tutorial_1311_code
CacheSizeMax

@tutorial_1312_li
 (read/write): the maximum cache size in KB. 

@tutorial_1313_code
Exclusive

@tutorial_1314_li
: whether this database is open in exclusive mode or not. 

@tutorial_1315_code
FileReadCount

@tutorial_1316_li
: the number of file read operations since the database was opened. 

@tutorial_1317_code
FileSize

@tutorial_1318_li
: the file size in KB. 

@tutorial_1319_code
FileWriteCount

@tutorial_1320_li
: the number of file write operations since the database was opened. 

@tutorial_1321_code
FileWriteCountTotal

@tutorial_1322_li
: the number of file write operations since the database was created. 

@tutorial_1323_code
LogMode

@tutorial_1324_li
 (read/write): the current transaction log mode. See <code>SET LOG</code> for details. 

@tutorial_1325_code
Mode

@tutorial_1326_li
: the compatibility mode (<code>REGULAR</code> if no compatibility mode is used). 

@tutorial_1327_code
MultiThreaded

@tutorial_1328_li
: true if multi-threaded is enabled. 

@tutorial_1329_code
Mvcc

@tutorial_1330_li
: true if <code>MVCC</code> is enabled. 

@tutorial_1331_code
ReadOnly

@tutorial_1332_li
: true if the database is read-only. 

@tutorial_1333_code
TraceLevel

@tutorial_1334_li
 (read/write): the file trace level. 

@tutorial_1335_code
Version

@tutorial_1336_li
: the database version in use. 

@tutorial_1337_code
listSettings

@tutorial_1338_li
: list the database settings. 

@tutorial_1339_code
listSessions

@tutorial_1340_li
: list the open sessions, including currently executing statement (if any) and locked tables (if any).