advanced_1000_b=Search\: advanced_1001_td=Highlight keyword(s) advanced_1002_a=Home advanced_1003_a=Download advanced_1004_a=Cheat Sheet advanced_1005_b=Documentation advanced_1006_a=Quickstart advanced_1007_a=Installation advanced_1008_a=Tutorial advanced_1009_a=Features advanced_1010_a=Performance advanced_1011_a=Advanced advanced_1012_b=Reference advanced_1013_a=SQL Grammar advanced_1014_a=Functions advanced_1015_a=Data Types advanced_1016_a=Javadoc advanced_1017_a=PDF (1 MB) advanced_1018_b=Support advanced_1019_a=FAQ advanced_1020_a=Error Analyzer advanced_1021_a=Google Group (English) advanced_1022_a=Google Group (Japanese) advanced_1023_a=Google Group (Chinese) advanced_1024_b=Appendix advanced_1025_a=JaQu advanced_1026_a=Build advanced_1027_a=History & Roadmap advanced_1028_a=Links advanced_1029_a=License advanced_1030_td= advanced_1031_h1=Advanced advanced_1032_a=\ Result Sets advanced_1033_a=\ Large Objects advanced_1034_a=\ Linked Tables advanced_1035_a=\ Transaction Isolation advanced_1036_a=\ Multi-Version Concurrency Control (MVCC) advanced_1037_a=\ Clustering / High Availability advanced_1038_a=\ Two Phase Commit advanced_1039_a=\ Compatibility advanced_1040_a=\ Standards Compliance advanced_1041_a=\ Run as Windows Service advanced_1042_a=\ ODBC Driver advanced_1043_a=\ Using H2 in Microsoft .NET advanced_1044_a=\ ACID advanced_1045_a=\ Durability Problems advanced_1046_a=\ Using the Recover Tool advanced_1047_a=\ File Locking Protocols advanced_1048_a=\ File Locking Method 'Serialized' advanced_1049_a=\ Protection against SQL Injection advanced_1050_a=\ Protection against Remote Access advanced_1051_a=\ Restricting Class Loading and Usage advanced_1052_a=\ Security Protocols advanced_1053_a=\ SSL/TLS Connections advanced_1054_a=\ Universally Unique Identifiers (UUID) advanced_1055_a=\ Settings Read from System Properties advanced_1056_a=\ Setting the Server Bind Address advanced_1057_a=\ Pluggable File System advanced_1058_a=\ Limits and Limitations advanced_1059_a=\ Glossary and Links advanced_1060_h2=Result Sets advanced_1061_h3=Statements that Return a Result Set advanced_1062_p=\ The following statements return a result set\: <code>SELECT, EXPLAIN, CALL, SCRIPT, SHOW, HELP</code>. All other statements return an update count. advanced_1063_h3=Limiting the Number of Rows advanced_1064_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_1065_h3=Large Result Sets and External Sorting advanced_1066_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_1067_h2=Large Objects advanced_1068_h3=Storing and Reading Large Objects advanced_1069_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_1070_h3=When to use CLOB/BLOB advanced_1071_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_1072_h3=Large Object Compression advanced_1073_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_1074_h2=Linked Tables advanced_1075_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_1076_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_1077_p=\ To view the statements that are executed against the target table, set the trace level to 3. advanced_1078_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_1079_p=\ The statement <a href\="grammar.html\#create_linked_table" class\="notranslate" >CREATE LINKED TABLE</a> supports an optional schema name parameter. advanced_1080_h2=Transaction Isolation advanced_1081_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_1082_p=\ This database supports the following transaction isolation levels\: advanced_1083_b=Read Committed advanced_1084_li=\ This is the default level. Read locks are released immediately. Higher concurrency is possible when using this level. advanced_1085_li=\ To enable, execute the SQL statement <code>SET LOCK_MODE 3</code> advanced_1086_li=\ or append <code>;LOCK_MODE\=3</code> to the database URL\: <code>jdbc\:h2\:~/test;LOCK_MODE\=3</code> advanced_1087_b=Serializable advanced_1088_li=\ To enable, execute the SQL statement <code>SET LOCK_MODE 1</code> advanced_1089_li=\ or append <code>;LOCK_MODE\=1</code> to the database URL\: <code>jdbc\:h2\:~/test;LOCK_MODE\=1</code> advanced_1090_b=Read Uncommitted advanced_1091_li=\ This level means that transaction isolation is disabled. advanced_1092_li=\ To enable, execute the SQL statement <code>SET LOCK_MODE 0</code> advanced_1093_li=\ or append <code>;LOCK_MODE\=0</code> to the database URL\: <code>jdbc\:h2\:~/test;LOCK_MODE\=0</code> advanced_1094_p=\ When using the isolation level 'serializable', dirty reads, non-repeatable reads, and phantom reads are prohibited. advanced_1095_b=Dirty Reads advanced_1096_li=\ Means a connection can read uncommitted changes made by another connection. advanced_1097_li=\ Possible with\: read uncommitted advanced_1098_b=Non-Repeatable Reads advanced_1099_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_1100_li=\ Possible with\: read uncommitted, read committed advanced_1101_b=Phantom Reads advanced_1102_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_1103_li=\ Possible with\: read uncommitted, read committed advanced_1104_h3=Table Level Locking advanced_1105_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. advanced_1106_h3=Lock Timeout advanced_1107_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_1108_h2=Multi-Version Concurrency Control (MVCC) advanced_1109_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_1110_p=\ To use the MVCC feature, append <code>;MVCC\=TRUE</code> to the database URL\: advanced_1111_p=\ 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). advanced_1112_h2=Clustering / High Availability advanced_1113_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_1114_p=\ Clustering can only be used in the server mode (the embedded mode does not support clustering). It is possible to restore the cluster without stopping the server, however it is critical that no other application is changing the data in the first database while the second database is restored, so restoring the cluster is currently a manual process. advanced_1115_p=\ To initialize the cluster, use the following steps\: advanced_1116_li=Create a database advanced_1117_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_1118_li=Start two servers (one for each copy of the database) advanced_1119_li=You are now ready to connect to the databases with the client application(s) advanced_1120_h3=Using the CreateCluster Tool advanced_1121_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_1122_li=Create two directories\: <code>server1, server2</code>. Each directory will simulate a directory on a computer. advanced_1123_li=Start a TCP server pointing to the first directory. You can do this using the command line\: advanced_1124_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_1125_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_1126_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_1127_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_1128_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_1129_h3=Detect Which Cluster Instances are Running advanced_1130_p=\ To find out which cluster nodes are currently running, execute the following SQL statement\: advanced_1131_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_1132_h3=Clustering Algorithm and Limitations advanced_1133_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_1134_h2=Two Phase Commit advanced_1135_p=\ The two phase commit protocol is supported. 2-phase-commit works as follows\: advanced_1136_li=Autocommit needs to be switched off advanced_1137_li=A transaction is started, for example by inserting a row advanced_1138_li=The transaction is marked 'prepared' by executing the SQL statement <code>PREPARE COMMIT transactionName</code> advanced_1139_li=The transaction can now be committed or rolled back advanced_1140_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_1141_li=When re-connecting to the database, the in-doubt transactions can be listed with <code>SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT</code> advanced_1142_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_1143_li=The database needs to be closed and re-opened to apply the changes advanced_1144_h2=Compatibility advanced_1145_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_1146_h3=Transaction Commit when Autocommit is On advanced_1147_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_1148_h3=Keywords / Reserved Words advanced_1149_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_1150_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, WHERE advanced_1151_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_1152_h2=Standards Compliance advanced_1153_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_1154_h2=Run as Windows Service advanced_1155_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_1156_h3=Install the Service advanced_1157_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_1158_h3=Start the Service advanced_1159_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_1160_h3=Connect to the H2 Console advanced_1161_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_1162_h3=Stop the Service advanced_1163_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_1164_h3=Uninstall the Service advanced_1165_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_1166_h2=ODBC Driver advanced_1167_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_1168_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_1169_h3=ODBC Installation advanced_1170_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_1171_h3=Starting the Server advanced_1172_p=\ After installing the ODBC driver, start the H2 Server using the command line\: advanced_1173_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_1174_p=\ The PG server can be started and stopped from within a Java application as follows\: advanced_1175_p=\ By default, only connections from localhost are allowed. To allow remote connections, use <code>-pgAllowOthers</code> when starting the server. advanced_1176_h3=ODBC Configuration advanced_1177_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\: advanced_1178_th=Property advanced_1179_th=Example advanced_1180_th=Remarks advanced_1181_td=Data Source advanced_1182_td=H2 Test advanced_1183_td=The name of the ODBC Data Source advanced_1184_td=Database advanced_1185_td=test advanced_1186_td=\ The database name. Only simple names are supported at this time; advanced_1187_td=\ relative or absolute path are not supported in the database name. advanced_1188_td=\ By default, the database is stored in the current working directory advanced_1189_td=\ where the Server is started except when the -baseDir setting is used. advanced_1190_td=\ The name must be at least 3 characters. advanced_1191_td=Server advanced_1192_td=localhost advanced_1193_td=The server name or IP address. advanced_1194_td=By default, only remote connections are allowed advanced_1195_td=User Name advanced_1196_td=sa advanced_1197_td=The database user name. advanced_1198_td=SSL Mode advanced_1199_td=disabled advanced_1200_td=At this time, SSL is not supported. advanced_1201_td=Port advanced_1202_td=5435 advanced_1203_td=The port where the PG Server is listening. advanced_1204_td=Password advanced_1205_td=sa advanced_1206_td=The database password. advanced_1207_p=\ To improve performance, please enable 'server side prepare' under Options / Datasource / Page 2 / Server side prepare. advanced_1208_p=\ Afterwards, you may use this data source. advanced_1209_h3=PG Protocol Support Limitations advanced_1210_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. advanced_1211_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_1212_h3=Security Considerations advanced_1213_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_1214_h2=Using H2 in Microsoft .NET advanced_1215_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_1216_h3=Using the ADO.NET API on .NET advanced_1217_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_1218_h3=Using the JDBC API on .NET advanced_1219_li=Install the .NET Framework from <a href\="http\://www.microsoft.com">Microsoft</a>. Mono has not yet been tested. advanced_1220_li=Install <a href\="http\://www.ikvm.net">IKVM.NET</a>. advanced_1221_li=Copy the <code>h2*.jar</code> file to <code>ikvm/bin</code> advanced_1222_li=Run the H2 Console using\: <code>ikvm -jar h2*.jar</code> advanced_1223_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_1224_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_1225_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_1226_h2=ACID advanced_1227_p=\ In the database world, ACID stands for\: advanced_1228_li=Atomicity\: transactions must be atomic, meaning either all tasks are performed or none. advanced_1229_li=Consistency\: all operations must comply with the defined constraints. advanced_1230_li=Isolation\: transactions must be isolated from each other. advanced_1231_li=Durability\: committed transaction will not be lost. advanced_1232_h3=Atomicity advanced_1233_p=\ Transactions in this database are always atomic. advanced_1234_h3=Consistency advanced_1235_p=\ By default, this database is always in a consistent state. Referential integrity rules are enforced except when explicitly disabled. advanced_1236_h3=Isolation advanced_1237_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_1238_h3=Durability advanced_1239_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_1240_h2=Durability Problems advanced_1241_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_1242_h3=Ways to (Not) Achieve Durability advanced_1243_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_1244_code=rwd advanced_1245_li=\: every update to the file's content is written synchronously to the underlying storage device. advanced_1246_code=rws advanced_1247_li=\: in addition to <code>rwd</code>, every update to the metadata is written synchronously. advanced_1248_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_1249_p=\ Calling <code>fsync</code> flushes the buffers. There are two ways to do that in Java\: advanced_1250_code=FileDescriptor.sync() advanced_1251_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_1252_code=FileChannel.force() advanced_1253_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_1254_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_1255_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_1256_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_1257_h3=Running the Durability Test advanced_1258_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_1259_h2=Using the Recover Tool advanced_1260_p=\ The <code>Recover</code> tool can be used to extract the contents of a data file, even if the database is corrupted. It also extracts the content of the log file or large objects (CLOB or BLOB). To run the tool, type on the command line\: advanced_1261_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_1262_p=\ The <code>Recover</code> tool creates a SQL script from database files. It also processes the transaction log file(s), however it does not automatically apply those changes. Usually, many of those changes are already applied in the database. advanced_1263_h2=File Locking Protocols advanced_1264_p=\ 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 terminates, this lock file is deleted. advanced_1265_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_1266_p=\ The file locking protocols 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_1267_h3=File Locking Method 'File' advanced_1268_p=\ The default method for database file locking is the 'File Method'. The algorithm is\: advanced_1269_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_1270_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_1271_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_1272_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_1273_h3=File Locking Method 'Socket' advanced_1274_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_1275_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_1276_li=If the lock file exists, and the lock method is 'file', then the software switches to the 'file' method. advanced_1277_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_1278_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_1279_h2=File Locking Method 'Serialized' advanced_1280_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_1281_p=\ To enable this feature, append <code>;FILE_LOCK\=SERIALIZED</code> to the database URL. advanced_1282_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_1283_h2=Protection against SQL Injection advanced_1284_h3=What is SQL Injection advanced_1285_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_1286_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_1287_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_1288_h3=Disabling Literals advanced_1289_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_1290_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_1291_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_1292_h3=Using Constants advanced_1293_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_1294_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_1295_h3=Using the ZERO() Function advanced_1296_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_1297_h2=Protection against Remote Access advanced_1298_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. Also, ensure the existing accessible databases are protected using a strong password. advanced_1299_h2=Restricting Class Loading and Usage advanced_1300_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_1301_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_1302_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_1303_h2=Security Protocols advanced_1304_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_1305_h3=User Password Encryption advanced_1306_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_1307_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_1308_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_1309_h3=File Encryption advanced_1310_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 about twice as fast as AES) and to have an alternative algorithm if AES is suddenly broken. advanced_1311_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_1312_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_1313_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_1314_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_1315_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_1316_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_1317_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_1318_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_1319_h3=Wrong Password / User Name Delay advanced_1320_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_1321_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_1322_h3=HTTPS Connections advanced_1323_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_1324_h2=SSL/TLS Connections advanced_1325_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_1326_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_1327_p=\ To disable anonymous SSL, set the system property <code>h2.enableAnonymousSSL</code> to false. advanced_1328_h2=Universally Unique Identifiers (UUID) advanced_1329_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_1330_p=\ Some values are\: advanced_1331_th=Number of UUIs advanced_1332_th=Probability of Duplicates advanced_1333_td=2^36\=68'719'476'736 advanced_1334_td=0.000'000'000'000'000'4 advanced_1335_td=2^41\=2'199'023'255'552 advanced_1336_td=0.000'000'000'000'4 advanced_1337_td=2^46\=70'368'744'177'664 advanced_1338_td=0.000'000'000'4 advanced_1339_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_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=nio\: advanced_1351_li=\ file system that uses <code>FileChannel</code> instead of <code>RandomAccessFile</code> (faster in some operating systems). advanced_1352_code=nioMapped\: advanced_1353_li=\ file system that uses memory mapped files (faster in some operating systems). advanced_1354_code=split\: advanced_1355_li=\ file system that splits files in 1 GB files (stackable with other file systems). advanced_1356_code=memFS\: advanced_1357_li=\ in-memory file system (experimental; used for testing). advanced_1358_code=memLZF\: advanced_1359_li=\ compressing in-memory file system (experimental; used for testing). 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=Limits and Limitations advanced_1363_p=\ This database has the following known limitations\: advanced_1364_li=Database file size limits (excluding BLOB and CLOB data)\: With the default storage mechanism, the maximum file size is currently 256 GB for the data, and 256 GB for the index. With the page store (experimental)\: 4 TB or higher. advanced_1365_li=BLOB and CLOB size limit\: every CLOB or BLOB can be up to 256 GB. advanced_1366_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_1367_li=The maximum number of rows per table is 2'147'483'648. advanced_1368_li=Main memory requirements\: The larger the database, the more main memory is required. With the default storage mechanism, the minimum main memory required for a 12 GB database is around 240 MB. With the page store (experimental), the minimum main memory required is much lower, around 1 MB for each 8 GB database file size. advanced_1369_li=Limit on the complexity of SQL statements. Statements of the following form will result in a stack overflow exception\: advanced_1370_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_1371_li=For limitations on data types, see the documentation of the respective Java data type or the data type documentation of this database. advanced_1372_h2=Glossary and Links advanced_1373_th=Term advanced_1374_th=Description advanced_1375_td=AES-128 advanced_1376_td=A block encryption algorithm. See also\: <a href\="http\://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Wikipedia\: AES</a> advanced_1377_td=Birthday Paradox advanced_1378_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_1379_td=Digest advanced_1380_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_1381_td=GCJ advanced_1382_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_1383_td=HTTPS advanced_1384_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_1385_td=Modes of Operation advanced_1386_a=Wikipedia\: Block cipher modes of operation advanced_1387_td=Salt advanced_1388_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_1389_td=SHA-256 advanced_1390_td=A cryptographic one-way hash function. See also\: <a href\="http\://en.wikipedia.org/wiki/SHA_family">Wikipedia\: SHA hash functions</a> advanced_1391_td=SQL Injection advanced_1392_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_1393_td=Watermark Attack advanced_1394_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_1395_td=SSL/TLS advanced_1396_td=Secure Sockets Layer / Transport Layer Security. See also\: <a href\="http\://java.sun.com/products/jsse/">Java Secure Socket Extension (JSSE)</a> advanced_1397_td=XTEA advanced_1398_td=A block encryption algorithm. See also\: <a href\="http\://en.wikipedia.org/wiki/XTEA">Wikipedia\: XTEA</a> build_1000_b=Search\: build_1001_td=Highlight keyword(s) build_1002_a=Home build_1003_a=Download build_1004_a=Cheat Sheet build_1005_b=Documentation build_1006_a=Quickstart build_1007_a=Installation build_1008_a=Tutorial build_1009_a=Features build_1010_a=Performance build_1011_a=Advanced build_1012_b=Reference build_1013_a=SQL Grammar build_1014_a=Functions build_1015_a=Data Types build_1016_a=Javadoc build_1017_a=PDF (1 MB) build_1018_b=Support build_1019_a=FAQ build_1020_a=Error Analyzer build_1021_a=Google Group (English) build_1022_a=Google Group (Japanese) build_1023_a=Google Group (Chinese) build_1024_b=Appendix build_1025_a=JaQu build_1026_a=Build build_1027_a=History & Roadmap build_1028_a=Links build_1029_a=License build_1030_td= build_1031_h1=Build build_1032_a=\ Portability build_1033_a=\ Environment build_1034_a=\ Building the Software build_1035_a=\ Build Targets build_1036_a=\ Using Maven 2 build_1037_a=\ Translating build_1038_a=\ Providing Patches build_1039_a=\ Reporting Problems or Requests build_1040_a=\ Automated Build build_1041_a=\ Generating Railroad Diagrams build_1042_h2=Portability build_1043_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_1044_p=\ For Java 1.4, the jar file needs to be converted first using <a href\="http\://retrotranslator.sourceforge.net">Retrotranslator</a>. build_1045_h2=Environment build_1046_p=\ A Java Runtime Environment (JRE) version 1.5 or higher is required to run this database. build_1047_p=\ To build the database executables, the following software stack was used. Newer version or compatible software works too. build_1048_li=Mac OS X and Windows XP build_1049_a=Sun JDK Version 1.5 and 1.6 build_1050_a=Eclipse Version 3.4 build_1051_li=Eclipse Plugins\: <a href\="http\://subclipse.tigris.org">Subclipse 1.4.6</a>, <a href\="http\://eclipse-cs.sourceforge.net">Eclipse Checkstyle Plug-in 4.4.2</a>, <a href\="http\://www.eclemma.org">EclEmma Java Code Coverage 1.3.0</a> build_1052_a=Emma Java Code Coverage build_1053_a=Mozilla Firefox 3.0 build_1054_a=OpenOffice 3.0 build_1055_a=NSIS 2.38 build_1056_li=\ (Nullsoft Scriptable Install System) build_1057_a=Maven 2.0.9 build_1058_h2=Building the Software build_1059_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_1060_p=\ For Linux and OS X, use <code>./build.sh</code> instead of <code>build</code>. build_1061_p=\ You will get a list of targets. If you want to build the <code>jar</code> file, execute (Windows)\: build_1062_h3=Switching the Source Code build_1063_p=\ By default the source code uses Java 1.5 features, however Java 1.6 is supported as well. To switch the source code to the installed version of Java, run\: build_1064_h2=Build Targets build_1065_p=\ The build system can generate smaller jar files as well. The following targets are currently supported\: build_1066_code=jarClient build_1067_li=\ creates the file <code>h2client.jar</code>. This only contains the JDBC client. build_1068_code=jarSmall build_1069_li=\ creates the file <code>h2small.jar</code>. This only contains the embedded database. Debug information is disabled. build_1070_code=jarJaqu build_1071_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_1072_code=javadocImpl build_1073_li=\ creates the Javadocs of the implementation. build_1074_p=\ To create the file <code>h2client.jar</code>, go to the directory <code>h2</code> and execute the following command\: build_1075_h2=Using Maven 2 build_1076_h3=Using a Central Repository build_1077_p=\ You can include the database in your Maven 2 project as a dependency. Example\: build_1078_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_1079_h3=Using Snapshot Version build_1080_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_1081_p=\ Afterwards, you can include the database in your Maven 2 project as a dependency\: build_1082_h2=Translating build_1083_p=\ The translation of this software is split into the following parts\: build_1084_li=H2 Console\: <code>src/main/org/h2/server/web/res/_text_*.properties</code> build_1085_li=Error messages\: <code>src/main/org/h2/res/_messages_*.properties</code> build_1086_li=Web site\: <code>src/docsrc/text/_docs_*.utf8.txt</code> build_1087_p=\ To translate the H2 Console, start it and select Preferences / Translate. The conversion between UTF-8 and Java encoding (using the <code>\\u</code> syntax), as well as the HTML entities (<code>&\#..;</code>) is automated by running the tool <code>PropertiesToUTF8</code>. The web site translation is automated as well, using <code>build docs</code>. build_1088_h2=Providing Patches build_1089_p=\ If you like to provide patches, please consider the following guidelines to simplify merging them\: build_1090_li=Only use Java 1.5 features (do not use Java 1.6) (see <a href\="\#environment">Environment</a>). build_1091_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_1092_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_1093_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_1094_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_1095_li=Verify that you did not break other features\: run the test cases by executing <code>build test</code>. build_1096_li=Provide end user documentation if required (<code>src/docsrc/html/*</code>). build_1097_li=Document grammar changes in <code>src/docsrc/help/help.csv</code> build_1098_li=Provide a change log entry (<code>src/docsrc/html/changelog.html</code>). build_1099_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_1100_li=Run <code>src/installer/buildRelease</code> to find and fix formatting errors. build_1101_li=Verify the formatting using <code>build docs</code> and <code>build javadoc</code>. build_1102_li=Submit patches as <code>.patch</code> files (compressed if big). To create a patch using Eclipse, use Team / Create Patch. build_1103_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_1104_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_1105_h2=Reporting Problems or Requests build_1106_p=\ Please consider the following checklist if you have a question, want to report a problem, or if you have a feature request\: build_1107_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_1108_li=Before posting problems, check the <a href\="faq.html">FAQ</a> and do a <a href\="http\://google.com">Google search</a>. build_1109_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_1110_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_1111_li=For large attachments, use a public temporary storage such as <a href\="http\://rapidshare.com">Rapidshare</a>. build_1112_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_1113_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_1114_li=It may take a few days to get an answers. Please do not double post. build_1115_h2=Automated Build build_1116_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_1117_a=Test Output build_1118_a=Code Coverage Summary build_1119_a=Code Coverage Details (download, 1.3 MB) build_1120_a=Build Newsfeed build_1121_a=Latest Jar File (download, 1 MB) build_1122_h2=Generating Railroad Diagrams build_1123_p=\ The railroad diagrams are HTML, formatted as nested tables. The diagrams are generated as follows\: build_1124_li=The BNF parser (<code>org.h2.bnf.Bnf</code>) reads and parses the BNF from the file <code>help.csv</code>. build_1125_li=The page parser (<code>org.h2.server.web.PageParser</code>) reads the template HTML file and fills in the diagrams. build_1126_li=The rail images (one straight, four junctions, two turns) are generated using a simple Java application. build_1127_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_b=Search\: changelog_1001_td=Highlight keyword(s) changelog_1002_a=Home changelog_1003_a=Download changelog_1004_a=Cheat Sheet changelog_1005_b=Documentation changelog_1006_a=Quickstart changelog_1007_a=Installation changelog_1008_a=Tutorial changelog_1009_a=Features changelog_1010_a=Performance changelog_1011_a=Advanced changelog_1012_b=Reference changelog_1013_a=SQL Grammar changelog_1014_a=Functions changelog_1015_a=Data Types changelog_1016_a=Javadoc changelog_1017_a=PDF (1 MB) changelog_1018_b=Support changelog_1019_a=FAQ changelog_1020_a=Error Analyzer changelog_1021_a=Google Group (English) changelog_1022_a=Google Group (Japanese) changelog_1023_a=Google Group (Chinese) changelog_1024_b=Appendix changelog_1025_a=JaQu changelog_1026_a=Build changelog_1027_a=History & Roadmap changelog_1028_a=Links changelog_1029_a=License changelog_1030_td= changelog_1031_h1=Change Log changelog_1032_h2=Next Version (unreleased) changelog_1033_li=Creating a database was delayed about 2 seconds if the directory didn't exist. changelog_1034_h2=Version 1.2.129 (2010-02-19) changelog_1035_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_1036_li=CREATE ALIAS\: error message when compiling Java code have been improved. changelog_1037_li=MVCC\: creating a table with an incorrect constraint could cause strange errors. changelog_1038_li=Hash indexes now are only used for single column indexes. changelog_1039_li=The cache types WEAK_* and TQ are no longer supported. changelog_1040_li=The file system abstraction no longer throws SQL exceptions. changelog_1041_li=DatabaseEventListener.diskSpaceIsLow has changed. changelog_1042_li=The CompressTool no longer throw as SQL exceptions. Instead, it throws runtime exceptions. changelog_1043_li=SimpleResultSet.addColumn and addRow now can throw a IllegalStateException instead of a SQLException. changelog_1044_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_1045_li=The BNF parser now uses the visitor pattern. changelog_1046_li=Converting a UUID to bytes was incorrect. Because of that, updatable result sets on tables with UUID primary key did not work. changelog_1047_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_1048_li=H2 Console\: asynchronous login (using a DatabaseEventListener) is no longer supported. changelog_1049_li=A workaround for a Windows socket problem has been implemented. Thanks a lot to Sergi Vladykin. changelog_1050_li=The Recover tool did not convert correctly convert CLOB data with non-ASCII characters. changelog_1051_li=Tools\: the method run(String... args) has been renamed to runTool(String... args). changelog_1052_li=Server.startWebServer(Connection) was not working as expected. changelog_1053_li=The database URL option ACCESS_MODE_LOG is no longer supported. changelog_1054_li=The database URL option RECOVER has currently no effect. changelog_1055_li=Converting an old (non-page store) database is no longer supported using this version. changelog_1056_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*. changelog_1057_li=The setting LOG has currently no effect. changelog_1058_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_1059_li=The translated resources are now stored in UTF-8 format. changelog_1060_li=The Windows service wrapper now detects if multiple versions of H2 are installed. changelog_1061_h2=Version 1.2.128 (2010-01-30) changelog_1062_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_1063_li=The DeleteDbFiles tool deleted all files in the .lob.db directory, even files that didn't belong to the database. changelog_1064_li=Automatic conversion of old databases to the page store format failed if the database contained LOB files. changelog_1065_li=Nested subqueries didn't work for INSERT INTO and IN(..). Example\: insert into test ((select 1)); changelog_1066_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_1067_li=Less classes are loaded when using the database in embedded mode. changelog_1068_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_1069_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_1070_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_1071_li=Improved PostgreSQL compatibility (support SHOW DEFAULT_TRANSACTION_ISOLATION). changelog_1072_li=Documentation\: the javadocs for Csv.write and read used the wrong default charset. changelog_1073_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_1074_li=If a FOR UPDATE query was executed twice (using a PreparedStatement), the table was not locked. changelog_1075_li=Triggers\: INSTEAD OF triggers are now supported. Such triggers can be defined on views. changelog_1076_li=New system property h2.identifiersToUpper. If set to false, identifiers in SQL statements are case sensitive even if they are not quoted. changelog_1077_li=Slightly improved performance if the table is already locked. changelog_1078_li=CompressLZF\: faster decompression. changelog_1079_li=PgServer\: the wrong size was sent for VARCHAR data. Thanks again to Sergi Vladykin for the patch. changelog_1080_li=Serialized access mode (server-less multi-connection mode)\: fixed getGeneratedKeys() for sequences. changelog_1081_h2=Version 1.2.127 (2010-01-15) changelog_1082_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_1083_li=Page store\: new databases can not be opened with older versions. changelog_1084_li=Page store\: adding data to new database is now faster. changelog_1085_li=File system\: getting the file name from a path is now faster. This should speed up BLOB and CLOB access. changelog_1086_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_1087_li=SHOW COLUMNS did not work correctly if there where multiple indexes on the same columns. changelog_1088_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_1089_li=Result sets larger than 2 GB threw an exception "Negative seek offset". Fixed. changelog_1090_li=If the system property h2.check was set to false, an ArrayIndexOutOfBoundsException could occur. changelog_1091_li=Alter table is now supported even if a table has views defined. changelog_1092_li=Fulltext search\: exceptions within the fulltext search package had the wrong SQL state. changelog_1093_li=The Lucene fulltext search ignored transaction rollback. Fixed using a trigger on rollback. changelog_1094_li=Trigger can now be called on rollback. changelog_1095_li=The shell script h2.sh ignored command line line arguments. changelog_1096_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_1097_li=The user home directory prefix (~) is now only expanded when followed by a slash or backslash, or standing alone. changelog_1098_li=Native fulltext search\: before inserting or deleting data, FT_INIT() had to be called. This is no longer required. changelog_1099_li=The .trace.db file is now only created if required. changelog_1100_li=Shell tool\: improved PostgreSQL compatibility. changelog_1101_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_1102_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_1103_li=Faster data conversion from BIGINT or INT to DECIMAL. changelog_1104_li=Server-less multi-connection mode\: try to delete log files if switching between read/write operations. changelog_1105_li=CompressLZF\: Faster decompress and improved javadocs changelog_1106_h2=Version 1.2.126 (2009-12-18) changelog_1107_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_1108_li=CSVREAD\: when reading the column names from the CSV file, column names that contain no special characters are considered case insensitive now. changelog_1109_li=Optimization index conditions of the form 'column\=NULL' (which is always false; unlike 'column IS NULL'). changelog_1110_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_1111_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_1112_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_1113_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_1114_li=JaQu\: the decompiler has been improved, and a few test cases already work. It is still incomplete however. changelog_1115_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_1116_li=The reserve heap memory is no longer used. changelog_1117_li=Database.checkpoint() could throw a NullPointerException. changelog_1118_h2=Version 1.2.125 (2009-12-06) changelog_1119_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_1120_li=The shell tool now has a very simple statement history. changelog_1121_li=The zip file system implementation now supports the '~' home directory prefix. Example database URL\: jdbc\:h2\:zip\:~/test.zip\!/test changelog_1122_li=Right outer joins on tables that were already 'inner joined' was processed incorrectly. changelog_1123_li=Temporary files from LOB objects were not deleted early enough when using the server mode. changelog_1124_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_1125_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_1126_li=Trigger that are called before a select statement are now supported. This allows to create tables that work like materialized views. changelog_1127_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_1128_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_1129_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_1130_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_1131_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_1132_li=The test cases don't access the file system directly, this simplifies GAE for Java testing. Thanks to Vince Bonfanti. changelog_1133_li=More bugs in the server-less multi-connection mode have been fixed. changelog_1134_li=When running against an old database, the SCRIPT statement could generate a SQL script that contained duplicate indexes (PRIMARY_KEY_E). changelog_1135_li=JdbcConnectionPool.getConnection() could throw a NullPointerException. changelog_1136_li=User defined functions\: the source code is now available using SELECT SOURCE FROM INFORMATION_SCHEMA.FUNCTION_ALIASES. changelog_1137_li=User defined functions with source code didn't work after re-opening the database. changelog_1138_li=The newsfeeds are now Atom 1.0 standard compliant. changelog_1139_li=The database is now closed after an out of memory exception, because the database could get corrupt otherwise. changelog_1140_li=Better error message if both AUTO_SERVER and SERIALIZED parameters are set to TRUE. changelog_1141_li=Drop table did not delete lob files in old file store (not PAGE_STORE). changelog_1142_h2=Version 1.2.124 (2009-11-20) changelog_1143_li=Clustering\: there is now a way to detect which cluster instances are running. changelog_1144_li=ConvertTraceFile\: the SQL statement statistics are better formatted (newline are removed). changelog_1145_li=The file lock thread is now stopped when the database is closed. changelog_1146_li=Issue 140\: the Script tool now supports writing to a stream. changelog_1147_li=Issue 138\: the trace output of Statement.execute(String, int) and executeUpdate was incorrect. changelog_1148_li=Page store\: new databases can not be opened with older versions. changelog_1149_li=Page store\: multi-column indexes didn't work if the cache was very small. changelog_1150_li=Page store\: opening a database could theoretically result in an endless loop. changelog_1151_li=Page store\: adding large indexed columns could get very slow. changelog_1152_li=Page store\: after a duplicate key exception, an ArrayIndexOutOfBoundsException could be thrown (only for very large rows). changelog_1153_li=Page store\: the recover tool sometimes generated a script file that contained duplicate data. changelog_1154_li=Page store\: sometimes opening a read-only database failed. changelog_1155_li=Page store\: opening a database sometimes failed if large rows where updated, or if a table was truncated before. changelog_1156_li=Page store\: when using a very small page size (128 bytes or smaller), writing a large row could result in an endless recursion. This is only a theoretical problem, as the page size is 2 KB. changelog_1157_li=Page store\: getting the min value from a descending index with NULL entries could return the wrong result. changelog_1158_li=Page store\: improved auto-recovery after power failure. changelog_1159_li=The JDBC client did not detect that it was not talking to an H2 server. This could result in strange exceptions when trying to connect to another kind of server. changelog_1160_li=User defined functions can be created with source code. Example\: CREATE ALIAS HI AS 'String hi() { return "Hello"; }' changelog_1161_li=Database file lock\: the exception "lock file modified in the future" is no longer thrown; instead, opening the file will be delayed by 2 seconds. changelog_1162_li=Inserting LOBs got slower each time the process was restarted. It could loop endlessly after about 1000 process restarts. changelog_1163_li=Issue 117\: Multi-version concurrency\: concurrent MERGE statements now work. changelog_1164_li=Improved read-only database detection. changelog_1165_h2=Version 1.2.123 (2009-11-08) changelog_1166_li=Page store\: new databases can not be opened with older versions. changelog_1167_li=Page store\: updating large rows (rows with more than 2000 bytes of data) could corrupt the database. changelog_1168_li=Page store\: inserting very large rows failed with ArrayIndexOutOfBoundsException. changelog_1169_li=When using multi-threaded kernel mode, setting disabling locking (LOCK_MODE\=0) will now throw an exception. At this time this combination will result in corruption when multiple threads try to update the same table. changelog_1170_li=The fulltext search methods and fields are now protected instead of private, to make the classes more easily extensible. changelog_1171_li=The Lucene fulltext search now also returns the score. changelog_1172_li=\ New function SCOPE_IDENTITY() to avoid problems when inserting rows in a trigger. changelog_1173_li=Statement.getGeneratedKeys() returned the wrong value if a trigger changed the identity value after inserting the row. changelog_1174_li=Improved error messages\: identifiers and values are now quoted. changelog_1175_li=Improved error message when casting a value failed\: the column name and type is included in the message. changelog_1176_li=Improved support for GAE for Java thanks to Vince Bonfanti. changelog_1177_h2=Version 1.2.122 (2009-10-28) changelog_1178_li=The native fulltext search now supports streaming CLOB data. changelog_1179_li=If the database URL ends with ;PAGE_STORE\=TRUE and a database in the old format exists, it is automatically converted to the new page store format if possible. A backup of the database is created first. Automatic conversion is not supported if the database was not closed normally (if it contains uncommitted transactions). changelog_1180_li=Dropping the current user is now allowed if another admin user exists. changelog_1181_li=Values of type BINARY or BLOB could not be converted to the data type OTHER. changelog_1182_li=SHUTDOWN COMPACT now fully compacts the database. changelog_1183_li=New system properties h2.maxCompactCount and h2.maxCompactTime to allow changing the default behavior (at most 2 seconds compacting when closing the database). changelog_1184_li=New sorted insert optimization (see Performance / Database Performance Tuning). changelog_1185_li=Issue 116\: The files h2*-sources.jar and h2*-javadoc.jar are now in the Maven repository. changelog_1186_li=Page store\: opening a large database was slow if it was not closed before. changelog_1187_li=Page store\: new write and read counters in the meta data table. Use SELECT * FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME IN( 'info.FILE_WRITE_TOTAL', 'info.FILE_WRITE', 'info.FILE_READ', 'info.CACHE_MAX_SIZE', 'info.CACHE_SIZE') changelog_1188_li=The SQL syntax is documented using (railroad) diagrams. The diagrams are HTML. changelog_1189_li=The documentation is no longer available in Japanese because the translation was too much out of sync. Please use the Google translation instead. changelog_1190_li=Certain queries were not sorted if subselect queries were involved changelog_1191_li=More bugs in the server-less multi-connection mode have been fixed\: 90097 The database is read only, caches must be cleared on reconnect, etc. changelog_1192_h2=Version 1.2.121 (2009-10-11) changelog_1193_li=Better support GaeVFS (Google App Engine Virtual File System) thanks to Thanks to Vince Bonfanti. changelog_1194_li=CSVREAD didn't close the file. Thanks to Vince Bonfanti for the patch\! changelog_1195_li=If a database in the old format exists, it is now used. The system property is used for new databases, or if databases exist in both formats. In any case, the flag in the URL overrides this logic. changelog_1196_li=Page store bugs were fixed. Large values in indexed columns could corrupt the index. changelog_1197_li=The page store did not work when using Retrotranslator (because the Retrotranslator doesn't support Integer.reverse and Long.reverse). changelog_1198_li=New system property h2.pageStoreTrim to disable shrinking the database when closing (disabled by default, meaning by default the database is trimmed). changelog_1199_h2=Version 1.2.120 (2009-10-04) changelog_1200_li=This is a beta version. changelog_1201_li=Large updates could throw an ArrayIndexOutOfBoundsException in RowList.writeRow. changelog_1202_li=In version 1.2, the following system properties are now enabled by default\: h2.pageStore, h2.nullConcatIsNull, h2.optimizeInList. The default value for h2.defaultMaxLengthInplaceLob is now 4096 (it was 1024 with version 1.1). changelog_1203_li=New databases are now stored in the new 'page store' file format. Existing databases are kept in the old file format. To use the old file format, append ;PAGE_STORE\=FALSE to the database URL or set the system property h2.pageStore to false. changelog_1204_li=Issue 125\: Renaming primary keys was not persistent. Fixed. Unfortunately, databases created by this version can not be opened with older versions because of this change. changelog_1205_li=Issue 124\: Hibernate schema validation failed for decimal/numeric columns. This problem is fixed in the Hibernate dialect that is included with H2 (src/tools/org/hibernate/dialect/H2Dialect.java.txt), but not in Hibernate yet. changelog_1206_li=PostgreSQL compatibility\: function LASTVAL() as an alias for IDENTITY(). changelog_1207_li=Linked tables now support default values when inserting, updating or merging. changelog_1208_li=Bugfixes in the page store. changelog_1209_li=Possibility to set a vendor id in Constants.java, so that unofficial builds are distinguishable from official releases. changelog_1210_li=Allow writing to linked tables in readonly databases. changelog_1211_h2=Version 1.1.119 (2009-09-26) changelog_1212_li=SQL statements in the exception message are no longer included if they contain '--hide--'. changelog_1213_li=Temporary local tables did not always work after reconnect if AUTO_SERVER\=TRUE changelog_1214_li=New system property h2.defaultMaxLengthInplaceLob to change the default maximum size of an in-place LOB object. changelog_1215_li=New system property h2.nullConcatIsNull to change the default null concatenation behavior. The default will be enabled in version 1.2. changelog_1216_li=The cache algorithm TQ is disabled in this version, because it is unstable, and because the current implementation does not have any measurable advantages over the default. changelog_1217_li=New committer\: Christian Peter. He works for <a href\="http\://www.docware.com">Docware</a> and helped a lot finding and fixing bugs, and generally improving the database. He is now a committer. changelog_1218_li=ChangeFileEncryption did not work with Lob subdirectories. Fixed. changelog_1219_li=Issue 121\: JaQu\: new simple update and merge methods. changelog_1220_li=Issue 120\: JaQu didn't close result sets. changelog_1221_li=Issue 119\: JaQu creates wrong WHERE conditions on some inputs. changelog_1222_li=The new page store mechanism is now alpha-level quality. The next release will most likely be "1.2.120 beta" where this mode is enabled by default. To use it right now, append ;PAGE_STORE\=TRUE to the database URL. The file format of this mode will probably not change any more. changelog_1223_li=SELECT COUNT(*) FROM SYSTEM_RANGE(...) returned the wrong result. Fixed. changelog_1224_li=The Recover tool now also processes the log files, however applying those changes is still a manual process. changelog_1225_li=New sample application that shows how to pass data to a trigger. changelog_1226_li=More bugs in the server-less multi-connection mode have been fixed\: On Windows, two processes could write to the same database at the same time. changelog_1227_li=When loading triggers or other client classes (static functions, database event listener, user aggregate functions, other JDBC drivers), the database now uses the context class loader if the class could not be found using Class.forName(). changelog_1228_li=Updating many rows with the same CLOB or BLOB values could result in FileNotFoundException. changelog_1229_li=Statement.getConnection() threw an exception if the connection was already closed. changelog_1230_li=The native fulltext index kept a reference to a database after the database was closed. changelog_1231_li=Non-unique in-memory hash indexes are now supported. Thanks a lot to Sergi Vladykin for the patch\! changelog_1232_li=The optimizer does a better job for joins if indexes are missing. changelog_1233_h2=Version 1.1.118 (2009-09-04) changelog_1234_li=SHOW COLUMNS only listed indexed columns. changelog_1235_li=When calling SHUTDOWN IMMEDIATELY in the server mode, the .trace.db file was not closed. changelog_1236_li=DatabaseMetaData.getPrimaryKeys\: the wrong constraint name was reported if there was another constraint on the same table and columns. changelog_1237_li=AUTO_INCREMENT now works in the same way in ALTER TABLE ALTER COLUMN as in CREATE TABLE (it does not create a primary key). changelog_1238_li=Native fulltext search\: before searching, FT_INIT() had to be called. This is no longer required. changelog_1239_li=Better support GaeVFS (Google App Engine Virtual File System). changelog_1240_li=JaQu\: the plan is to support natural (pure Java / Scala) conditions such as (id \=\= 1 && name.equals("Test")). A proof of concept decompiler is now included (it doesn't work yet). changelog_1241_li=Various bugfixes and improvements in the page store mechanism (still experimental). changelog_1242_li=PreparedStatement.setObject now converts a java.lang.Character to a string. changelog_1243_li=H2 Console\: PierPaolo Ucchino has completed the Italian translation. Thanks a lot\! changelog_1244_li=Various tools now use Java 5 var-args, such as main the methods and SimpleResultSet.addRow. changelog_1245_li=H2 Console\: indexes of tables of non-default schemas are now also listed. changelog_1246_li=Issue 111\: Multi-version concurrency / duplicate primary key after rollback. changelog_1247_li=Issue 110\: Multi-version concurrency / wrong exception is thrown. changelog_1248_li=Parser\: sequenceName.NEXTVAL and CURRVAL did not respect the schema search path. changelog_1249_li=Issue 101\: The following sequence could throw the exception "Row not found when trying to delete"\: start a transaction, insert many rows, delete many rows, rollback. The number of rows depends on the cache size. changelog_1250_li=The stack trace of very common exceptions is no longer written to the .trace.db file by default. changelog_1251_li=An optimization for OR is implemented, but disabled by default. Expressions of the type X\=1 OR X\=2 are converted to X IN(1, 2). To enable, set the system property h2.optimizeInList to true before loading the H2 JDBC driver. changelog_1252_li=An optimization for IN(..) and IN(SELECT...) is implemented, but disabled by default. To enable, set the system property h2.optimizeInList to true before loading the H2 JDBC driver. If enabled, this overrides h2.optimizeIn and h2.optimizeInJoin. Unlike now, this optimization will also speed up updates and deletes. changelog_1253_h2=Version 1.1.117 (2009-08-09) changelog_1254_li=New committer\: Sam Van Oort has been contributing to H2 since quite some time in many ways (on the mailing list, documentation, and in the form of patches). He is now a committer. changelog_1255_li=JaQu\: the order of the fields in the database no longer needs to match the order in the database. changelog_1256_li=Issue 103\: MVCC\: the setting MAX_MEMORY_UNDO can currently not be supported when using multi-version concurrency, that means the complete undo log must fit in memory. changelog_1257_li=LIKE\: the escape mechanism can now be disable using ESCAPE ''. The default escape character can be changed using the system property h2.defaultEscape. The default is still '\\' (as in MySQL and PostgreSQL). changelog_1258_li=Views using functions were not re-evaluated when necessary. changelog_1259_li=Improved MySQL compatibility for SHOW COLUMNS. changelog_1260_li=Improved PostgreSQL compatibility for timestamp literals with timezone. changelog_1261_li=Sergi Vladykin translated the error messages to Russian. Thanks a lot\! changelog_1262_li=Support for Java 6 DatabaseMetaData.getTables, getColumns, getProcedures, and getProcedureColumns. changelog_1263_li=Issue 101\: Rollback of a large transaction (more than 100000 rows) could fail. changelog_1264_li=Various bugfixes and improvements in the page store mechanism (still experimental). changelog_1265_li=The functions LENGTH, OCTET_LENGTH, and BIT_LENGTH now return BIGINT. changelog_1266_li=Data types CLOB and BLOB\: the maximum precision was Integer.MAX_VALUE, it is now Long.MAX_VALUE. changelog_1267_li=Multi-threaded kernel\: creating and dropping temporary database objects and the potentially free pages list was not correctly synchronized. Thanks a lot to Eric Faulhaber for the test case and patch\! changelog_1268_li=Parsing SQL script files is now faster. changelog_1269_li=CSV reading is now faster. changelog_1270_li=SimpleResultSet.newInstance(SimpleRowSource rs) did not work. changelog_1271_h2=Version 1.1.116 (2009-07-18) changelog_1272_li=Server-less multi-connection mode\: more bugs are fixed. changelog_1273_li=The built-in help (INFORMATION_SCHEMA.HELP) is smaller, shrinking the jar file size a bit. changelog_1274_li=H2 Console\: column of tables of non-default schemas are now also listed, except for schemas starting with 'INFO'. changelog_1275_li=ALTER TABLE\: removing an auto-increment or identity column didn't remove the sequence. changelog_1276_li=Creating indexes is now a bit faster. changelog_1277_li=PG Server\: new system property h2.pgClientEncoding to explicitly set the encoding for clients that don't send the encoding (the default encoding is UTF-8). Thanks a lot to Sergi Vladykin for the patch\! changelog_1278_li=PG Server\: improved compatibility by using the type ids of the PostgreSQL driver. Thanks a lot to Sergi Vladykin for the patch\! changelog_1279_li=H2 Console\: Oracle system tables are no longer listed, improving performance. changelog_1280_li=Result sets are now read-only except if the statement or prepared statement was created with the concurrency ResultSet.CONCUR_UPDATABLE. This change is required because the old behavior (all result set are updatable) violated the JDBC spec. For backward compatibility, use the system property h2.defaultResultSetConcurrency. changelog_1281_li=New system property h2.defaultResultSetConcurrency to change the default result set concurrency. changelog_1282_li=JDBC\: using an invalid result set type or concurrency now throws an exception. changelog_1283_li=If a pooled connection was not closed but garbage collected, a NullPointerException could occur. changelog_1284_li=Fulltext search\: a NullPointerException was thrown when updating a value that was NULL previously. changelog_1285_li=The Recover tool did not work with .data.db files of the wrong size. changelog_1286_li=Triggers\: if there was an exception when initializing a trigger, this exception could be hidden, and in some cases (specially when using the Lucene fulltext index mechanism) a NullPointerException was thrown later on. Now the exception that occurred on init is thrown when changing data. changelog_1287_li=The soft-references cache (CACHE_TYPE\=SOFT_LRU) could throw a NullPointerException. changelog_1288_li=To enable the new page store mechanism, append ;PAGE_STORE\=TRUE to the database URL. or set the system property h2.pageStore to true. This mechanism is still experimental, and the file format will change, but it is quite stable now. changelog_1289_h2=Version 1.1.115 (2009-06-21) changelog_1290_li=The new storage mechanism is now alpha quality. To try it out, set the system property "h2.pageStore" to "true" (java -Dh2.pageStore\=true). There are still bugs to be found and fixed, for example inserting many rows references a lot of main memory. Performance is currently about the same as with the regular storage mechanism, but the database file size is smaller. The file format is not stable yet. changelog_1291_li=ALTER TABLE could throw an exception "object already exists" in some cases. changelog_1292_li=Views\: in some situations, an ArrayIndexOutOfBoundsException was thrown when using the same view concurrently. changelog_1293_li=java.util.UUID is now supported in PreparedStatement.setObject and user defined Java functions. ResultSet.getObject() returns a java.util.UUID when using the UUID data type. changelog_1294_li=H2 Console\: the language was reset to the browser language when disconnecting. changelog_1295_li=H2 Console\: improved Polish translation. changelog_1296_li=Server-less multi-connection mode\: more bugs are fixed. changelog_1297_li=The download page now included the SHA1 checksums. changelog_1298_li=Shell tool\: the file encoding workaround is now documented if you run java org.h2.tools.Shell -?. changelog_1299_li=The RunScript tool and SQL statement did not work with the compression method LZF. changelog_1300_li=Fulltext search\: searching for NULL or an empty string threw an exception. changelog_1301_li=Lucene fulltext search\: FTL_DROP_ALL did not drop the triggers. changelog_1302_li=Backup\: if the database contained CLOB or BLOB data, the backup included a file entry for the LOB directory. This caused the restore to fail. changelog_1303_li=Data types\: LONG is now an alias for BIGINT. changelog_1304_h2=Version 1.1.114 (2009-06-01) changelog_1305_li=ResultSetMetaData.getColumnClassName returned the wrong class for CLOB and BLOB columns. changelog_1306_li=Fulltext search\: data is no longer deleted and re-inserted if the indexed columns didn't change. changelog_1307_li=In some situations, an ArrayIndexOutOfBoundsException was thrown when adding rows. This was caused by a bug in the b-tree code. changelog_1308_li=Microsoft Windows Vista\: when using the the installer, Vista wrote "This program may not have installed correctly." This message should no longer appear (in the h2.nsi file, the line 'RequestExecutionLevel highest' was added). changelog_1309_li=The Recover tool did not always work when the database contains referential integrity constraints. changelog_1310_li=Java 1.5 is now required to run H2. If required, Retrotranslator can be used to create a Java 1.4 version (http\://retrotranslator.sourceforge.net/). changelog_1311_h2=Version 1.1.113 (2009-05-21) changelog_1312_li=Shell tool\: the built-in commands EXIT, HELP, ?, LIST, and so on didn't work with a semicolon at the end. changelog_1313_li=JDK 1.5 is now required to build the jar file. However it is still possible to create a jar file for Java 1.4. For details, see buildRelease.sh and buildRelease.bat. As an alternative, compile using JDK 1.5 or 1.6 and use Retrotranslator to create a Java 1.4 version (http\://retrotranslator.sourceforge.net/). changelog_1314_li=When deleting or updating many rows in a table, the space in the index file was not re-used in the default mode (persistent database, b-tree index, LOG\=1). This caused the index file to grow over time. Workarounds were to delete and re-created the index file, alter the table (add a remove a column), or append ;LOG\=2 to the database URL. To disable the change, set the system property h2.reuseSpaceBtreeIndex to false. changelog_1315_li=Identifiers with a digit and then a dollar sign didn't work. Example\: A1$B. changelog_1316_li=MS SQL Server compatibility\: support for linked tables with NVARCHAR, NCHAR, NCLOB, and LONGNVARCHAR. changelog_1317_li=Android\: workaround for a problem when using read-only databases in zip files (skip seems to be implemented incorrectly on the Android system). changelog_1318_li=Calling execute() or prepareStatement() with null as the SQL statement now throws an exception. changelog_1319_li=Benchmark\: the number of executed statements was incorrect. The H2 database was loaded at the beginning of the test to collect results, now it is loaded at the very end. Thanks to Fred Toussi from HSQLDB for reporting those problems. However the changed do not affect the relative performance. changelog_1320_li=H2 Console\: command line settings are no longer stored in the properties file. They are now only used for the current process, except if they are explicitly saved. changelog_1321_li=Cache\: support for a second level soft-references cache. To enable it, append ;CACHE_TYPE\=SOFT_LRU (or SOFT_TQ) to the database URL, or set the system property h2.cacheTypeDefault to "SOFT_LRU" / "SOFT_TQ". Enabling the second level cache reduces performance for small databases, but speeds up large databases. It makes sense to use it if the available memory size is unknown. Thanks a lot to Jan Kotek\! changelog_1322_h2=Version 1.1.112 (2009-05-01) changelog_1323_li=JdbcPreparedStatement.toString() could throw a NullPointerException. changelog_1324_li=EclipseLink\: added H2Platform.supportsIdentity(). changelog_1325_li=Connection pool\: the default login timeout is now 5 minutes. changelog_1326_li=After truncating tables, opening large databases could become slow because indexes were always re-built unnecessarily when opening. changelog_1327_li=More bugs in the server-less multi-connection mode have been fixed\: Sometimes parameters of prepared statements were lost when a reconnecting. Concurrent read operations were slow. To improve performance, executeQuery(..) must be used for queries (execute(..) switches to the write mode, which is slow). changelog_1328_li=GROUP BY queries with a self-join (join to the same table) that were grouped by columns with indexes returned the wrong result in some cases. changelog_1329_li=Improved error message when the .lock.db file modification time is in the future. changelog_1330_li=The MERGE statement now returns 0 as the generated key if the row was updated. changelog_1331_li=Running code coverage is now automated. changelog_1332_li=A file system implementation can now be registered using FileSystem.register. changelog_1333_li=The database file system is no longer included in the jar file, it moved to the test section. changelog_1334_h2=Version 1.1.111 (2009-04-10) changelog_1335_li=In-memory databases can now run inside the Google App Engine. changelog_1336_li=Queries that are ordered by an indexed column returned no rows in certain cases (if all rows were deleted from the table previously, and there is a low number of rows in the table, and when not using other conditions, and when using the default b tree index). changelog_1337_li=The wrong exception was thrown when using unquoted text for the SQL statements COMMENT, ALTER USER, and SET PASSWORD. changelog_1338_li=The built-in connection pool did not roll back transactions and enable autocommit enabled after closing a connection. changelog_1339_li=Sometimes a StackOverflow occurred when checking for deadlock. See also http\://code.google.com/p/h2database/issues/detail?id\=61 changelog_1340_li=The Shell tool no longer truncates results with only one column, and displays a message if data was truncated. changelog_1341_h2=Version 1.1.110 (2009-04-03) changelog_1342_li=Support for not persistent in-memory tables in regular (persistent) databases using CREATE MEMORY TABLE(..) NOT PERSISTENT. Thanks a lot to Sergi Vladykin for the patch\! changelog_1343_li=The H2 Console trimmed the password (removed leading and trailing spaces). This is no longer the case, to support encrypted H2 database with an empty user password. changelog_1344_li=The data type of a SUBSTRING method was wrong. changelog_1345_li=ResultSet.findColumn and get methods with column label parameters now also check for matching column names (like most databases except MySQL). changelog_1346_li=H2 Console\: the browser system property now supports a list of arguments. Example\: java -Dh2.browser\="open,-a,Safari,%url" ... changelog_1347_li=Improved Javadoc navigation (similar to Scaladoc). changelog_1348_li=H2 Console\: auto-complete of identifiers did not work correctly for H2 databases in MySQL mode. changelog_1349_li=DISTINCT and GROUP BY on a CLOB column was broken. changelog_1350_li=The FTP server moved to the tools section and is no longer included in the h2*.jar file. changelog_1351_li=Improved error message for unsupported features\: now the message says what exactly is not supported. changelog_1352_li=Improved OSGi support. changelog_1353_li=Some internal caches did not use the LRU mechanism. Fixed (LOB file list, optimizer cost cache, trace system, view indexes, collection keys, compressed in-memory file system). changelog_1354_li=The API of the tools changed a bit (each tool now returns an exit code). changelog_1355_li=Command line help of the tools now match the javadocs. The build converts the javadocs to a resource that is read by the tool at runtime. This should not have an effect on using the database, but it reduces duplicate and out-of-sync documentation. changelog_1356_li=CREATE TABLE\: improved compatibility (support for UNIQUE NOT NULL). changelog_1357_li=DatabaseMetaData.getSQLKeywords now returns the correct list. changelog_1358_li=Deterministic user defined functions did not work when the parameter was a column. Fixed. changelog_1359_li=JdbcConnectionPool.setLoginTimeout with 0 now uses the default timeout. changelog_1360_li=Creating a JdbcConnectionPool has been simplified a bit. changelog_1361_li=The built-in connection pool did not re-use connections. Getting a connection using the built-in JdbcConnectionPool is now about 70 times faster than opening connections using DriverManager.getConnection. changelog_1362_li=More bugs in the server-less multi-connection mode have been fixed\: If a process terminated while writing, other open connections were blocked. If two processes were writing to the database, sometimes the database was corrupt after closing. changelog_1363_li=Linked tables to SQLite database can now be created. changelog_1364_li=Nested IN(IN(...)) didn't work. changelog_1365_li=NIO storage\: the nio\: prefix was using memory mapped files instead of FileChannel. changelog_1366_h2=Version 1.1.109 (2009-03-14) changelog_1367_li=The optimization for IN(...) is now only used if comparing a column with an index. changelog_1368_li=User defined functions can now be deterministic (see CREATE ALIAS documentation). changelog_1369_li=Multiple nested queries in the FROM clause with parameters did not always work. changelog_1370_li=When converting CLOB to BINARY, each character resulted in one byte. Now, the text is parsed as a hex as when converting VARCHAR. changelog_1371_li=New experimental NIO storage mechanism with both FileChannel and memory mapped files. To use it, use the file name prefix nio\: or nioMapped\: as in jdbc\:h2\:nio\:~/test. So far it looks like NIO storage is faster on Mac OS but slower on some Windows systems. Thanks a lot to Jan Kotek for the patch\! changelog_1372_li=The functions BITOR, BITAND, BITXOR, and MOD now accept and return BIGINT instead of INT. changelog_1373_li=Could not use the same linked table multiple times in the same query. changelog_1374_li=Bugs in the server-less multi-connection mode have been fixed. changelog_1375_li=Column names could not be named "UNIQUE" (with the quotes). changelog_1376_li=New system function TRANSACTION_ID() to get the current transaction identifier for a session. 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.2.129/h2-1.2.129.jar" class\="link">jar</a>, <a href\="http\://www.h2database.com/h2-setup-2010-02-19.exe" class\="link">installer (Windows)</a>, <a href\="http\://www.h2database.com/h2-2010-02-19.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_b=Search\: download_1001_td=Highlight keyword(s) download_1002_a=Home download_1003_a=Download download_1004_a=Cheat Sheet download_1005_b=Documentation download_1006_a=Quickstart download_1007_a=Installation download_1008_a=Tutorial download_1009_a=Features download_1010_a=Performance download_1011_a=Advanced download_1012_b=Reference download_1013_a=SQL Grammar download_1014_a=Functions download_1015_a=Data Types download_1016_a=Javadoc download_1017_a=PDF (1 MB) download_1018_b=Support download_1019_a=FAQ download_1020_a=Error Analyzer download_1021_a=Google Group (English) download_1022_a=Google Group (Japanese) download_1023_a=Google Group (Chinese) download_1024_b=Appendix download_1025_a=JaQu download_1026_a=Build download_1027_a=History & Roadmap download_1028_a=Links download_1029_a=License download_1030_td= download_1031_h1=Downloads download_1032_h3=Version 1.2.129 (2010-02-19) download_1033_a=Windows Installer download_1034_a=Platform-Independent Zip download_1035_h3=Version 1.2.127 (2010-01-15, Last Stable) download_1036_a=Windows Installer download_1037_a=Platform-Independent Zip download_1038_h3=Download Mirror and Older Versions download_1039_a=Platform-Independent Zip download_1040_h3=Jar File download_1041_a=Maven.org download_1042_a=Sourceforge.net download_1043_a=Latest Automated Build (not released) download_1044_h3=Subversion Source Repository download_1045_a=Google Code download_1046_p=\ For details about changes, see the <a href\="changelog.html">Change Log</a>. faq_1000_b=Search\: faq_1001_td=Highlight keyword(s) faq_1002_a=Home faq_1003_a=Download faq_1004_a=Cheat Sheet faq_1005_b=Documentation faq_1006_a=Quickstart faq_1007_a=Installation faq_1008_a=Tutorial faq_1009_a=Features faq_1010_a=Performance faq_1011_a=Advanced faq_1012_b=Reference faq_1013_a=SQL Grammar faq_1014_a=Functions faq_1015_a=Data Types faq_1016_a=Javadoc faq_1017_a=PDF (1 MB) faq_1018_b=Support faq_1019_a=FAQ faq_1020_a=Error Analyzer faq_1021_a=Google Group (English) faq_1022_a=Google Group (Japanese) faq_1023_a=Google Group (Chinese) faq_1024_b=Appendix faq_1025_a=JaQu faq_1026_a=Build faq_1027_a=History & Roadmap faq_1028_a=Links faq_1029_a=License faq_1030_td= faq_1031_h1=Frequently Asked Questions faq_1032_a=\ I Have a Problem or Feature Request faq_1033_a=\ Are there Known Bugs? When is the Next Release? faq_1034_a=\ Is this Database Engine Open Source? faq_1035_a=\ My Query is Slow faq_1036_a=\ How to Create a New Database? faq_1037_a=\ How to Connect to a Database? faq_1038_a=\ Where are the Database Files Stored? faq_1039_a=\ What is the Size Limit (Maximum Size) of a Database? faq_1040_a=\ Is it Reliable? faq_1041_a=\ Why is Opening my Database Slow? faq_1042_a=\ Column Names are Incorrect? faq_1043_a=\ Is the GCJ Version Stable? Faster? faq_1044_a=\ How to Translate this Project? faq_1045_h3=I Have a Problem or Feature Request faq_1046_p=\ Please read the <a href\="build.html\#support">support checklist</a>. faq_1047_h3=Are there Known Bugs? When is the Next Release? faq_1048_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_1049_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 >\= 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_1050_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_1051_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_1052_p=\ For a complete list, see <a href\="http\://code.google.com/p/h2database/issues/list">Open Issues</a>. faq_1053_h3=Is this Database Engine Open Source? faq_1054_p=\ Yes. It is free to use and distribute, and the source code is included. See also under license. faq_1055_h3=My Query is Slow faq_1056_p=\ Slow <code>SELECT</code> (or <code>DELETE, UPDATE, MERGE</code>) statement can have multiple reasons. Follow this checklist\: faq_1057_li=Run <code>ANALYZE</code> (see documentation for details). faq_1058_li=Run the query with <code>EXPLAIN</code> and check if indexes are used (see documentation for details). faq_1059_li=If required, create additional indexes and try again using <code>ANALYZE</code> and <code>EXPLAIN</code>. faq_1060_li=If it doesn't help please report the problem. faq_1061_h3=How to Create a New Database? faq_1062_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_1063_h3=How to Connect to a Database? faq_1064_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_1065_h3=Where are the Database Files Stored? faq_1066_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\\<userName></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><Installation Directory>/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_1067_h3=What is the Size Limit (Maximum Size) of a Database? faq_1068_p=\ See <a href\="advanced.html\#limits_limitations">Limits and Limitations</a>. faq_1069_h3=Is it Reliable? faq_1070_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_1071_li=Using the transaction isolation level <code>READ_UNCOMMITTED</code> (<code>LOCK_MODE 0</code>) while at the same time using multiple connections. faq_1072_li=Disabling database file protection using <code>FILE_LOCK\=NO</code> in the database URL. faq_1073_li=Disabling referential integrity using <code>SET REFERENTIAL_INTEGRITY FALSE</code>. faq_1074_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_1075_p=\ Some areas of this database are not fully tested. When using one of those features for production, please ensure your use case is well tested (if possible with automated test cases). Those areas are\: faq_1076_li=Platforms other than Windows XP, Linux, Mac OS X, or JVMs other than Sun 1.5 or 1.6 faq_1077_li=The features <code>AUTO_SERVER</code> and <code>AUTO_RECONNECT</code> faq_1078_li=The file locking method 'Serialized' faq_1079_li=The MVCC (multi version concurrency) mode faq_1080_li=Cluster mode, 2-phase commit, savepoints faq_1081_li=24/7 operation faq_1082_li=Some operations on databases larger than 500 MB may be slower than expected faq_1083_li=The optimizer may not always select the best plan faq_1084_li=Fulltext search faq_1085_li=Operations on LOBs over 2 GB faq_1086_p=\ Areas considered experimental are\: faq_1087_li=The PostgreSQL server faq_1088_li=Multi-threading within the engine using <code>SET MULTI_THREADED\=1</code> faq_1089_li=Compatibility modes for other databases (only some features are implemented) faq_1090_li=The soft reference cache (CACHE_TYPE\=SOFT_LRU). It might not improve performance, and out of memory issues have been reported. faq_1091_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_1092_h3=Column Names are Incorrect? faq_1093_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_1094_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>. Other database don't work like this (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 set the system property <a href\="../javadoc/org/h2/constant/SysProperties.html\#h2.aliasColumnName"><code>h2.aliasColumnName</code></a>. faq_1095_h3=Why is Opening my Database Slow? faq_1096_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_1097_p=\ To find out what the problem is, open the database in embedded mode using the H2 Console. This will print progress information. If you have many lines with 'Creating index' it is an indication that the database was not closed the last time. faq_1098_p=\ Other possible reasons are\: the database is very big (many GB), or contains linked tables that are slow to open. faq_1099_h3=Is the GCJ Version Stable? Faster? faq_1100_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_1101_h3=How to Translate this Project? faq_1102_p=\ For more information, see <a href\="build.html\#translating">Build/Translating</a>. features_1000_b=Search\: features_1001_td=Highlight keyword(s) features_1002_a=Home features_1003_a=Download features_1004_a=Cheat Sheet features_1005_b=Documentation features_1006_a=Quickstart features_1007_a=Installation features_1008_a=Tutorial features_1009_a=Features features_1010_a=Performance features_1011_a=Advanced features_1012_b=Reference features_1013_a=SQL Grammar features_1014_a=Functions features_1015_a=Data Types features_1016_a=Javadoc features_1017_a=PDF (1 MB) features_1018_b=Support features_1019_a=FAQ features_1020_a=Error Analyzer features_1021_a=Google Group (English) features_1022_a=Google Group (Japanese) features_1023_a=Google Group (Chinese) features_1024_b=Appendix features_1025_a=JaQu features_1026_a=Build features_1027_a=History & Roadmap features_1028_a=Links features_1029_a=License features_1030_td= features_1031_h1=Features features_1032_a=\ Feature List features_1033_a=\ Comparison to Other Database Engines features_1034_a=\ H2 in Use features_1035_a=\ Connection Modes features_1036_a=\ Database URL Overview features_1037_a=\ Connecting to an Embedded (Local) Database features_1038_a=\ In-Memory Databases features_1039_a=\ Database Files Encryption features_1040_a=\ Database File Locking features_1041_a=\ Opening a Database Only if it Already Exists features_1042_a=\ Closing a Database features_1043_a=\ Ignore Unknown Settings features_1044_a=\ Changing Other Settings when Opening a Connection features_1045_a=\ Custom File Access Mode features_1046_a=\ Multiple Connections features_1047_a=\ Database File Layout features_1048_a=\ Logging and Recovery features_1049_a=\ Compatibility features_1050_a=\ Auto-Reconnect features_1051_a=\ Automatic Mixed Mode features_1052_a=\ Using the Trace Options features_1053_a=\ Using Other Logging APIs features_1054_a=\ Read Only Databases features_1055_a=\ Read Only Databases in Zip or Jar File features_1056_a=\ Graceful Handling of Low Disk Space Situations features_1057_a=\ Computed Columns / Function Based Index features_1058_a=\ Multi-Dimensional Indexes features_1059_a=\ Using Passwords features_1060_a=\ User-Defined Functions and Stored Procedures features_1061_a=\ Triggers features_1062_a=\ Compacting a Database features_1063_a=\ Cache Settings features_1064_h2=Feature List features_1065_h3=Main Features features_1066_li=Very fast database engine features_1067_li=Open source features_1068_li=Written in Java features_1069_li=Supports standard SQL, JDBC API features_1070_li=Embedded and Server mode, Clustering support features_1071_li=Strong security features features_1072_li=The PostgreSQL ODBC driver can be used features_1073_li=Multi version concurrency features_1074_h3=Additional Features features_1075_li=Disk based or in-memory databases and tables, read-only database support, temporary tables features_1076_li=Transaction support (read committed and serializable transaction isolation), 2-phase-commit features_1077_li=Multiple connections, table level locking features_1078_li=Cost based optimizer, using a genetic algorithm for complex queries, zero-administration features_1079_li=Scrollable and updatable result set support, large result set, external result sorting, functions can return a result set features_1080_li=Encrypted database (AES or XTEA), SHA-256 password encryption, encryption functions, SSL features_1081_h3=SQL Support features_1082_li=Support for multiple schemas, information schema features_1083_li=Referential integrity / foreign key constraints with cascade, check constraints features_1084_li=Inner and outer joins, subqueries, read only views and inline views features_1085_li=Triggers and Java functions / stored procedures features_1086_li=Many built-in functions, including XML and lossless data compression features_1087_li=Wide range of data types including large objects (BLOB/CLOB) and arrays features_1088_li=Sequence and autoincrement columns, computed columns (can be used for function based indexes) features_1089_code=ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP features_1090_li=Collation support, users, roles features_1091_li=Compatibility modes for IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL. features_1092_h3=Security Features features_1093_li=Includes a solution for the SQL injection problem features_1094_li=User password authentication uses SHA-256 and salt features_1095_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_1096_li=All database files (including script files that can be used to backup data) can be encrypted using AES-256 and XTEA encryption algorithms features_1097_li=The remote JDBC driver supports TCP/IP connections over SSL/TLS features_1098_li=The built-in web server supports connections over SSL/TLS features_1099_li=Passwords can be sent to the database using char arrays instead of Strings features_1100_h3=Other Features and Tools features_1101_li=Small footprint (smaller than 1 MB), low memory requirements features_1102_li=Multiple index types (b-tree, tree, hash) features_1103_li=Support for multi-dimensional indexes features_1104_li=CSV (comma separated values) file support features_1105_li=Support for linked tables, and a built-in virtual 'range' table features_1106_code=EXPLAIN PLAN features_1107_li=\ support, sophisticated trace options features_1108_li=Database closing can be delayed or disabled to improve the performance features_1109_li=Web-based Console application (translated to many languages) with autocomplete features_1110_li=The database can generate SQL script files features_1111_li=Contains a recovery tool that can dump the contents of the database features_1112_li=Support for variables (for example to calculate running totals) features_1113_li=Automatic re-compilation of prepared statements features_1114_li=Uses a small number of database files features_1115_li=Uses a checksum for each record and log entry for data integrity features_1116_li=Well tested (high code coverage, randomized stress tests) features_1117_h2=Comparison to Other Database Engines features_1118_th=Feature features_1119_th=H2 features_1120_a=Derby features_1121_a=HSQLDB features_1122_a=MySQL features_1123_a=PostgreSQL features_1124_td=Pure Java features_1125_td=Yes features_1126_td=Yes features_1127_td=Yes features_1128_td=No features_1129_td=No features_1130_td=Embedded Mode (Java) features_1131_td=Yes features_1132_td=Yes features_1133_td=Yes features_1134_td=No features_1135_td=No features_1136_td=Performance (Embedded) features_1137_td=Fast features_1138_td=Slow features_1139_td=Fast features_1140_td=N/A features_1141_td=N/A features_1142_td=In-Memory Mode features_1143_td=Yes features_1144_td=Yes features_1145_td=Yes features_1146_td=No features_1147_td=No features_1148_td=Transaction Isolation features_1149_td=Yes features_1150_td=Yes features_1151_td=No features_1152_td=Yes features_1153_td=Yes features_1154_td=Cost Based Optimizer features_1155_td=Yes features_1156_td=Yes features_1157_td=No features_1158_td=Yes features_1159_td=Yes features_1160_td=Explain Plan features_1161_td=Yes features_1162_td=No features_1163_td=Yes features_1164_td=Yes features_1165_td=Yes features_1166_td=Clustering features_1167_td=Yes features_1168_td=No features_1169_td=No features_1170_td=Yes features_1171_td=Yes features_1172_td=Encrypted Database features_1173_td=Yes features_1174_td=Yes features_1175_td=No features_1176_td=No features_1177_td=No features_1178_td=Linked Tables features_1179_td=Yes features_1180_td=No features_1181_td=Partially *1 features_1182_td=Partially *2 features_1183_td=No features_1184_td=ODBC Driver features_1185_td=Yes features_1186_td=No features_1187_td=No features_1188_td=Yes features_1189_td=Yes features_1190_td=Fulltext Search features_1191_td=Yes features_1192_td=No features_1193_td=No features_1194_td=Yes features_1195_td=Yes features_1196_td=User-Defined Datatypes features_1197_td=Yes features_1198_td=No features_1199_td=No features_1200_td=Yes features_1201_td=Yes features_1202_td=Files per Database features_1203_td=Few features_1204_td=Many features_1205_td=Few features_1206_td=Many features_1207_td=Many features_1208_td=Table Level Locking features_1209_td=Yes features_1210_td=Yes features_1211_td=No features_1212_td=Yes features_1213_td=Yes features_1214_td=Row Level Locking features_1215_td=Yes *9 features_1216_td=Yes features_1217_td=No features_1218_td=Yes features_1219_td=Yes features_1220_td=Multi Version Concurrency features_1221_td=Yes features_1222_td=No features_1223_td=No features_1224_td=Yes features_1225_td=Yes features_1226_td=Role Based Security features_1227_td=Yes features_1228_td=Yes *3 features_1229_td=Yes features_1230_td=Yes features_1231_td=Yes features_1232_td=Updatable Result Sets features_1233_td=Yes features_1234_td=Yes *7 features_1235_td=No features_1236_td=Yes features_1237_td=Yes features_1238_td=Sequences features_1239_td=Yes features_1240_td=No features_1241_td=Yes features_1242_td=No features_1243_td=Yes features_1244_td=Limit and Offset features_1245_td=Yes features_1246_td=No features_1247_td=Yes features_1248_td=Yes features_1249_td=Yes features_1250_td=Temporary Tables features_1251_td=Yes features_1252_td=Yes *4 features_1253_td=Yes features_1254_td=Yes features_1255_td=Yes features_1256_td=Information Schema features_1257_td=Yes features_1258_td=No *8 features_1259_td=No *8 features_1260_td=Yes features_1261_td=Yes features_1262_td=Computed Columns features_1263_td=Yes features_1264_td=No features_1265_td=No features_1266_td=No features_1267_td=Yes *6 features_1268_td=Case Insensitive Columns features_1269_td=Yes features_1270_td=No features_1271_td=Yes features_1272_td=Yes features_1273_td=Yes *6 features_1274_td=Custom Aggregate Functions features_1275_td=Yes features_1276_td=No features_1277_td=No features_1278_td=Yes features_1279_td=Yes features_1280_td=Footprint (jar/dll size) features_1281_td=~1 MB *5 features_1282_td=~2 MB features_1283_td=~700 KB features_1284_td=~4 MB features_1285_td=~6 MB features_1286_p=\ *1 HSQLDB supports text tables. features_1287_p=\ *2 MySQL supports linked MySQL tables under the name 'federated tables'. features_1288_p=\ *3 Derby support for roles based security and password checking as an option. features_1289_p=\ *4 Derby only supports global temporary tables. features_1290_p=\ *5 The default H2 jar file contains debug information, jar files for other databases do not. features_1291_p=\ *6 PostgreSQL supports functional indexes. features_1292_p=\ *7 Derby only supports updatable result sets if the query is not sorted. features_1293_p=\ *8 Derby and HSQLDB don't support standard compliant information schema tables. features_1294_p=\ *9 H2 supports row level locks when using multi version concurrency. features_1295_h3=Derby and HSQLDB features_1296_p=\ After an unexpected process termination (for example power failure), H2 can recover safely and automatically without any user interaction. For Derby and HSQLDB, some manual steps are required ('Another instance of Derby may have already booted the database' / 'The database is already in use by another process'). features_1297_h3=DaffodilDb and One$Db features_1298_p=\ It looks like the development of this database has stopped. The last release was February 2006. features_1299_h3=McKoi features_1300_p=\ It looks like the development of this database has stopped. The last release was August 2004 features_1301_h2=H2 in Use features_1302_p=\ For a list of applications that work with or use H2, see\: <a href\="links.html">Links</a>. features_1303_h2=Connection Modes features_1304_p=\ The following connection modes are supported\: features_1305_li=Embedded mode (local connections using JDBC) features_1306_li=Server mode (remote connections using JDBC or ODBC over TCP/IP) features_1307_li=Mixed mode (local and remote connections at the same time) features_1308_h3=Embedded Mode features_1309_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_1310_h3=Server Mode features_1311_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_1312_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_1313_h3=Mixed Mode features_1314_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_1315_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_1316_h2=Database URL Overview features_1317_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_1318_th=Topic features_1319_th=URL Format and Examples features_1320_a=Embedded (local) connection features_1321_td=\ jdbc\:h2\:[file\:][<path>]<databaseName> features_1322_td=\ jdbc\:h2\:~/test features_1323_td=\ jdbc\:h2\:file\:/data/sample features_1324_td=\ jdbc\:h2\:file\:C\:/data/sample (Windows only) features_1325_a=In-memory (private) features_1326_td=jdbc\:h2\:mem\: features_1327_a=In-memory (named) features_1328_td=\ jdbc\:h2\:mem\:<databaseName> features_1329_td=\ jdbc\:h2\:mem\:test_mem features_1330_a=Server mode (remote connections) using TCP/IP features_1331_td=\ jdbc\:h2\:tcp\://<server>[\:<port>]/[<path>]<databaseName> features_1332_td=\ jdbc\:h2\:tcp\://localhost/~/test features_1333_td=\ jdbc\:h2\:tcp\://dbserv\:8084/~/sample features_1334_a=Server mode (remote connections) using SSL/TLS features_1335_td=\ jdbc\:h2\:ssl\://<server>[\:<port>]/<databaseName> features_1336_td=\ jdbc\:h2\:ssl\://secureserv\:8085/~/sample; features_1337_a=Using encrypted files features_1338_td=\ jdbc\:h2\:<url>;CIPHER\=[AES|XTEA] features_1339_td=\ jdbc\:h2\:ssl\://secureserv/~/testdb;CIPHER\=AES features_1340_td=\ jdbc\:h2\:file\:~/secure;CIPHER\=XTEA features_1341_a=File locking methods features_1342_td=\ jdbc\:h2\:<url>;FILE_LOCK\={NO|FILE|SOCKET} features_1343_td=\ jdbc\:h2\:file\:~/quickAndDirty;FILE_LOCK\=NO features_1344_td=\ jdbc\:h2\:file\:~/private;CIPHER\=XTEA;FILE_LOCK\=SOCKET features_1345_a=Only open if it already exists features_1346_td=\ jdbc\:h2\:<url>;IFEXISTS\=TRUE features_1347_td=\ jdbc\:h2\:file\:~/sample;IFEXISTS\=TRUE features_1348_a=Don't close the database when the VM exits features_1349_td=\ jdbc\:h2\:<url>;DB_CLOSE_ON_EXIT\=FALSE features_1350_a=User name and/or password features_1351_td=\ jdbc\:h2\:<url>[;USER\=<username>][;PASSWORD\=<value>] features_1352_td=\ jdbc\:h2\:file\:~/sample;USER\=sa;PASSWORD\=123 features_1353_a=Debug trace settings features_1354_td=\ jdbc\:h2\:<url>;TRACE_LEVEL_FILE\=<level 0..3> features_1355_td=\ jdbc\:h2\:file\:~/sample;TRACE_LEVEL_FILE\=3 features_1356_a=Ignore unknown settings features_1357_td=\ jdbc\:h2\:<url>;IGNORE_UNKNOWN_SETTINGS\=TRUE features_1358_a=Custom file access mode features_1359_td=\ jdbc\:h2\:<url>;ACCESS_MODE_DATA\=rws features_1360_a=Database in a zip file features_1361_td=\ jdbc\:h2\:zip\:<zipFileName>\!/<databaseName> features_1362_td=\ jdbc\:h2\:zip\:~/db.zip\!/test features_1363_a=Compatibility mode features_1364_td=\ jdbc\:h2\:<url>;MODE\=<databaseType> features_1365_td=\ jdbc\:h2\:~/test;MODE\=MYSQL features_1366_a=Auto-reconnect features_1367_td=\ jdbc\:h2\:<url>;AUTO_RECONNECT\=TRUE features_1368_td=\ jdbc\:h2\:tcp\://localhost/~/test;AUTO_RECONNECT\=TRUE features_1369_a=Automatic mixed mode features_1370_td=\ jdbc\:h2\:<url>;AUTO_SERVER\=TRUE features_1371_td=\ jdbc\:h2\:~/test;AUTO_SERVER\=TRUE features_1372_a=Changing other settings features_1373_td=\ jdbc\:h2\:<url>;<setting>\=<value>[;<setting>\=<value>...] features_1374_td=\ jdbc\:h2\:file\:~/sample;TRACE_LEVEL_SYSTEM_OUT\=3 features_1375_h2=Connecting to an Embedded (Local) Database features_1376_p=\ The database URL for connecting to a local database is <code>jdbc\:h2\:[file\:][<path>]<databaseName></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_1377_h2=In-Memory Databases features_1378_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_1379_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_1380_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 in this way only works within the same virtual machine and class loader environment. features_1381_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_1382_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_1383_h2=Database Files Encryption features_1384_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_1385_h3=Creating a New Database with File Encryption features_1386_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_1387_h3=Connecting to an Encrypted Database features_1388_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_1389_h3=Encrypting or Decrypting a Database features_1390_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_1391_h2=Database File Locking features_1392_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_1393_p=\ The following file locking methods are implemented\: features_1394_li=The default method is 'file' and uses a watchdog thread to protect the database file. The watchdog reads the lock file each second. features_1395_li=The second method is 'socket' and opens a server socket. The socket method does not require reading the lock file every second. The socket method should only be used if the database files are only accessed by one (and always the same) computer. features_1396_li=It is also possible to open the database without file locking; in this case it is up to the application to protect the database files. features_1397_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_1398_p=\ The following code forces the database to not create a lock file at all. Please note that this is unsafe as another process is able to open the same database, possibly leading to data corruption\: features_1399_p=\ For more information about the algorithms, see <a href\="advanced.html\#file_locking_protocols">Advanced / File Locking Protocols</a>. features_1400_h2=Opening a Database Only if it Already Exists features_1401_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_1402_h2=Closing a Database features_1403_h3=Delayed Database Closing features_1404_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 <seconds></code>. The parameter <seconds> 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_1405_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_1406_h3=Don't Close a Database when the VM Exits features_1407_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_1408_h2=Ignore Unknown Settings features_1409_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_1410_h2=Changing Other Settings when Opening a Connection features_1411_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_1412_h2=Custom File Access Mode features_1413_p=\ Usually, the database opens log, data and index files 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 files are 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_1414_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_1415_h2=Multiple Connections features_1416_h3=Opening Multiple Databases at the Same Time features_1417_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_1418_h3=Multiple Connections to the Same Database\: Client/Server features_1419_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_1420_h3=Multithreading Support features_1421_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_1422_h3=Locking, Lock-Timeout, Deadlocks features_1423_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_1424_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_1425_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_1426_th=Type of Lock features_1427_th=SQL Statement features_1428_td=Read features_1429_td=SELECT * FROM TEST; features_1430_td=\ CALL SELECT MAX(ID) FROM TEST; features_1431_td=\ SCRIPT; features_1432_td=Write features_1433_td=SELECT * FROM TEST WHERE 1\=0 FOR UPDATE; features_1434_td=Write features_1435_td=INSERT INTO TEST VALUES(1, 'Hello'); features_1436_td=\ INSERT INTO TEST SELECT * FROM TEST; features_1437_td=\ UPDATE TEST SET NAME\='Hi'; features_1438_td=\ DELETE FROM TEST; features_1439_td=Write features_1440_td=ALTER TABLE TEST ...; features_1441_td=\ CREATE INDEX ... ON TEST ...; features_1442_td=\ DROP INDEX ...; features_1443_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 <milliseconds></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 <milliseconds></code>. The default lock timeout is persistent. features_1444_h2=Database File Layout features_1445_p=\ The following files are created for persistent databases\: features_1446_th=File Name features_1447_th=Description features_1448_th=Number of Files features_1449_td=\ test.h2.db features_1450_td=\ Database file (H2 version 1.2.x). features_1451_td=\ Contains the transaction log, indexes, and data for all tables. features_1452_td=\ Format\: <code><database>.h2.db</code> features_1453_td=\ 1 per database features_1454_td=\ test.data.db features_1455_td=\ Data file (H2 version 1.1.x). features_1456_td=\ Contains the data for all tables. features_1457_td=\ Format\: <code><database>.data.db</code> features_1458_td=\ 1 per database features_1459_td=\ test.index.db features_1460_td=\ Index file (H2 version 1.1.x). features_1461_td=\ Contains the data for all (b-tree) indexes. features_1462_td=\ Format\: <code><database>.index.db</code> features_1463_td=\ 1 per database features_1464_td=\ test.0.log.db features_1465_td=\ Transaction log file (H2 version 1.1.x). features_1466_td=\ The transaction log is used for recovery. features_1467_td=\ Format\: <code><database>.<id>.log.db</code> features_1468_td=\ 0 or more per database features_1469_td=\ test.lock.db features_1470_td=\ Database lock file. features_1471_td=\ Automatically (re-)created while the database is in use. features_1472_td=\ Format\: <code><database>.lock.db</code> features_1473_td=\ 1 per database features_1474_td=\ test.trace.db features_1475_td=\ Trace file (if the trace option is enabled). features_1476_td=\ Contains trace information. features_1477_td=\ Format\: <code><database>.trace.db</code> features_1478_td=\ Renamed to <code><database>.trace.db.old</code> is too big. features_1479_td=\ 0 or 1 per database features_1480_td=\ test.lobs.db/* features_1481_td=\ Directory containing one file for each features_1482_td=\ BLOB or CLOB value larger than a certain size. features_1483_td=\ Format\: <code><id>.t<tableId>.lob.db</code> features_1484_td=\ 1 per large object features_1485_td=\ test.123.temp.db features_1486_td=\ Temporary file. features_1487_td=\ Contains a temporary blob or a large result set. features_1488_td=\ Format\: <code><database>.<id>.temp.db</code> features_1489_td=\ 1 per object features_1490_h3=Moving and Renaming Database Files features_1491_p=\ Database name and location are not stored inside the database files. features_1492_p=\ While a database is closed, the files can be moved to another directory, and they can be renamed as well (as long as all files start with the same name). features_1493_p=\ As there is no platform specific data in the files, they can be moved to other operating systems without problems. features_1494_h3=Backup features_1495_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_1496_p=\ To backup data while the database is running, the SQL command <code>SCRIPT</code> can be used. features_1497_h2=Logging and Recovery features_1498_p=\ Whenever data is modified in the database and those changes are committed, the changes are logged to disk (except for in-memory objects). The changes to the data file itself are usually written later on, to optimize disk access. If there is a power failure, the data and index files are not up-to-date. But because the changes are in the log file, the next time the database is opened, the changes that are in the log file are re-applied automatically. features_1499_p=\ Please note that index file updates are not logged by default. If the database is opened and recovery is required, the index file is rebuilt from scratch. features_1500_p=\ There is usually only one log file per database. This file grows until the database is closed successfully, and is then deleted. Or, if the file gets too big, the database switches to another log file (with a higher id). It is possible to force the log switching by using the <code>CHECKPOINT</code> command. features_1501_p=\ If the database file is corrupted, because the checksum of a record does not match (for example, if the file was edited with another application), the database can be opened in recovery mode. In this case, errors in the database are logged but not thrown. The database should be backed up to a script and re-built as soon as possible. To open the database in the recovery mode, use a database URL must contain <code>;RECOVER\=1</code>, as in <code>jdbc\:h2\:~/test;RECOVER\=1</code>. Indexes are rebuilt in this case, and the summary (object allocation table) is not read in this case, so opening the database takes longer. features_1502_h2=Compatibility features_1503_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_1504_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_1505_h3=Compatibility Modes features_1506_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_1507_h3=DB2 Compatibility Mode features_1508_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_1509_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. features_1510_li=Support for the syntax <code>[OFFSET .. ROW] [FETCH ... ONLY]</code> as an alternative for <code>LIMIT .. OFFSET</code>. features_1511_li=Concatenating <code>NULL</code> with another value results in the other value. features_1512_h3=Derby Compatibility Mode features_1513_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_1514_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. features_1515_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_1516_li=Concatenating <code>NULL</code> with another value results in the other value. features_1517_h3=HSQLDB Compatibility Mode features_1518_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_1519_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. features_1520_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_1521_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_1522_h3=MS SQL Server Compatibility Mode features_1523_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_1524_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. features_1525_li=Identifiers may be quoted using square brackets as in <code>[Test]</code>. features_1526_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_1527_li=Concatenating <code>NULL</code> with another value results in the other value. features_1528_h3=MySQL Compatibility Mode features_1529_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_1530_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_1531_li=Creating indexes in the <code>CREATE TABLE</code> statement is allowed. features_1532_li=Meta data calls return identifiers in lower case. features_1533_li=When converting a floating point number to an integer, the fractional digits are not truncated, but the value is rounded. features_1534_li=Concatenating <code>NULL</code> with another value results in the other value. features_1535_h3=Oracle Compatibility Mode features_1536_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_1537_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. features_1538_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_1539_li=Concatenating <code>NULL</code> with another value results in the other value. features_1540_h3=PostgreSQL Compatibility Mode features_1541_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_1542_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. features_1543_li=When converting a floating point number to an integer, the fractional digits are not be truncated, but the value is rounded. features_1544_li=The system columns <code>CTID</code> and <code>OID</code> are supported. features_1545_h2=Auto-Reconnect features_1546_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. features_1547_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_1548_h2=Automatic Mixed Mode features_1549_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 no matter if the database is already open or not. features_1550_p=\ When using this mode, the first connection to the database is made in embedded mode, and additionally a server is started internally. If the database is already open in another process, the server mode is used automatically. features_1551_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_1552_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_1553_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_1554_h2=Using the Trace Options features_1555_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_1556_li=Trace to <code>System.out</code> and/or to a file features_1557_li=Support for trace levels <code>OFF, ERROR, INFO, DEBUG</code> features_1558_li=The maximum size of the trace file can be set features_1559_li=It is possible to generate Java source code from the trace file features_1560_li=Trace can be enabled at runtime by manually creating a file features_1561_h3=Trace Options features_1562_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_1563_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_1564_h3=Setting the Maximum Size of the Trace File features_1565_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_1566_h3=Java Code Generation features_1567_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_1568_p=\ To filter the Java source code, use the <code>ConvertTraceFile</code> tool as follows\: features_1569_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_1570_h2=Using Other Logging APIs features_1571_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_1572_a=SLF4J features_1573_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_1574_p=\ To enable SLF4J, set the file trace level to 4 in the database URL\: features_1575_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><database>.trace.db</code> for error messages. features_1576_h2=Read Only Databases features_1577_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 so that the log file gets smaller. Do not delete the log file. Then, make the database files read-only using the operating system. When you open the database now, it is read-only. There are two ways an application can find out whether database is read-only\: by calling <code>Connection.isReadOnly()</code> or by executing the SQL statement <code>CALL READONLY()</code>. features_1578_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_1579_h2=Read Only Databases in Zip or Jar File features_1580_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_1581_p=\ When the zip file is created, you can open the database in the zip file using the following database URL\: features_1582_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_1583_h2=Graceful Handling of Low Disk Space Situations features_1584_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_1585_h3=Opening a Corrupted Database features_1586_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_1587_h2=Computed Columns / Function Based Index features_1588_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_1589_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_1590_h2=Multi-Dimensional Indexes features_1591_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_1592_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_1593_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_1594_h2=Using Passwords features_1595_h3=Using Secure Passwords features_1596_p=\ Remember that weak passwords can be broken no matter of the encryption and security protocol. Don't use passwords that can be found in a dictionary. Also appending numbers does not make them secure. A way to create good passwords that can be remembered is, take the first letters of a sentence, use upper and lower case characters, and creatively include special characters. Example\: features_1597_code=i'sE2rtPiUKtT features_1598_p=\ from the sentence <code>it's easy to remember this password if you know the trick</code>. features_1599_h3=Passwords\: Using Char Arrays instead of Strings features_1600_p=\ Java strings are immutable objects and cannot be safely 'destroyed' by the application. After creating a string, it will remain in the main memory of the computer at least until it is garbage collected. The garbage collection cannot be controlled by the application, and even if it is garbage collected the data may still remain in memory. It might also be possible that the part of memory containing the password is swapped to disk (because not enough main memory is available). features_1601_p=\ An attacker might have access to the swap file of the operating system. It is therefore a good idea to use char arrays instead of strings to store passwords. Char arrays can be cleared (filled with zeros) after use, and therefore the password will not be stored in the swap file. features_1602_p=\ This database supports using char arrays instead of string to pass user and file passwords. The following code can be used to do that\: features_1603_p=\ This example requires Java 1.6. When using Swing, use <code>javax.swing.JPasswordField</code>. features_1604_h3=Passing the User Name and/or Password in the URL features_1605_p=\ Instead of passing the user name as a separate parameter as in <code> Connection conn \= DriverManager. getConnection("jdbc\:h2\:~/test", "sa", "123"); </code> the user name (and/or password) can be supplied in the URL itself\: <code> Connection conn \= DriverManager. getConnection("jdbc\:h2\:~/test;USER\=sa;PASSWORD\=123"); </code> The settings in the URL override the settings passed as a separate parameter. features_1606_h2=User-Defined Functions and Stored Procedures features_1607_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 functions can be defined using source code, or as a reference to a compiled class that is available in the classpath. features_1608_h3=Referencing a Compiled Method features_1609_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_1610_p=\ The Java function must be registered in the database by calling <code>CREATE ALIAS ... FOR</code>\: features_1611_p=\ For a complete sample application, see <code>src/test/org/h2/samples/Function.java</code>. features_1612_h3=Declaring Functions as Source Code features_1613_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_1614_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_1615_p=\ The following template is used to create a complete Java class\: features_1616_h3=Function Data Type Mapping features_1617_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_1618_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_1619_h3=Functions That Require a Connection features_1620_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_1621_h3=Functions Throwing an Exception features_1622_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_1623_h3=Functions Returning a Result Set features_1624_p=\ Functions may returns a result set. Such a function can be called with the <code>CALL</code> statement\: features_1625_h3=Using SimpleResultSet features_1626_p=\ A function can create a result set using the <code>SimpleResultSet</code> tool\: features_1627_h3=Using a Function as a Table features_1628_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_1629_h2=Triggers features_1630_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_1631_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_1632_p=\ The trigger can be used to veto a change by throwing a <code>SQLException</code>. features_1633_h2=Compacting a Database features_1634_p=\ Empty space in the database file is re-used automatically. To re-build the indexes, the simplest way is to delete the <code>.index.db</code> file while the database is closed. However in some situations (for example after deleting a lot of data in a database), one sometimes wants to shrink the size of the database (compact a database). Here is a sample function to do this\: features_1635_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_1636_h2=Cache Settings features_1637_p=\ The database keeps most frequently used data and index pages in the main memory. The amount of memory used for caching can be changed using the setting <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>. This setting has no effect for in-memory databases. features_1638_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_1639_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 for the data and index file. fragments_1000_b=Search\: fragments_1001_td=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 & Roadmap fragments_1028_a=Links fragments_1029_a=License fragments_1030_td= 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_b=Search\: history_1001_td=Highlight keyword(s) history_1002_a=Home history_1003_a=Download history_1004_a=Cheat Sheet history_1005_b=Documentation history_1006_a=Quickstart history_1007_a=Installation history_1008_a=Tutorial history_1009_a=Features history_1010_a=Performance history_1011_a=Advanced history_1012_b=Reference history_1013_a=SQL Grammar history_1014_a=Functions history_1015_a=Data Types history_1016_a=Javadoc history_1017_a=PDF (1 MB) history_1018_b=Support history_1019_a=FAQ history_1020_a=Error Analyzer history_1021_a=Google Group (English) history_1022_a=Google Group (Japanese) history_1023_a=Google Group (Chinese) history_1024_b=Appendix history_1025_a=JaQu history_1026_a=Build history_1027_a=History & Roadmap history_1028_a=Links history_1029_a=License history_1030_td= history_1031_h1=History and Roadmap history_1032_a=\ Change Log history_1033_a=\ Roadmap history_1034_a=\ History of this Database Engine history_1035_a=\ Why Java history_1036_a=\ Supporters history_1037_h2=Change Log history_1038_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_1039_h2=Roadmap history_1040_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_1041_h2=History of this Database Engine history_1042_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_1043_h2=Why Java history_1044_p=\ The main reasons to use a Java database are\: history_1045_li=Very simple to integrate in Java applications history_1046_li=Support for many different platforms history_1047_li=More secure than native applications (no buffer overflows) history_1048_li=User defined functions (or triggers) run very fast history_1049_li=Unicode support history_1050_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_1051_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_1052_p=\ Java is future proof\: a lot of companies support Java. Java is now open source. history_1053_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_1054_h2=Supporters history_1055_p=\ Many thanks for those who reported bugs, gave valuable feedback, spread the word, and translated this project. Also many thanks to the donors who contributed via PayPal\: history_1056_a=NetSuxxess GmbH, Germany history_1057_a=Poker Copilot, Steve McLeod, Germany history_1058_a=SkyCash, Poland history_1059_a=Lumber-mill, Inc., Japan history_1060_li=Martin Wildam, Austria history_1061_li=Donald Bleyl, USA history_1062_li=Frank Berger, Germany history_1063_li=Ashwin Jayaprakash, USA history_1064_li=Florent Ramiere, France history_1065_li=Jun Iyama, Japan history_1066_li=Antonio Casqueiro, Portugal history_1067_li=Oliver Computing LLC, USA history_1068_li=Harpal Grover Consulting Inc., USA history_1069_li=Elisabetta Berlini, Italy history_1070_li=William Gilbert, USA history_1071_li=Antonio Dieguez, Chile history_1072_a=Ontology Works, USA history_1073_li=Pete Haidinyak, USA history_1074_li=William Osmond, USA history_1075_li=Joachim Ansorg, Germany history_1076_li=Oliver Soerensen, Germany history_1077_li=Christos Vasilakis, Greece history_1078_li=Fyodor Kupolov, Denmark history_1079_li=Jakob Jenkov, Denmark history_1080_li=Stéphane Chartrand, Switzerland history_1081_li=Glenn Kidd, USA history_1082_li=Gustav Trede, Sweden installation_1000_b=Search\: installation_1001_td=Highlight keyword(s) installation_1002_a=Home installation_1003_a=Download installation_1004_a=Cheat Sheet installation_1005_b=Documentation installation_1006_a=Quickstart installation_1007_a=Installation installation_1008_a=Tutorial installation_1009_a=Features installation_1010_a=Performance installation_1011_a=Advanced installation_1012_b=Reference installation_1013_a=SQL Grammar installation_1014_a=Functions installation_1015_a=Data Types installation_1016_a=Javadoc installation_1017_a=PDF (1 MB) installation_1018_b=Support installation_1019_a=FAQ installation_1020_a=Error Analyzer installation_1021_a=Google Group (English) installation_1022_a=Google Group (Japanese) installation_1023_a=Google Group (Chinese) installation_1024_b=Appendix installation_1025_a=JaQu installation_1026_a=Build installation_1027_a=History & Roadmap installation_1028_a=Links installation_1029_a=License installation_1030_td= installation_1031_h1=Installation installation_1032_a=\ Requirements installation_1033_a=\ Supported Platforms installation_1034_a=\ Installing the Software installation_1035_a=\ Directory Structure installation_1036_h2=Requirements installation_1037_p=\ To run the database, the following minimum software stack is known to work\: installation_1038_li=Windows XP or Vista, Mac OS X, or Linux installation_1039_li=Recommended Windows file system\: NTFS (FAT32 only supports files up to 4 GB) installation_1040_li=Sun JDK 1.5 or newer installation_1041_li=Mozilla Firefox installation_1042_h2=Supported Platforms installation_1043_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.5, but it also works in many other operating systems and using other Java runtime environments. installation_1044_h2=Installing the Software installation_1045_p=\ To install the software, run the installer or unzip it to a directory of your choice. installation_1046_h2=Directory Structure installation_1047_p=\ After installing, you should get the following directory structure\: installation_1048_th=Directory installation_1049_th=Contents installation_1050_td=bin installation_1051_td=JAR and batch files installation_1052_td=docs installation_1053_td=Documentation installation_1054_td=docs/html installation_1055_td=HTML pages installation_1056_td=docs/javadoc installation_1057_td=Javadoc files installation_1058_td=ext installation_1059_td=External dependencies (downloaded when building) installation_1060_td=service installation_1061_td=Tools to run the database as a Windows Service installation_1062_td=src installation_1063_td=Source files installation_1064_td=src/docsrc installation_1065_td=Documentation sources installation_1066_td=src/installer installation_1067_td=Installer, shell, and release build script installation_1068_td=src/main installation_1069_td=Database engine source code installation_1070_td=src/test installation_1071_td=Test source code installation_1072_td=src/tools installation_1073_td=Tools and database adapters source code jaqu_1000_b=Search\: jaqu_1001_td=Highlight keyword(s) jaqu_1002_a=Home jaqu_1003_a=Download jaqu_1004_a=Cheat Sheet jaqu_1005_b=Documentation jaqu_1006_a=Quickstart jaqu_1007_a=Installation jaqu_1008_a=Tutorial jaqu_1009_a=Features jaqu_1010_a=Performance jaqu_1011_a=Advanced jaqu_1012_b=Reference jaqu_1013_a=SQL Grammar jaqu_1014_a=Functions jaqu_1015_a=Data Types jaqu_1016_a=Javadoc jaqu_1017_a=PDF (1 MB) jaqu_1018_b=Support jaqu_1019_a=FAQ jaqu_1020_a=Error Analyzer jaqu_1021_a=Google Group (English) jaqu_1022_a=Google Group (Japanese) jaqu_1023_a=Google Group (Chinese) jaqu_1024_b=Appendix jaqu_1025_a=JaQu jaqu_1026_a=Build jaqu_1027_a=History & Roadmap jaqu_1028_a=Links jaqu_1029_a=License jaqu_1030_td= jaqu_1031_h1=JaQu jaqu_1032_a=\ What is JaQu jaqu_1033_a=\ Differences to Other Data Access Tools jaqu_1034_a=\ Current State jaqu_1035_a=\ Building the JaQu Library jaqu_1036_a=\ Requirements jaqu_1037_a=\ Example Code jaqu_1038_a=\ Configuration jaqu_1039_a=\ Natural Syntax jaqu_1040_a=\ Other Ideas jaqu_1041_a=\ Similar Projects jaqu_1042_h2=What is JaQu jaqu_1043_p=\ JaQu stands for Java Query and allows to access databases using pure Java. JaQu provides a fluent interface (or internal DSL) to access a database. JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a Microsoft .NET technology). The following JaQu code\: jaqu_1044_p=\ stands for the SQL statement\: jaqu_1045_h2=Differences to Other Data Access Tools jaqu_1046_p=\ Unlike SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java, auto-complete in the IDE and Javadoc and are supported. Type checking is performed by the compiler. JaQu fully protects against SQL injection. jaqu_1047_p=\ JaQu is much smaller than persistence frameworks such as Hibernate. Unlike iBatis and Hibernate, no XML or annotation based configuration is required; instead the configuration (if required at all) is done in pure Java, in the application itself. jaqu_1048_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. jaqu_1049_h3=Restrictions jaqu_1050_p=\ Primitive types (eg. <code>boolean, int, long, double</code>) are not supported. Use <code>java.lang.Boolean, Integer, Long, Double</code> instead. jaqu_1051_h3=Why in Java? jaqu_1052_p=\ Most people use Java in their application. 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. jaqu_1053_h2=Current State jaqu_1054_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_1055_code=src/test/org/h2/test/jaqu/* jaqu_1056_li=\ (samples and tests) jaqu_1057_code=src/tools/org/h2/jaqu/* jaqu_1058_li=\ (framework) jaqu_1059_h2=Building the JaQu Library jaqu_1060_p=\ To create the JaQu jar file, run\: <code>build jarJaqu</code>. This will create the file <code>bin/h2jaqu.jar</code>. jaqu_1061_h2=Requirements jaqu_1062_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_1063_h2=Example Code jaqu_1064_h2=Configuration jaqu_1065_p=\ JaQu does not require any configuration when using the default 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_1066_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 regular Java, the configuration can depend on the environment. This is not possible using annotations. Unlike XML mapping configuration, the configuration is integrated in the class itself. jaqu_1067_h2=Natural Syntax jaqu_1068_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 work yet). The planned syntax is\: jaqu_1069_h2=Other Ideas jaqu_1070_p=\ This project has just been started, and nothing is fixed yet. Some ideas for what to implement are\: jaqu_1071_li=Support queries on collections (instead of using a database). jaqu_1072_li=Provide API level compatibility with JPA (so that JaQu can be used as an extension of JPA). jaqu_1073_li=Internally use a JPA implementation (for example Hibernate) instead of SQL directly. jaqu_1074_li=Use PreparedStatements and cache them. jaqu_1075_h2=Similar Projects jaqu_1076_a=Cement Framework jaqu_1077_a=Dreamsource ORM jaqu_1078_a=Empire-db jaqu_1079_a=JEQUEL\: Java Embedded QUEry Language jaqu_1080_a=Joist jaqu_1081_a=JoSQL jaqu_1082_a=LIQUidFORM jaqu_1083_a=Quaere (Alias implementation) jaqu_1084_a=Quaere jaqu_1085_a=Querydsl jaqu_1086_a=Squill license_1000_b=Search\: license_1001_td=Highlight keyword(s) license_1002_a=Home license_1003_a=Download license_1004_a=Cheat Sheet license_1005_b=Documentation license_1006_a=Quickstart license_1007_a=Installation license_1008_a=Tutorial license_1009_a=Features license_1010_a=Performance license_1011_a=Advanced license_1012_b=Reference license_1013_a=SQL Grammar license_1014_a=Functions license_1015_a=Data Types license_1016_a=Javadoc license_1017_a=PDF (1 MB) license_1018_b=Support license_1019_a=FAQ license_1020_a=Error Analyzer license_1021_a=Google Group (English) license_1022_a=Google Group (Japanese) license_1023_a=Google Group (Chinese) license_1024_b=Appendix license_1025_a=JaQu license_1026_a=Build license_1027_a=History & Roadmap license_1028_a=Links license_1029_a=License license_1030_td= license_1031_h1=License license_1032_h2=Summary and License FAQ license_1033_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_1034_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_1035_li=You can use H2 for free. You can integrate it into your application (including commercial applications), and you can distribute it. license_1036_li=Files containing only your code are not covered by this license (it is 'commercial friendly'). license_1037_li=Modifications to the H2 source code must be published. license_1038_li=You don't need to provide the source code of H2 if you did not modify anything. license_1039_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_1040_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_1041_h2=H2 License, Version 1.0 license_1042_h3=1. Definitions license_1043_b=1.0.1. "Commercial Use" license_1044_p=\ means distribution or otherwise making the Covered Code available to a third party. license_1045_b=1.1. "Contributor" license_1046_p=\ means each entity that creates or contributes to the creation of Modifications. license_1047_b=1.2. "Contributor Version" license_1048_p=\ means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. license_1049_b=1.3. "Covered Code" license_1050_p=\ means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. license_1051_b=1.4. "Electronic Distribution Mechanism" license_1052_p=\ means a mechanism generally accepted in the software development community for the electronic transfer of data. license_1053_b=1.5. "Executable" license_1054_p=\ means Covered Code in any form other than Source Code. license_1055_b=1.6. "Initial Developer" license_1056_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_1057_b=1.7. "Larger Work" license_1058_p=\ means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. license_1059_b=1.8. "License" license_1060_p=\ means this document. license_1061_b=1.8.1. "Licensable" license_1062_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_1063_b=1.9. "Modifications" license_1064_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_1065_p=1.9.a. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. license_1066_p=1.9.b. Any new file that contains any part of the Original Code or previous Modifications. license_1067_b=1.10. "Original Code" license_1068_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_1069_b=1.10.1. "Patent Claims" license_1070_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_1071_b=1.11. "Source Code" license_1072_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_1073_b=1.12. "You" (or "Your") license_1074_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_1075_h3=2. Source Code License license_1076_h4=2.1. The Initial Developer Grant license_1077_p=\ The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims\: license_1078_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_1079_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_1080_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_1081_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_1082_h4=2.2. Contributor Grant license_1083_p=\ Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license license_1084_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_1085_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_1086_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_1087_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_1088_h3=3. Distribution Obligations license_1089_h4=3.1. Application of License license_1090_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_1091_h4=3.2. Availability of Source Code license_1092_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_1093_h4=3.3. Description of Modifications license_1094_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_1095_h4=3.4. Intellectual Property Matters license_1096_b=3.4.a. Third Party Claims\: license_1097_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_1098_b=3.4.b. Contributor APIs\: license_1099_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_1100_b=3.4.c. Representations\: license_1101_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_1102_h4=3.5. Required Notices license_1103_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_1104_h4=3.6. Distribution of Executable Versions license_1105_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_1106_h4=3.7. Larger Works license_1107_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_1108_h3=4. Inability to Comply Due to Statute or Regulation. license_1109_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_1110_h3=5. Application of this License. license_1111_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_1112_h3=6. Versions of the License. license_1113_h4=6.1. New Versions license_1114_p=\ The license_1115_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_1116_h4=6.2. Effect of New Versions license_1117_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_1118_em=H2 Group</em>. No one other than the license_1119_em=H2 Group</em> has the right to modify the terms applicable to Covered Code created under this License. license_1120_h4=6.3. Derivative Works license_1121_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_1122_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_1123_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_1124_h3=7. Disclaimer of Warranty license_1125_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_1126_h3=8. Termination license_1127_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_1128_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_1129_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_1130_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_1131_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_1132_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_1133_h3=9. Limitation of Liability license_1134_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_1135_h3=10. United States Government End Users license_1136_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_1137_h3=11. Miscellaneous license_1138_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_1139_h3=12. Responsibility for Claims license_1140_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_1141_h3=13. Multiple-Licensed Code license_1142_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_1143_h3=Exhibit A license_1144_h2=Eclipse Public License - Version 1.0 license_1145_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_1146_h3=1. DEFINITIONS license_1147_p=\ "Contribution" means\: license_1148_p=\ a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and license_1149_p=\ b) in the case of each subsequent Contributor\: license_1150_p=\ i) changes to the Program, and license_1151_p=\ ii) additions to the Program; license_1152_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_1153_p=\ "Contributor" means any person or entity that distributes the Program. license_1154_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_1155_p=\ "Program" means the Contributions distributed in accordance with this Agreement. license_1156_p=\ "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. license_1157_h3=2. GRANT OF RIGHTS license_1158_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_1159_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_1160_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_1161_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_1162_h3=3. REQUIREMENTS license_1163_p=\ A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that\: license_1164_p=\ a) it complies with the terms and conditions of this Agreement; and license_1165_p=\ b) its license agreement\: license_1166_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_1167_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_1168_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_1169_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_1170_p=\ When the Program is made available in source code form\: license_1171_p=\ a) it must be made available under this Agreement; and license_1172_p=\ b) a copy of this Agreement must be included with each copy of the Program. license_1173_p=\ Contributors may not remove or alter any copyright notices contained within the Program. license_1174_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_1175_h3=4. COMMERCIAL DISTRIBUTION license_1176_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_1177_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_1178_h3=5. NO WARRANTY license_1179_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_1180_h3=6. DISCLAIMER OF LIABILITY license_1181_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_1182_h3=7. GENERAL license_1183_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_1184_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_1185_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_1186_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_1187_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_b=Search\: links_1001_td=Highlight keyword(s) links_1002_a=Home links_1003_a=Download links_1004_a=Cheat Sheet links_1005_b=Documentation links_1006_a=Quickstart links_1007_a=Installation links_1008_a=Tutorial links_1009_a=Features links_1010_a=Performance links_1011_a=Advanced links_1012_b=Reference links_1013_a=SQL Grammar links_1014_a=Functions links_1015_a=Data Types links_1016_a=Javadoc links_1017_a=PDF (1 MB) links_1018_b=Support links_1019_a=FAQ links_1020_a=Error Analyzer links_1021_a=Google Group (English) links_1022_a=Google Group (Japanese) links_1023_a=Google Group (Chinese) links_1024_b=Appendix links_1025_a=JaQu links_1026_a=Build links_1027_a=History & Roadmap links_1028_a=Links links_1029_a=License links_1030_td= links_1031_h1=H2 In Use and Links links_1032_p=\ Those 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 in the group. links_1033_h2=Books links_1034_a=\ Seam In Action links_1035_h2=Extensions links_1036_a=\ Grails H2 Database Plugin links_1037_a=\ h2osgi\: OSGi for the H2 Database links_1038_a=\ H2Sharp\: ADO.NET interface for the H2 database engine links_1039_a=\ H2 Spatial\: spatial functions to H2 database links_1040_h2=Blog Articles links_1041_a=\ Analyzing CSVs with H2 in under 10 minutes (2009-12-07) links_1042_a=\ Efficient sorting and iteration on large databases (2009-06-15) links_1043_a=\ Porting Flexive to the H2 Database (2008-12-05) links_1044_a=\ H2 Database with GlassFish (2008-11-24) links_1045_a=\ Using H2 Database with Glassfish and Toplink (2008-08-07) links_1046_a=\ H2 Database - Performance Tracing (2008-04-30) links_1047_a=\ Testing your JDBC data access layer with DBUnit and H2 (2007-09-18) links_1048_a=\ Open Source Databases Comparison (2007-09-11) links_1049_a=\ The Codist\: The Open Source Frameworks I Use (2007-07-23) links_1050_a=\ The Codist\: SQL Injections\: How Not To Get Stuck (2007-05-08) links_1051_a=\ One Man Band\: (Helma + H2) \=\= "to easy" (2007-03-11) links_1052_a=\ David Coldrick's Weblog\: New Version of H2 Database Released (2007-01-06) links_1053_a=\ The Codist\: Write Your Own Database, Again (2006-11-13) links_1054_h2=Project Pages links_1055_a=\ Ohloh links_1056_a=\ Freshmeat Project Page links_1057_a=\ Wikipedia links_1058_a=\ Java Source Net links_1059_a=\ Linux Package Manager links_1060_h2=Database Frontends / Tools links_1061_a=\ DB Solo links_1062_p=\ SQL query tool. links_1063_a=\ DbVisualizer links_1064_p=\ Database tool. links_1065_a=\ Execute Query links_1066_p=\ Database utility written in Java. links_1067_a=\ [fleXive] links_1068_p=\ JavaEE 5 open source framework for the development of complex and evolving (web-)applications. links_1069_a=\ HenPlus links_1070_p=\ HenPlus is a SQL shell written in Java. links_1071_a=\ RazorSQL links_1072_p=\ An SQL query tool, database browser, SQL editor, and database administration tool. links_1073_a=\ SQL Developer links_1074_p=\ Universal Database Frontend. links_1075_a=\ SQL Workbench/J links_1076_p=\ Free DBMS-independent SQL tool. links_1077_a=\ SQuirreL SQL Client links_1078_p=\ Graphical tool to view the structure of a database, browse the data, issue SQL commands etc. links_1079_a=\ SQuirreL DB Copy Plugin links_1080_p=\ Tool to copy data from one database to another. links_1081_h2=Products and Projects links_1082_a=\ Adeptia BPM links_1083_p=\ A Business Process Management (BPM) suite to quickly and easily automate business processes and workflows. links_1084_a=\ Adeptia Integration links_1085_p=\ Process-centric, services-based application integration suite. links_1086_a=\ Æjaks links_1087_p=\ A server-side scripting environment to build AJAX enabled web applications. links_1088_a=\ Axiom Stack links_1089_p=\ A web framework that let's you write dynamic web applications with Zen-like simplicity. links_1090_a=\ Apache Cayenne links_1091_p=\ Open source persistence framework providing object-relational mapping (ORM) and remoting services. links_1092_a=\ Apache Jackrabbit links_1093_p=\ Open source implementation of the Java Content Repository API (JCR). links_1094_a=\ Apache OpenJPA links_1095_p=\ Open source implementation of the Java Persistence API (JPA). links_1096_a=\ AppFuse links_1097_p=\ Helps building web applications. links_1098_a=\ BGBlitz links_1099_p=\ The Swiss army knife of Backgammon. links_1100_a=\ Blojsom links_1101_p=\ Java-based multi-blog, multi-user software package (Mac OS X Weblog Server). links_1102_a=\ Bonita links_1103_p=\ Open source workflow solution for handing long-running, user-oriented processes providing out of the box workflow and business process management features. links_1104_a=\ Bookmarks Portlet links_1105_p=\ JSR 168 compliant bookmarks management portlet application. links_1106_a=\ Claros inTouch links_1107_p=\ Ajax communication suite with mail, addresses, notes, IM, and rss reader. links_1108_a=\ CrashPlan PRO Server links_1109_p=\ Easy and cross platform backup solution for business and service providers. links_1110_a=\ DbUnit links_1111_p=\ A JUnit extension (also usable with Ant) targeted for database-driven projects. links_1112_a=\ Dinamica Framework links_1113_p=\ Ajax/J2EE framework for RAD development (mainly oriented toward hispanic markets). links_1114_a=\ Ebean ORM Persistence Layer links_1115_p=\ Open source Java Object Relational Mapping tool. links_1116_a=\ Eclipse CDO links_1117_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_1118_a=\ Epictetus links_1119_p=\ Free cross platform database tool. links_1120_a=\ Fabric3 links_1121_p=\ Fabric3 is a project implementing a federated service network based on the Service Component Architecture specification (http\://www.osoa.org). links_1122_a=\ FIT4Data links_1123_p=\ A testing framework for data management applications built on the Java implementation of FIT. links_1124_a=\ Flux links_1125_p=\ Java job scheduler, file transfer, workflow, and BPM. links_1126_a=\ GBIF Integrated Publishing Toolkit (IPT) links_1127_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_1128_a=\ GNU Gluco Control links_1129_p=\ Helps you to manage your diabetes. links_1130_a=\ Golden T Studios links_1131_p=\ Fun-to-play games with a simple interface. links_1132_a=\ Group Session links_1133_p=\ Open source web groupware. links_1134_a=\ HA-JDBC links_1135_p=\ High-Availability JDBC\: A JDBC proxy that provides light-weight, transparent, fault tolerant clustering capability to any underlying JDBC driver. links_1136_a=\ Harbor links_1137_p=\ Pojo Application Server. links_1138_a=\ Hibernate links_1139_p=\ Relational persistence for idiomatic Java (O-R mapping tool). links_1140_a=\ Hibicius links_1141_p=\ Online Banking Client for the HBCI protocol. links_1142_a=\ ImageMapper links_1143_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_1144_a=\ JAMWiki links_1145_p=\ Java-based Wiki engine. links_1146_a=\ Jala links_1147_p=\ Open source collection of JavaScript modules. links_1148_a=\ Java Simon links_1149_p=\ Simple Monitoring API. links_1150_a=\ JBoss jBPM links_1151_p=\ A platform for executable process languages ranging from business process management (BPM) over workflow to service orchestration. links_1152_a=\ JBoss Jopr links_1153_p=\ An enterprise management solution for JBoss middleware projects and other application technologies. links_1154_a=\ JGeocoder links_1155_p=\ Free Java geocoder. Geocoding is the process of estimating a latitude and longitude for a given location. links_1156_a=\ JGrass links_1157_p=\ Java Geographic Resources Analysis Support System. Free, multi platform, open source GIS based on the GIS framework of uDig. links_1158_a=\ Jena links_1159_p=\ Java framework for building Semantic Web applications. links_1160_a=\ JMatter links_1161_p=\ Framework for constructing workgroup business applications based on the Naked Objects Architectural Pattern. links_1162_a=\ JotBot links_1163_p=\ Records your day at user defined intervals. links_1164_a=\ JPOX links_1165_p=\ Java persistent objects. links_1166_a=\ Liftweb links_1167_p=\ A Scala-based, secure, developer friendly web framework. links_1168_a=\ LiquiBase links_1169_p=\ A tool to manage database changes and refactorings. links_1170_a=\ Luntbuild links_1171_p=\ Build automation and management tool. links_1172_a=\ localdb links_1173_p=\ A tool that locates the full file path of the folder containing the database files. links_1174_a=\ Magnolia links_1175_p=\ Microarray Data Management and Export System for PFGRC (Pathogen Functional Genomics Resource Center) Microarrays. links_1176_a=\ MiniConnectionPoolManager links_1177_p=\ A lightweight standalone JDBC connection pool manager. links_1178_a=\ Mr. Persister links_1179_p=\ Simple, small and fast object relational mapping. links_1180_a=\ Myna Application Server links_1181_p=\ Java web app that provides dynamic web content and Java libraries access from JavaScript. links_1182_a=\ MyTunesRss links_1183_p=\ MyTunesRSS lets you listen to your music wherever you are. links_1184_a=\ NCGC CurveFit links_1185_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 (>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_1186_a=\ Nuxeo links_1187_p=\ Standards-based, open source platform for building ECM applications. links_1188_a=\ nWire links_1189_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_1190_a=\ Ontology Works links_1191_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_1192_a=\ Ontoprise OntoBroker links_1193_p=\ SemanticWeb-Middleware. It supports all W3C Semantic Web recommendations\: OWL, RDF, RDFS, SPARQL, and F-Logic. links_1194_a=\ Open Anzo links_1195_p=\ Semantic Application Server. links_1196_a=\ OpenGroove links_1197_p=\ OpenGroove is a groupware program that allows users to synchronize data. links_1198_a=\ OpenSocial Development Environment (OSDE) links_1199_p=\ Development tool for OpenSocial application. links_1200_a=\ Orion links_1201_p=\ J2EE Application Server. links_1202_a=\ P5H2 links_1203_p=\ A library for the <a href\="http\://www.processing.org">Processing</a> programming language and environment. links_1204_a=\ Phase-6 links_1205_p=\ A computer based learning software. links_1206_a=\ Pickle links_1207_p=\ Pickle is a Java library containing classes for persistence, concurrency, and logging. links_1208_a=\ Piman links_1209_p=\ Water treatment projects data management. links_1210_a=\ PolePosition links_1211_p=\ Open source database benchmark. links_1212_a=\ Poormans links_1213_p=\ Very basic CMS running as a SWT application and generating static html pages. links_1214_a=\ Railo links_1215_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_1216_a=\ Razuna links_1217_p=\ Open source Digital Asset Management System with integrated Web Content Management. links_1218_a=\ RIFE links_1219_p=\ A full-stack web application framework with tools and APIs to implement most common web features. links_1220_a=\ Rutema links_1221_p=\ Rutema is a test execution and management tool for heterogeneous development environments written in Ruby. links_1222_a=\ Sava links_1223_p=\ Open-source web-based content management system. links_1224_a=\ Scriptella links_1225_p=\ ETL (Extract-Transform-Load) and script execution tool. links_1226_a=\ Sesar links_1227_p=\ Dependency Injection Container with Aspect Oriented Programming. links_1228_a=\ SemmleCode links_1229_p=\ Eclipse plugin to help you improve software quality. links_1230_a=\ SeQuaLite links_1231_p=\ A free, light-weight, java data access framework. links_1232_a=\ ShapeLogic links_1233_p=\ Toolkit for declarative programming, image processing and computer vision. links_1234_a=\ Shellbook links_1235_p=\ Desktop publishing application. links_1236_a=\ Signsoft intelliBO links_1237_p=\ Persistence middleware supporting the JDO specification. links_1238_a=\ SimpleORM links_1239_p=\ Simple Java Object Relational Mapping. links_1240_a=\ SymmetricDS links_1241_p=\ A web-enabled, database independent, data synchronization/replication software. links_1242_a=\ SmartFoxServer links_1243_p=\ Platform for developing multiuser applications and games with Macromedia Flash. links_1244_a=\ Social Bookmarks Friend Finder links_1245_p=\ A GUI application that allows you to find users with similar bookmarks to the user specified (for delicious.com). links_1246_a=\ Springfuse links_1247_p=\ Code generation For Spring, Spring MVC & Hibernate. links_1248_a=\ SQLOrm links_1249_p=\ Java Object Relation Mapping. links_1250_a=\ StorYBook links_1251_p=\ A summary-based tool for novelist and script writers. It helps to keep the overview over the various traces a story has. links_1252_a=\ StreamCruncher links_1253_p=\ Event (stream) processing kernel. links_1254_a=\ Tune Backup links_1255_p=\ Easy-to-use backup solution for your iTunes library. links_1256_a=\ weblica links_1257_p=\ Desktop CMS. links_1258_a=\ Web of Web links_1259_p=\ Collaborative and realtime interactive media platform for the web. links_1260_a=\ Werkzeugkasten links_1261_p=\ Minimum Java Toolset. links_1262_a=\ VPDA links_1263_p=\ View providers driven applications is a Java based application framework for building applications composed from server components - view providers. links_1264_a=\ Volunteer database links_1265_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_h3=Download mainWeb_1007_td=\ Version 1.2.129 (2010-02-19)\: mainWeb_1008_a=Windows Installer (4 MB) mainWeb_1009_a=All Platforms (zip, 5 MB) mainWeb_1010_a=All Downloads mainWeb_1011_td= mainWeb_1012_h3=Support mainWeb_1013_a=English Google Group mainWeb_1014_a=Japanese Google Group mainWeb_1015_p=\ For non-technical issues, use\: mainWeb_1016_h3=Features mainWeb_1017_th=H2 mainWeb_1018_a=Derby mainWeb_1019_a=HSQLDB mainWeb_1020_a=MySQL mainWeb_1021_a=PostgreSQL mainWeb_1022_td=Pure Java mainWeb_1023_td=Yes mainWeb_1024_td=Yes mainWeb_1025_td=Yes mainWeb_1026_td=No mainWeb_1027_td=No mainWeb_1028_td=Memory Mode mainWeb_1029_td=Yes mainWeb_1030_td=Yes mainWeb_1031_td=Yes mainWeb_1032_td=No mainWeb_1033_td=No mainWeb_1034_td=Transaction Isolation mainWeb_1035_td=Yes mainWeb_1036_td=Yes mainWeb_1037_td=No mainWeb_1038_td=Yes mainWeb_1039_td=Yes mainWeb_1040_td=Cost Based Optimizer mainWeb_1041_td=Yes mainWeb_1042_td=Yes mainWeb_1043_td=No mainWeb_1044_td=Yes mainWeb_1045_td=Yes mainWeb_1046_td=Encrypted Database mainWeb_1047_td=Yes mainWeb_1048_td=Yes mainWeb_1049_td=No mainWeb_1050_td=No mainWeb_1051_td=No mainWeb_1052_td=ODBC Driver mainWeb_1053_td=Yes mainWeb_1054_td=No mainWeb_1055_td=No mainWeb_1056_td=Yes mainWeb_1057_td=Yes mainWeb_1058_td=Fulltext Search mainWeb_1059_td=Yes mainWeb_1060_td=No mainWeb_1061_td=No mainWeb_1062_td=Yes mainWeb_1063_td=Yes mainWeb_1064_td=Multi Version Concurrency mainWeb_1065_td=Yes mainWeb_1066_td=No mainWeb_1067_td=No mainWeb_1068_td=Yes mainWeb_1069_td=Yes mainWeb_1070_td=Footprint (jar/dll size) mainWeb_1071_td=~1 MB mainWeb_1072_td=~2 MB mainWeb_1073_td=~600 KB mainWeb_1074_td=~4 MB mainWeb_1075_td=~6 MB mainWeb_1076_p=\ See also the <a href\="features.html\#comparison">detailed comparison</a>. mainWeb_1077_h3=News mainWeb_1078_b=Newsfeeds\: mainWeb_1079_a=Full text (Atom) mainWeb_1080_p=\ or <a href\="http\://www.h2database.com/html/newsfeed-rss.xml">Header only (RSS)</a>. mainWeb_1081_b=Email Newsletter\: mainWeb_1082_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_1083_td= mainWeb_1084_h3=Contribute mainWeb_1085_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_b=Search\: main_1001_td=Highlight keyword(s) main_1002_a=Home main_1003_a=Download main_1004_a=Cheat Sheet main_1005_b=Documentation main_1006_a=Quickstart main_1007_a=Installation main_1008_a=Tutorial main_1009_a=Features main_1010_a=Performance main_1011_a=Advanced main_1012_b=Reference main_1013_a=SQL Grammar main_1014_a=Functions main_1015_a=Data Types main_1016_a=Javadoc main_1017_a=PDF (1 MB) main_1018_b=Support main_1019_a=FAQ main_1020_a=Error Analyzer main_1021_a=Google Group (English) main_1022_a=Google Group (Japanese) main_1023_a=Google Group (Chinese) main_1024_b=Appendix main_1025_a=JaQu main_1026_a=Build main_1027_a=History & Roadmap main_1028_a=Links main_1029_a=License main_1030_td= main_1031_h1=H2 Database Engine main_1032_p=\ Welcome to H2, the free Java SQL database engine. main_1033_a=Quickstart main_1034_p=\ Get a fast overview. main_1035_a=Tutorial main_1036_p=\ Go through the samples. main_1037_a=Features main_1038_p=\ See what this database can do and how to use these features. onePage_1000_h1=H2 Database Engine onePage_1001_p=Version 1.2.129 (2010-02-19) onePage_1002_h1=Quickstart onePage_1003_a=\ Embedding H2 in an Application onePage_1004_a=\ The H2 Console Application onePage_1005_h2=Embedding H2 in an Application onePage_1006_p=\ This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to\: onePage_1007_li=Add the <code>h2*.jar</code> to the classpath (H2 does not have any dependencies) onePage_1008_li=Use the JDBC driver class\: <code>org.h2.Driver</code> onePage_1009_li=The database URL <code>jdbc\:h2\:~/test</code> opens the database <code>test</code> in your user home directory onePage_1010_li=A new database is automatically created onePage_1011_h2=The H2 Console Application onePage_1012_p=\ The Console lets you access a SQL database using a browser interface. onePage_1013_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>. onePage_1014_h3=Step-by-Step onePage_1015_h4=Installation onePage_1016_p=\ Install the software using the Windows Installer (if you did not yet do that). onePage_1017_h4=Start the Console onePage_1018_p=\ Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]\: onePage_1019_p=\ A new console window appears\: onePage_1020_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. onePage_1021_h4=Login onePage_1022_p=\ Select [Generic H2] and click [Connect]\: onePage_1023_p=\ You are now logged in. onePage_1024_h4=Sample onePage_1025_p=\ Click on the [Sample SQL Script]\: onePage_1026_p=\ The SQL commands appear in the command area. onePage_1027_h4=Execute onePage_1028_p=\ Click [Run] onePage_1029_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. onePage_1030_h4=Disconnect onePage_1031_p=\ Click on [Disconnect]\: onePage_1032_p=\ to close the connection. onePage_1033_h4=End onePage_1034_p=\ Close the console window. For more information, see the <a href\="tutorial.html">Tutorial</a>. onePage_1035_h1=Installation onePage_1036_a=\ Requirements onePage_1037_a=\ Supported Platforms onePage_1038_a=\ Installing the Software onePage_1039_a=\ Directory Structure onePage_1040_h2=Requirements onePage_1041_p=\ To run the database, the following minimum software stack is known to work\: onePage_1042_li=Windows XP or Vista, Mac OS X, or Linux onePage_1043_li=Recommended Windows file system\: NTFS (FAT32 only supports files up to 4 GB) onePage_1044_li=Sun JDK 1.5 or newer onePage_1045_li=Mozilla Firefox onePage_1046_h2=Supported Platforms onePage_1047_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.5, but it also works in many other operating systems and using other Java runtime environments. onePage_1048_h2=Installing the Software onePage_1049_p=\ To install the software, run the installer or unzip it to a directory of your choice. onePage_1050_h2=Directory Structure onePage_1051_p=\ After installing, you should get the following directory structure\: onePage_1052_th=Directory onePage_1053_th=Contents onePage_1054_td=bin onePage_1055_td=JAR and batch files onePage_1056_td=docs onePage_1057_td=Documentation onePage_1058_td=docs/html onePage_1059_td=HTML pages onePage_1060_td=docs/javadoc onePage_1061_td=Javadoc files onePage_1062_td=ext onePage_1063_td=External dependencies (downloaded when building) onePage_1064_td=service onePage_1065_td=Tools to run the database as a Windows Service onePage_1066_td=src onePage_1067_td=Source files onePage_1068_td=src/docsrc onePage_1069_td=Documentation sources onePage_1070_td=src/installer onePage_1071_td=Installer, shell, and release build script onePage_1072_td=src/main onePage_1073_td=Database engine source code onePage_1074_td=src/test onePage_1075_td=Test source code onePage_1076_td=src/tools onePage_1077_td=Tools and database adapters source code onePage_1078_h1=Tutorial onePage_1079_a=\ Starting and Using the H2 Console onePage_1080_a=\ Settings of the H2 Console onePage_1081_a=\ Connecting to a Database using JDBC onePage_1082_a=\ Creating New Databases onePage_1083_a=\ Using the Server onePage_1084_a=\ Using Hibernate onePage_1085_a=\ Using TopLink and Glassfish onePage_1086_a=\ Using EclipseLink onePage_1087_a=\ Using Databases in Web Applications onePage_1088_a=\ CSV (Comma Separated Values) Support onePage_1089_a=\ Upgrade, Backup, and Restore onePage_1090_a=\ Command Line Tools onePage_1091_a=\ The Shell Tool onePage_1092_a=\ Using OpenOffice Base onePage_1093_a=\ Java Web Start / JNLP onePage_1094_a=\ Using a Connection Pool onePage_1095_a=\ Fulltext Search onePage_1096_a=\ User-Defined Variables onePage_1097_a=\ Date and Time onePage_1098_a=\ Using Spring onePage_1099_h2=Starting and Using the H2 Console onePage_1100_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. onePage_1101_p=\ This is a client / server application, so both a server and a client (a browser) are required to run it. onePage_1102_p=\ Depending on your platform and environment, there are multiple ways to start the application\: onePage_1103_th=OS onePage_1104_th=Start onePage_1105_td=Windows onePage_1106_td=\ Click [Start], [All Programs], [H2], and [H2 Console (Command Line)] onePage_1107_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\: onePage_1108_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>. onePage_1109_td=Windows onePage_1110_td=\ Open a file browser, navigate to <code>h2/bin</code>, and double click on <code>h2.bat</code>. onePage_1111_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>). onePage_1112_td=Any onePage_1113_td=\ Double click on the <code>h2*.jar</code> file. This only works if the <code>.jar</code> suffix is associated with java. onePage_1114_td=Any onePage_1115_td=\ Open a console window, navigate to the directory <code>h2/bin</code> and type\: onePage_1116_h3=Firewall onePage_1117_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. onePage_1118_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. onePage_1119_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'. onePage_1120_h3=Testing Java onePage_1121_p=\ To find out which version of Java is installed, open a command prompt and type\: onePage_1122_p=\ If you get an error message, you may need to add the Java binary directory to the path environment variable. onePage_1123_h3=Error Message 'Port may be in use' onePage_1124_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. onePage_1125_h3=Using another Port onePage_1126_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/<username></code>). The relevant entry is webPort. onePage_1127_h3=Connecting to the Server using a Browser onePage_1128_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>. onePage_1129_h3=Multiple Concurrent Sessions onePage_1130_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. onePage_1131_h3=Login onePage_1132_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]. onePage_1133_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>). onePage_1134_h3=Error Messages onePage_1135_p=\ Error messages in are shown in red. You can show/hide the stack trace of the exception by clicking on the message. onePage_1136_h3=Adding Database Drivers onePage_1137_p=\ Additional database drivers 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>. onePage_1138_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. onePage_1139_h3=Using the H2 Console onePage_1140_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. onePage_1141_h3=Inserting Table Names or Column Names onePage_1142_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. onePage_1143_h3=Disconnecting and Stopping the Application onePage_1144_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. onePage_1145_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. onePage_1146_h2=Settings of the H2 Console onePage_1147_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. onePage_1148_h2=Connecting to a Database using JDBC onePage_1149_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\: onePage_1150_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. onePage_1151_h2=Creating New Databases onePage_1152_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. onePage_1153_p=\ Auto-creating new database can be disabled, see <a href\="\#database_only_if_exists">Opening a Database Only if it Already Exists</a>. onePage_1154_h2=Using the Server onePage_1155_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). The servers can be started in different ways, one is using the <code>Server</code> tool. onePage_1156_h3=Starting the Server Tool from Command Line onePage_1157_p=\ To start the <code>Server</code> tool from the command line with the default settings, run\: onePage_1158_p=\ This will start the tool with the default options. To get the list of options and default values, run\: onePage_1159_p=\ There are options available to use other ports, and start or not start parts. onePage_1160_h3=Connecting to the TCP Server onePage_1161_p=\ To remotely connect to a database using the TCP server, use the following driver and database URL\: onePage_1162_li=JDBC driver class\: <code>org.h2.Driver</code> onePage_1163_li=Database URL\: <code>jdbc\:h2\:tcp\://localhost/~/test</code> onePage_1164_p=\ For details about the database URL, see also in Features. onePage_1165_h3=Starting the TCP Server within an Application onePage_1166_p=\ Servers can also be started and stopped from within an application. Sample code\: onePage_1167_h3=Stopping a TCP Server from Another Process onePage_1168_p=\ The TCP server can be stopped from another process. To stop the server from the command line, run\: onePage_1169_p=\ To stop the server from a user application, use the following code\: onePage_1170_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). onePage_1171_h2=Using Hibernate onePage_1172_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 Hibernate is buggy. A <a href\="http\://opensource.atlassian.com/projects/hibernate/browse/HHH-3401">patch for Hibernate</a> has been submitted. The dialect for the newest version of Hibernate is also available at <code>src/tools/org/hibernate/dialect/H2Dialect.java.txt</code>. You can rename it to <code>H2Dialect.java</code> and include this as a patch in your application. onePage_1173_h2=Using TopLink and Glassfish onePage_1174_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>. onePage_1175_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\: onePage_1176_p=\ In old versions of Glassfish, the property name is <code>toplink.platform.class.name</code>. onePage_1177_h2=Using EclipseLink onePage_1178_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>. onePage_1179_h2=Using Databases in Web Applications onePage_1180_p=\ There are multiple ways to access a database from within web applications. Here are some examples if you use Tomcat or JBoss. onePage_1181_h3=Embedded Mode onePage_1182_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). onePage_1183_h3=Server Mode onePage_1184_p=\ The server mode is similar, but it allows you to run the server in another process. onePage_1185_h3=Using a Servlet Listener to Start and Stop a Database onePage_1186_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)\: onePage_1187_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\: onePage_1188_code=DbStarter onePage_1189_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\: onePage_1190_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. onePage_1191_h3=Using the H2 Console Servlet onePage_1192_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>\: onePage_1193_p=\ For details, see also <code>src/tools/WEB-INF/web.xml</code>. onePage_1194_p=\ To create a web application with just the H2 Console, run the following command\: onePage_1195_h2=CSV (Comma Separated Values) Support onePage_1196_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. onePage_1197_h3=Writing a CSV File from Within a Database onePage_1198_p=\ The built-in function <code>CSVWRITE</code> can be used to create a CSV file from a query. Example\: onePage_1199_h3=Reading a CSV File from Within a Database onePage_1200_p=\ A CSV file can be read using the function <code>CSVREAD</code>. Example\: onePage_1201_h3=Writing a CSV File from a Java Application onePage_1202_p=\ The <code>Csv</code> tool can be used in a Java application even when not using a database at all. Example\: onePage_1203_h3=Reading a CSV File from a Java Application onePage_1204_p=\ It is possible to read a CSV file without opening a database. Example\: onePage_1205_h2=Upgrade, Backup, and Restore onePage_1206_h3=Database Upgrade onePage_1207_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. onePage_1208_h3=Backup using the Script Tool onePage_1209_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\: onePage_1210_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. onePage_1211_h3=Restore from a Script onePage_1212_p=\ To restore a database from a SQL script file, you can use the <code>RunScript</code> tool\: onePage_1213_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. onePage_1214_h3=Online Backup onePage_1215_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. Other than the SCRIPT statement, the <code>BACKUP</code> statement does not lock the database objects, and therefore does not block other users. The resulting backup is transactionally consistent\: onePage_1216_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. onePage_1217_p=\ Creating a backup 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. onePage_1218_h2=Command Line Tools onePage_1219_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\: onePage_1220_p=\ The command line tools are\: onePage_1221_code=Backup onePage_1222_li=\ creates a backup of a database. onePage_1223_code=ChangeFileEncryption onePage_1224_li=\ allows changing the file encryption password or algorithm of a database. onePage_1225_code=Console onePage_1226_li=\ starts the browser based H2 Console. onePage_1227_code=ConvertTraceFile onePage_1228_li=\ converts a .trace.db file to a Java application and SQL script. onePage_1229_code=CreateCluster onePage_1230_li=\ creates a cluster from a standalone database. onePage_1231_code=DeleteDbFiles onePage_1232_li=\ deletes all files belonging to a database. onePage_1233_code=Recover onePage_1234_li=\ helps recovering a corrupted database. onePage_1235_code=Restore onePage_1236_li=\ restores a backup of a database. onePage_1237_code=RunScript onePage_1238_li=\ runs a SQL script against a database. onePage_1239_code=Script onePage_1240_li=\ allows converting a database to a SQL script for backup or migration. onePage_1241_code=Server onePage_1242_li=\ is used in the server mode to start a H2 server. onePage_1243_code=Shell onePage_1244_li=\ is a command line database tool. onePage_1245_p=\ The tools can also be called from an application by calling the main or another public method. For details, see the Javadoc documentation. onePage_1246_h2=The Shell Tool onePage_1247_p=\ The Shell tool is a simple interactive command line tool. To start it, type\: onePage_1248_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\: onePage_1249_p=\ By default, results are printed as a table. For results with many column, consider using the list mode\: onePage_1250_h2=Using OpenOffice Base onePage_1251_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\: onePage_1252_li=Start OpenOffice Writer, go to [Tools], [Options] onePage_1253_li=Make sure you have selected a Java runtime environment in OpenOffice.org / Java onePage_1254_li=Click [Class Path...], [Add Archive...] onePage_1255_li=Select your h2 jar file (location is up to you, could be wherever you choose) onePage_1256_li=Click [OK] (as much as needed), stop OpenOffice (including the Quickstarter) onePage_1257_li=Start OpenOffice Base onePage_1258_li=Connect to an existing database; select [JDBC]; [Next] onePage_1259_li=Example datasource URL\: <code>jdbc\:h2\:~/test</code> onePage_1260_li=JDBC driver class\: <code>org.h2.Driver</code> onePage_1261_p=\ Now you can access the database stored in the current users home directory. onePage_1262_p=\ To use H2 in NeoOffice (OpenOffice without X11)\: onePage_1263_li=In NeoOffice, go to [NeoOffice], [Preferences] onePage_1264_li=Look for the page under [NeoOffice], [Java] onePage_1265_li=Click [Class Path], [Add Archive...] onePage_1266_li=Select your h2 jar file (location is up to you, could be wherever you choose) onePage_1267_li=Click [OK] (as much as needed), restart NeoOffice. onePage_1268_p=\ Now, when creating a new database using the "Database Wizard" \: onePage_1269_li=Click [File], [New], [Database]. onePage_1270_li=Select [Connect to existing database] and the select [JDBC]. Click next. onePage_1271_li=Example datasource URL\: <code>jdbc\:h2\:~/test</code> onePage_1272_li=JDBC driver class\: <code>org.h2.Driver</code> onePage_1273_p=\ Another solution to use H2 in NeoOffice is\: onePage_1274_li=Package the h2 jar within an extension package onePage_1275_li=Install it as a Java extension in NeoOffice onePage_1276_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>. onePage_1277_h2=Java Web Start / JNLP onePage_1278_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\: onePage_1279_h2=Using a Connection Pool onePage_1280_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\: onePage_1281_h2=Fulltext Search onePage_1282_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. onePage_1283_h3=Using the Native Fulltext Search onePage_1284_p=\ To initialize, call\: onePage_1285_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\: onePage_1286_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\: onePage_1287_p=\ This will produce a result set that contains the query needed to retrieve the data\: onePage_1288_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> onePage_1289_p=\ You can also call the index from within a Java application\: onePage_1290_h3=Using the Lucene Fulltext Search onePage_1291_p=\ To use the Lucene full text search, you need the Lucene library in the classpath. 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\: onePage_1292_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\: onePage_1293_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\: onePage_1294_p=\ This will produce a result set that contains the query needed to retrieve the data\: onePage_1295_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> onePage_1296_p=\ You can also call the index from within a Java application\: onePage_1297_h2=User-Defined Variables onePage_1298_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\: onePage_1299_p=\ The value can also be changed using the SET() method. This is useful in queries\: onePage_1300_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. onePage_1301_h2=Date and Time onePage_1302_p=\ Date, time and timestamp values support ISO 8601 formatting, including time zone\: onePage_1303_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 in GMT (Greenwich Mean Time). If the database is opened using another system time zone, the date and time will change accordingly. If you want to move a database from one time zone to the other and don't want this to happen, you need to create a SQL script file using the <code>SCRIPT</code> command or <code>Script</code> tool, and then load the database using the <code>RUNSCRIPT</code> command or the <code>RunScript</code> tool in the new time zone. onePage_1304_h2=Using Spring onePage_1305_p=\ Use the following configuration to start and stop the H2 TCP server using the Spring Framework\: onePage_1306_p=\ The <code>destroy-method</code> will help prevent exceptions on hot-redeployment or when restarting the server. onePage_1307_h1=Features onePage_1308_a=\ Feature List onePage_1309_a=\ Comparison to Other Database Engines onePage_1310_a=\ H2 in Use onePage_1311_a=\ Connection Modes onePage_1312_a=\ Database URL Overview onePage_1313_a=\ Connecting to an Embedded (Local) Database onePage_1314_a=\ In-Memory Databases onePage_1315_a=\ Database Files Encryption onePage_1316_a=\ Database File Locking onePage_1317_a=\ Opening a Database Only if it Already Exists onePage_1318_a=\ Closing a Database onePage_1319_a=\ Ignore Unknown Settings onePage_1320_a=\ Changing Other Settings when Opening a Connection onePage_1321_a=\ Custom File Access Mode onePage_1322_a=\ Multiple Connections onePage_1323_a=\ Database File Layout onePage_1324_a=\ Logging and Recovery onePage_1325_a=\ Compatibility onePage_1326_a=\ Auto-Reconnect onePage_1327_a=\ Automatic Mixed Mode onePage_1328_a=\ Using the Trace Options onePage_1329_a=\ Using Other Logging APIs onePage_1330_a=\ Read Only Databases onePage_1331_a=\ Read Only Databases in Zip or Jar File onePage_1332_a=\ Graceful Handling of Low Disk Space Situations onePage_1333_a=\ Computed Columns / Function Based Index onePage_1334_a=\ Multi-Dimensional Indexes onePage_1335_a=\ Using Passwords onePage_1336_a=\ User-Defined Functions and Stored Procedures onePage_1337_a=\ Triggers onePage_1338_a=\ Compacting a Database onePage_1339_a=\ Cache Settings onePage_1340_h2=Feature List onePage_1341_h3=Main Features onePage_1342_li=Very fast database engine onePage_1343_li=Open source onePage_1344_li=Written in Java onePage_1345_li=Supports standard SQL, JDBC API onePage_1346_li=Embedded and Server mode, Clustering support onePage_1347_li=Strong security features onePage_1348_li=The PostgreSQL ODBC driver can be used onePage_1349_li=Multi version concurrency onePage_1350_h3=Additional Features onePage_1351_li=Disk based or in-memory databases and tables, read-only database support, temporary tables onePage_1352_li=Transaction support (read committed and serializable transaction isolation), 2-phase-commit onePage_1353_li=Multiple connections, table level locking onePage_1354_li=Cost based optimizer, using a genetic algorithm for complex queries, zero-administration onePage_1355_li=Scrollable and updatable result set support, large result set, external result sorting, functions can return a result set onePage_1356_li=Encrypted database (AES or XTEA), SHA-256 password encryption, encryption functions, SSL onePage_1357_h3=SQL Support onePage_1358_li=Support for multiple schemas, information schema onePage_1359_li=Referential integrity / foreign key constraints with cascade, check constraints onePage_1360_li=Inner and outer joins, subqueries, read only views and inline views onePage_1361_li=Triggers and Java functions / stored procedures onePage_1362_li=Many built-in functions, including XML and lossless data compression onePage_1363_li=Wide range of data types including large objects (BLOB/CLOB) and arrays onePage_1364_li=Sequence and autoincrement columns, computed columns (can be used for function based indexes) onePage_1365_code=ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP onePage_1366_li=Collation support, users, roles onePage_1367_li=Compatibility modes for IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL. onePage_1368_h3=Security Features onePage_1369_li=Includes a solution for the SQL injection problem onePage_1370_li=User password authentication uses SHA-256 and salt onePage_1371_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) onePage_1372_li=All database files (including script files that can be used to backup data) can be encrypted using AES-256 and XTEA encryption algorithms onePage_1373_li=The remote JDBC driver supports TCP/IP connections over SSL/TLS onePage_1374_li=The built-in web server supports connections over SSL/TLS onePage_1375_li=Passwords can be sent to the database using char arrays instead of Strings onePage_1376_h3=Other Features and Tools onePage_1377_li=Small footprint (smaller than 1 MB), low memory requirements onePage_1378_li=Multiple index types (b-tree, tree, hash) onePage_1379_li=Support for multi-dimensional indexes onePage_1380_li=CSV (comma separated values) file support onePage_1381_li=Support for linked tables, and a built-in virtual 'range' table onePage_1382_code=EXPLAIN PLAN onePage_1383_li=\ support, sophisticated trace options onePage_1384_li=Database closing can be delayed or disabled to improve the performance onePage_1385_li=Web-based Console application (translated to many languages) with autocomplete onePage_1386_li=The database can generate SQL script files onePage_1387_li=Contains a recovery tool that can dump the contents of the database onePage_1388_li=Support for variables (for example to calculate running totals) onePage_1389_li=Automatic re-compilation of prepared statements onePage_1390_li=Uses a small number of database files onePage_1391_li=Uses a checksum for each record and log entry for data integrity onePage_1392_li=Well tested (high code coverage, randomized stress tests) onePage_1393_h2=Comparison to Other Database Engines onePage_1394_th=Feature onePage_1395_th=H2 onePage_1396_a=Derby onePage_1397_a=HSQLDB onePage_1398_a=MySQL onePage_1399_a=PostgreSQL onePage_1400_td=Pure Java onePage_1401_td=Yes onePage_1402_td=Yes onePage_1403_td=Yes onePage_1404_td=No onePage_1405_td=No onePage_1406_td=Embedded Mode (Java) onePage_1407_td=Yes onePage_1408_td=Yes onePage_1409_td=Yes onePage_1410_td=No onePage_1411_td=No onePage_1412_td=Performance (Embedded) onePage_1413_td=Fast onePage_1414_td=Slow onePage_1415_td=Fast onePage_1416_td=N/A onePage_1417_td=N/A onePage_1418_td=In-Memory Mode onePage_1419_td=Yes onePage_1420_td=Yes onePage_1421_td=Yes onePage_1422_td=No onePage_1423_td=No onePage_1424_td=Transaction Isolation onePage_1425_td=Yes onePage_1426_td=Yes onePage_1427_td=No onePage_1428_td=Yes onePage_1429_td=Yes onePage_1430_td=Cost Based Optimizer onePage_1431_td=Yes onePage_1432_td=Yes onePage_1433_td=No onePage_1434_td=Yes onePage_1435_td=Yes onePage_1436_td=Explain Plan onePage_1437_td=Yes onePage_1438_td=No onePage_1439_td=Yes onePage_1440_td=Yes onePage_1441_td=Yes onePage_1442_td=Clustering onePage_1443_td=Yes onePage_1444_td=No onePage_1445_td=No onePage_1446_td=Yes onePage_1447_td=Yes onePage_1448_td=Encrypted Database onePage_1449_td=Yes onePage_1450_td=Yes onePage_1451_td=No onePage_1452_td=No onePage_1453_td=No onePage_1454_td=Linked Tables onePage_1455_td=Yes onePage_1456_td=No onePage_1457_td=Partially *1 onePage_1458_td=Partially *2 onePage_1459_td=No onePage_1460_td=ODBC Driver onePage_1461_td=Yes onePage_1462_td=No onePage_1463_td=No onePage_1464_td=Yes onePage_1465_td=Yes onePage_1466_td=Fulltext Search onePage_1467_td=Yes onePage_1468_td=No onePage_1469_td=No onePage_1470_td=Yes onePage_1471_td=Yes onePage_1472_td=User-Defined Datatypes onePage_1473_td=Yes onePage_1474_td=No onePage_1475_td=No onePage_1476_td=Yes onePage_1477_td=Yes onePage_1478_td=Files per Database onePage_1479_td=Few onePage_1480_td=Many onePage_1481_td=Few onePage_1482_td=Many onePage_1483_td=Many onePage_1484_td=Table Level Locking onePage_1485_td=Yes onePage_1486_td=Yes onePage_1487_td=No onePage_1488_td=Yes onePage_1489_td=Yes onePage_1490_td=Row Level Locking onePage_1491_td=Yes *9 onePage_1492_td=Yes onePage_1493_td=No onePage_1494_td=Yes onePage_1495_td=Yes onePage_1496_td=Multi Version Concurrency onePage_1497_td=Yes onePage_1498_td=No onePage_1499_td=No onePage_1500_td=Yes onePage_1501_td=Yes onePage_1502_td=Role Based Security onePage_1503_td=Yes onePage_1504_td=Yes *3 onePage_1505_td=Yes onePage_1506_td=Yes onePage_1507_td=Yes onePage_1508_td=Updatable Result Sets onePage_1509_td=Yes onePage_1510_td=Yes *7 onePage_1511_td=No onePage_1512_td=Yes onePage_1513_td=Yes onePage_1514_td=Sequences onePage_1515_td=Yes onePage_1516_td=No onePage_1517_td=Yes onePage_1518_td=No onePage_1519_td=Yes onePage_1520_td=Limit and Offset onePage_1521_td=Yes onePage_1522_td=No onePage_1523_td=Yes onePage_1524_td=Yes onePage_1525_td=Yes onePage_1526_td=Temporary Tables onePage_1527_td=Yes onePage_1528_td=Yes *4 onePage_1529_td=Yes onePage_1530_td=Yes onePage_1531_td=Yes onePage_1532_td=Information Schema onePage_1533_td=Yes onePage_1534_td=No *8 onePage_1535_td=No *8 onePage_1536_td=Yes onePage_1537_td=Yes onePage_1538_td=Computed Columns onePage_1539_td=Yes onePage_1540_td=No onePage_1541_td=No onePage_1542_td=No onePage_1543_td=Yes *6 onePage_1544_td=Case Insensitive Columns onePage_1545_td=Yes onePage_1546_td=No onePage_1547_td=Yes onePage_1548_td=Yes onePage_1549_td=Yes *6 onePage_1550_td=Custom Aggregate Functions onePage_1551_td=Yes onePage_1552_td=No onePage_1553_td=No onePage_1554_td=Yes onePage_1555_td=Yes onePage_1556_td=Footprint (jar/dll size) onePage_1557_td=~1 MB *5 onePage_1558_td=~2 MB onePage_1559_td=~700 KB onePage_1560_td=~4 MB onePage_1561_td=~6 MB onePage_1562_p=\ *1 HSQLDB supports text tables. onePage_1563_p=\ *2 MySQL supports linked MySQL tables under the name 'federated tables'. onePage_1564_p=\ *3 Derby support for roles based security and password checking as an option. onePage_1565_p=\ *4 Derby only supports global temporary tables. onePage_1566_p=\ *5 The default H2 jar file contains debug information, jar files for other databases do not. onePage_1567_p=\ *6 PostgreSQL supports functional indexes. onePage_1568_p=\ *7 Derby only supports updatable result sets if the query is not sorted. onePage_1569_p=\ *8 Derby and HSQLDB don't support standard compliant information schema tables. onePage_1570_p=\ *9 H2 supports row level locks when using multi version concurrency. onePage_1571_h3=Derby and HSQLDB onePage_1572_p=\ After an unexpected process termination (for example power failure), H2 can recover safely and automatically without any user interaction. For Derby and HSQLDB, some manual steps are required ('Another instance of Derby may have already booted the database' / 'The database is already in use by another process'). onePage_1573_h3=DaffodilDb and One$Db onePage_1574_p=\ It looks like the development of this database has stopped. The last release was February 2006. onePage_1575_h3=McKoi onePage_1576_p=\ It looks like the development of this database has stopped. The last release was August 2004 onePage_1577_h2=H2 in Use onePage_1578_p=\ For a list of applications that work with or use H2, see\: <a href\="links.html">Links</a>. onePage_1579_h2=Connection Modes onePage_1580_p=\ The following connection modes are supported\: onePage_1581_li=Embedded mode (local connections using JDBC) onePage_1582_li=Server mode (remote connections using JDBC or ODBC over TCP/IP) onePage_1583_li=Mixed mode (local and remote connections at the same time) onePage_1584_h3=Embedded Mode onePage_1585_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. onePage_1586_h3=Server Mode onePage_1587_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. onePage_1588_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. onePage_1589_h3=Mixed Mode onePage_1590_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. onePage_1591_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. onePage_1592_h2=Database URL Overview onePage_1593_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. onePage_1594_th=Topic onePage_1595_th=URL Format and Examples onePage_1596_a=Embedded (local) connection onePage_1597_td=\ jdbc\:h2\:[file\:][<path>]<databaseName> onePage_1598_td=\ jdbc\:h2\:~/test onePage_1599_td=\ jdbc\:h2\:file\:/data/sample onePage_1600_td=\ jdbc\:h2\:file\:C\:/data/sample (Windows only) onePage_1601_a=In-memory (private) onePage_1602_td=jdbc\:h2\:mem\: onePage_1603_a=In-memory (named) onePage_1604_td=\ jdbc\:h2\:mem\:<databaseName> onePage_1605_td=\ jdbc\:h2\:mem\:test_mem onePage_1606_a=Server mode (remote connections) using TCP/IP onePage_1607_td=\ jdbc\:h2\:tcp\://<server>[\:<port>]/[<path>]<databaseName> onePage_1608_td=\ jdbc\:h2\:tcp\://localhost/~/test onePage_1609_td=\ jdbc\:h2\:tcp\://dbserv\:8084/~/sample onePage_1610_a=Server mode (remote connections) using SSL/TLS onePage_1611_td=\ jdbc\:h2\:ssl\://<server>[\:<port>]/<databaseName> onePage_1612_td=\ jdbc\:h2\:ssl\://secureserv\:8085/~/sample; onePage_1613_a=Using encrypted files onePage_1614_td=\ jdbc\:h2\:<url>;CIPHER\=[AES|XTEA] onePage_1615_td=\ jdbc\:h2\:ssl\://secureserv/~/testdb;CIPHER\=AES onePage_1616_td=\ jdbc\:h2\:file\:~/secure;CIPHER\=XTEA onePage_1617_a=File locking methods onePage_1618_td=\ jdbc\:h2\:<url>;FILE_LOCK\={NO|FILE|SOCKET} onePage_1619_td=\ jdbc\:h2\:file\:~/quickAndDirty;FILE_LOCK\=NO onePage_1620_td=\ jdbc\:h2\:file\:~/private;CIPHER\=XTEA;FILE_LOCK\=SOCKET onePage_1621_a=Only open if it already exists onePage_1622_td=\ jdbc\:h2\:<url>;IFEXISTS\=TRUE onePage_1623_td=\ jdbc\:h2\:file\:~/sample;IFEXISTS\=TRUE onePage_1624_a=Don't close the database when the VM exits onePage_1625_td=\ jdbc\:h2\:<url>;DB_CLOSE_ON_EXIT\=FALSE onePage_1626_a=User name and/or password onePage_1627_td=\ jdbc\:h2\:<url>[;USER\=<username>][;PASSWORD\=<value>] onePage_1628_td=\ jdbc\:h2\:file\:~/sample;USER\=sa;PASSWORD\=123 onePage_1629_a=Debug trace settings onePage_1630_td=\ jdbc\:h2\:<url>;TRACE_LEVEL_FILE\=<level 0..3> onePage_1631_td=\ jdbc\:h2\:file\:~/sample;TRACE_LEVEL_FILE\=3 onePage_1632_a=Ignore unknown settings onePage_1633_td=\ jdbc\:h2\:<url>;IGNORE_UNKNOWN_SETTINGS\=TRUE onePage_1634_a=Custom file access mode onePage_1635_td=\ jdbc\:h2\:<url>;ACCESS_MODE_DATA\=rws onePage_1636_a=Database in a zip file onePage_1637_td=\ jdbc\:h2\:zip\:<zipFileName>\!/<databaseName> onePage_1638_td=\ jdbc\:h2\:zip\:~/db.zip\!/test onePage_1639_a=Compatibility mode onePage_1640_td=\ jdbc\:h2\:<url>;MODE\=<databaseType> onePage_1641_td=\ jdbc\:h2\:~/test;MODE\=MYSQL onePage_1642_a=Auto-reconnect onePage_1643_td=\ jdbc\:h2\:<url>;AUTO_RECONNECT\=TRUE onePage_1644_td=\ jdbc\:h2\:tcp\://localhost/~/test;AUTO_RECONNECT\=TRUE onePage_1645_a=Automatic mixed mode onePage_1646_td=\ jdbc\:h2\:<url>;AUTO_SERVER\=TRUE onePage_1647_td=\ jdbc\:h2\:~/test;AUTO_SERVER\=TRUE onePage_1648_a=Changing other settings onePage_1649_td=\ jdbc\:h2\:<url>;<setting>\=<value>[;<setting>\=<value>...] onePage_1650_td=\ jdbc\:h2\:file\:~/sample;TRACE_LEVEL_SYSTEM_OUT\=3 onePage_1651_h2=Connecting to an Embedded (Local) Database onePage_1652_p=\ The database URL for connecting to a local database is <code>jdbc\:h2\:[file\:][<path>]<databaseName></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>. onePage_1653_h2=In-Memory Databases onePage_1654_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. onePage_1655_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. onePage_1656_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 in this way only works within the same virtual machine and class loader environment. onePage_1657_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>. onePage_1658_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>. onePage_1659_h2=Database Files Encryption onePage_1660_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. onePage_1661_h3=Creating a New Database with File Encryption onePage_1662_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. onePage_1663_h3=Connecting to an Encrypted Database onePage_1664_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\: onePage_1665_h3=Encrypting or Decrypting a Database onePage_1666_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\: onePage_1667_h2=Database File Locking onePage_1668_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. onePage_1669_p=\ The following file locking methods are implemented\: onePage_1670_li=The default method is 'file' and uses a watchdog thread to protect the database file. The watchdog reads the lock file each second. onePage_1671_li=The second method is 'socket' and opens a server socket. The socket method does not require reading the lock file every second. The socket method should only be used if the database files are only accessed by one (and always the same) computer. onePage_1672_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. onePage_1673_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\: onePage_1674_p=\ The following code forces the database to not create a lock file at all. Please note that this is unsafe as another process is able to open the same database, possibly leading to data corruption\: onePage_1675_p=\ For more information about the algorithms, see <a href\="\#file_locking_protocols">Advanced / File Locking Protocols</a>. onePage_1676_h2=Opening a Database Only if it Already Exists onePage_1677_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\: onePage_1678_h2=Closing a Database onePage_1679_h3=Delayed Database Closing onePage_1680_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 <seconds></code>. The parameter <seconds> 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\: onePage_1681_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>. onePage_1682_h3=Don't Close a Database when the VM Exits onePage_1683_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\: onePage_1684_h2=Ignore Unknown Settings onePage_1685_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. onePage_1686_h2=Changing Other Settings when Opening a Connection onePage_1687_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>. onePage_1688_h2=Custom File Access Mode onePage_1689_p=\ Usually, the database opens log, data and index files 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 files are 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\: onePage_1690_p=\ For more information see <a href\="\#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. onePage_1691_h2=Multiple Connections onePage_1692_h3=Opening Multiple Databases at the Same Time onePage_1693_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. onePage_1694_h3=Multiple Connections to the Same Database\: Client/Server onePage_1695_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). onePage_1696_h3=Multithreading Support onePage_1697_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. onePage_1698_h3=Locking, Lock-Timeout, Deadlocks onePage_1699_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. onePage_1700_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. onePage_1701_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\: onePage_1702_th=Type of Lock onePage_1703_th=SQL Statement onePage_1704_td=Read onePage_1705_td=SELECT * FROM TEST; onePage_1706_td=\ CALL SELECT MAX(ID) FROM TEST; onePage_1707_td=\ SCRIPT; onePage_1708_td=Write onePage_1709_td=SELECT * FROM TEST WHERE 1\=0 FOR UPDATE; onePage_1710_td=Write onePage_1711_td=INSERT INTO TEST VALUES(1, 'Hello'); onePage_1712_td=\ INSERT INTO TEST SELECT * FROM TEST; onePage_1713_td=\ UPDATE TEST SET NAME\='Hi'; onePage_1714_td=\ DELETE FROM TEST; onePage_1715_td=Write onePage_1716_td=ALTER TABLE TEST ...; onePage_1717_td=\ CREATE INDEX ... ON TEST ...; onePage_1718_td=\ DROP INDEX ...; onePage_1719_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 <milliseconds></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 <milliseconds></code>. The default lock timeout is persistent. onePage_1720_h2=Database File Layout onePage_1721_p=\ The following files are created for persistent databases\: onePage_1722_th=File Name onePage_1723_th=Description onePage_1724_th=Number of Files onePage_1725_td=\ test.h2.db onePage_1726_td=\ Database file (H2 version 1.2.x). onePage_1727_td=\ Contains the transaction log, indexes, and data for all tables. onePage_1728_td=\ Format\: <code><database>.h2.db</code> onePage_1729_td=\ 1 per database onePage_1730_td=\ test.data.db onePage_1731_td=\ Data file (H2 version 1.1.x). onePage_1732_td=\ Contains the data for all tables. onePage_1733_td=\ Format\: <code><database>.data.db</code> onePage_1734_td=\ 1 per database onePage_1735_td=\ test.index.db onePage_1736_td=\ Index file (H2 version 1.1.x). onePage_1737_td=\ Contains the data for all (b-tree) indexes. onePage_1738_td=\ Format\: <code><database>.index.db</code> onePage_1739_td=\ 1 per database onePage_1740_td=\ test.0.log.db onePage_1741_td=\ Transaction log file (H2 version 1.1.x). onePage_1742_td=\ The transaction log is used for recovery. onePage_1743_td=\ Format\: <code><database>.<id>.log.db</code> onePage_1744_td=\ 0 or more per database onePage_1745_td=\ test.lock.db onePage_1746_td=\ Database lock file. onePage_1747_td=\ Automatically (re-)created while the database is in use. onePage_1748_td=\ Format\: <code><database>.lock.db</code> onePage_1749_td=\ 1 per database onePage_1750_td=\ test.trace.db onePage_1751_td=\ Trace file (if the trace option is enabled). onePage_1752_td=\ Contains trace information. onePage_1753_td=\ Format\: <code><database>.trace.db</code> onePage_1754_td=\ Renamed to <code><database>.trace.db.old</code> is too big. onePage_1755_td=\ 0 or 1 per database onePage_1756_td=\ test.lobs.db/* onePage_1757_td=\ Directory containing one file for each onePage_1758_td=\ BLOB or CLOB value larger than a certain size. onePage_1759_td=\ Format\: <code><id>.t<tableId>.lob.db</code> onePage_1760_td=\ 1 per large object onePage_1761_td=\ test.123.temp.db onePage_1762_td=\ Temporary file. onePage_1763_td=\ Contains a temporary blob or a large result set. onePage_1764_td=\ Format\: <code><database>.<id>.temp.db</code> onePage_1765_td=\ 1 per object onePage_1766_h3=Moving and Renaming Database Files onePage_1767_p=\ Database name and location are not stored inside the database files. onePage_1768_p=\ While a database is closed, the files can be moved to another directory, and they can be renamed as well (as long as all files start with the same name). onePage_1769_p=\ As there is no platform specific data in the files, they can be moved to other operating systems without problems. onePage_1770_h3=Backup onePage_1771_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. onePage_1772_p=\ To backup data while the database is running, the SQL command <code>SCRIPT</code> can be used. onePage_1773_h2=Logging and Recovery onePage_1774_p=\ Whenever data is modified in the database and those changes are committed, the changes are logged to disk (except for in-memory objects). The changes to the data file itself are usually written later on, to optimize disk access. If there is a power failure, the data and index files are not up-to-date. But because the changes are in the log file, the next time the database is opened, the changes that are in the log file are re-applied automatically. onePage_1775_p=\ Please note that index file updates are not logged by default. If the database is opened and recovery is required, the index file is rebuilt from scratch. onePage_1776_p=\ There is usually only one log file per database. This file grows until the database is closed successfully, and is then deleted. Or, if the file gets too big, the database switches to another log file (with a higher id). It is possible to force the log switching by using the <code>CHECKPOINT</code> command. onePage_1777_p=\ If the database file is corrupted, because the checksum of a record does not match (for example, if the file was edited with another application), the database can be opened in recovery mode. In this case, errors in the database are logged but not thrown. The database should be backed up to a script and re-built as soon as possible. To open the database in the recovery mode, use a database URL must contain <code>;RECOVER\=1</code>, as in <code>jdbc\:h2\:~/test;RECOVER\=1</code>. Indexes are rebuilt in this case, and the summary (object allocation table) is not read in this case, so opening the database takes longer. onePage_1778_h2=Compatibility onePage_1779_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\: onePage_1780_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>). onePage_1781_h3=Compatibility Modes onePage_1782_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\: onePage_1783_h3=DB2 Compatibility Mode onePage_1784_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>. onePage_1785_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. onePage_1786_li=Support for the syntax <code>[OFFSET .. ROW] [FETCH ... ONLY]</code> as an alternative for <code>LIMIT .. OFFSET</code>. onePage_1787_li=Concatenating <code>NULL</code> with another value results in the other value. onePage_1788_h3=Derby Compatibility Mode onePage_1789_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>. onePage_1790_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. onePage_1791_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. onePage_1792_li=Concatenating <code>NULL</code> with another value results in the other value. onePage_1793_h3=HSQLDB Compatibility Mode onePage_1794_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>. onePage_1795_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. onePage_1796_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. onePage_1797_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. onePage_1798_h3=MS SQL Server Compatibility Mode onePage_1799_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>. onePage_1800_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. onePage_1801_li=Identifiers may be quoted using square brackets as in <code>[Test]</code>. onePage_1802_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. onePage_1803_li=Concatenating <code>NULL</code> with another value results in the other value. onePage_1804_h3=MySQL Compatibility Mode onePage_1805_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>. onePage_1806_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. onePage_1807_li=Creating indexes in the <code>CREATE TABLE</code> statement is allowed. onePage_1808_li=Meta data calls return identifiers in lower case. onePage_1809_li=When converting a floating point number to an integer, the fractional digits are not truncated, but the value is rounded. onePage_1810_li=Concatenating <code>NULL</code> with another value results in the other value. onePage_1811_h3=Oracle Compatibility Mode onePage_1812_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>. onePage_1813_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. onePage_1814_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. onePage_1815_li=Concatenating <code>NULL</code> with another value results in the other value. onePage_1816_h3=PostgreSQL Compatibility Mode onePage_1817_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>. onePage_1818_li=For aliased columns, <code>ResultSetMetaData.getColumnName()</code> returns the alias name and <code>getTableName()</code> returns <code>null</code>. onePage_1819_li=When converting a floating point number to an integer, the fractional digits are not be truncated, but the value is rounded. onePage_1820_li=The system columns <code>CTID</code> and <code>OID</code> are supported. onePage_1821_h2=Auto-Reconnect onePage_1822_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. onePage_1823_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. onePage_1824_h2=Automatic Mixed Mode onePage_1825_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 no matter if the database is already open or not. onePage_1826_p=\ When using this mode, the first connection to the database is made in embedded mode, and additionally a server is started internally. If the database is already open in another process, the server mode is used automatically. onePage_1827_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). onePage_1828_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. onePage_1829_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). onePage_1830_h2=Using the Trace Options onePage_1831_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\: onePage_1832_li=Trace to <code>System.out</code> and/or to a file onePage_1833_li=Support for trace levels <code>OFF, ERROR, INFO, DEBUG</code> onePage_1834_li=The maximum size of the trace file can be set onePage_1835_li=It is possible to generate Java source code from the trace file onePage_1836_li=Trace can be enabled at runtime by manually creating a file onePage_1837_h3=Trace Options onePage_1838_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\: onePage_1839_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\: onePage_1840_h3=Setting the Maximum Size of the Trace File onePage_1841_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\: onePage_1842_h3=Java Code Generation onePage_1843_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\: onePage_1844_p=\ To filter the Java source code, use the <code>ConvertTraceFile</code> tool as follows\: onePage_1845_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. onePage_1846_h2=Using Other Logging APIs onePage_1847_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. onePage_1848_a=SLF4J onePage_1849_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. onePage_1850_p=\ To enable SLF4J, set the file trace level to 4 in the database URL\: onePage_1851_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><database>.trace.db</code> for error messages. onePage_1852_h2=Read Only Databases onePage_1853_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 so that the log file gets smaller. Do not delete the log file. Then, make the database files read-only using the operating system. When you open the database now, it is read-only. There are two ways an application can find out whether database is read-only\: by calling <code>Connection.isReadOnly()</code> or by executing the SQL statement <code>CALL READONLY()</code>. onePage_1854_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. onePage_1855_h2=Read Only Databases in Zip or Jar File onePage_1856_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. onePage_1857_p=\ When the zip file is created, you can open the database in the zip file using the following database URL\: onePage_1858_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. onePage_1859_h2=Graceful Handling of Low Disk Space Situations onePage_1860_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. onePage_1861_h3=Opening a Corrupted Database onePage_1862_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. onePage_1863_h2=Computed Columns / Function Based Index onePage_1864_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\: onePage_1865_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\: onePage_1866_h2=Multi-Dimensional Indexes onePage_1867_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. onePage_1868_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). onePage_1869_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>. onePage_1870_h2=Using Passwords onePage_1871_h3=Using Secure Passwords onePage_1872_p=\ Remember that weak passwords can be broken no matter of the encryption and security protocol. Don't use passwords that can be found in a dictionary. Also appending numbers does not make them secure. A way to create good passwords that can be remembered is, take the first letters of a sentence, use upper and lower case characters, and creatively include special characters. Example\: onePage_1873_code=i'sE2rtPiUKtT onePage_1874_p=\ from the sentence <code>it's easy to remember this password if you know the trick</code>. onePage_1875_h3=Passwords\: Using Char Arrays instead of Strings onePage_1876_p=\ Java strings are immutable objects and cannot be safely 'destroyed' by the application. After creating a string, it will remain in the main memory of the computer at least until it is garbage collected. The garbage collection cannot be controlled by the application, and even if it is garbage collected the data may still remain in memory. It might also be possible that the part of memory containing the password is swapped to disk (because not enough main memory is available). onePage_1877_p=\ An attacker might have access to the swap file of the operating system. It is therefore a good idea to use char arrays instead of strings to store passwords. Char arrays can be cleared (filled with zeros) after use, and therefore the password will not be stored in the swap file. onePage_1878_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\: onePage_1879_p=\ This example requires Java 1.6. When using Swing, use <code>javax.swing.JPasswordField</code>. onePage_1880_h3=Passing the User Name and/or Password in the URL onePage_1881_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. onePage_1882_h2=User-Defined Functions and Stored Procedures onePage_1883_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 functions can be defined using source code, or as a reference to a compiled class that is available in the classpath. onePage_1884_h3=Referencing a Compiled Method onePage_1885_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\: onePage_1886_p=\ The Java function must be registered in the database by calling <code>CREATE ALIAS ... FOR</code>\: onePage_1887_p=\ For a complete sample application, see <code>src/test/org/h2/samples/Function.java</code>. onePage_1888_h3=Declaring Functions as Source Code onePage_1889_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\: onePage_1890_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>\: onePage_1891_p=\ The following template is used to create a complete Java class\: onePage_1892_h3=Function Data Type Mapping onePage_1893_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. onePage_1894_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>. onePage_1895_h3=Functions That Require a Connection onePage_1896_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. onePage_1897_h3=Functions Throwing an Exception onePage_1898_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. onePage_1899_h3=Functions Returning a Result Set onePage_1900_p=\ Functions may returns a result set. Such a function can be called with the <code>CALL</code> statement\: onePage_1901_h3=Using SimpleResultSet onePage_1902_p=\ A function can create a result set using the <code>SimpleResultSet</code> tool\: onePage_1903_h3=Using a Function as a Table onePage_1904_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>. onePage_1905_h2=Triggers onePage_1906_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). onePage_1907_p=\ The connection can be used to query or update data in other tables. The trigger then needs to be defined in the database\: onePage_1908_p=\ The trigger can be used to veto a change by throwing a <code>SQLException</code>. onePage_1909_h2=Compacting a Database onePage_1910_p=\ Empty space in the database file is re-used automatically. To re-build the indexes, the simplest way is to delete the <code>.index.db</code> file while the database is closed. However in some situations (for example after deleting a lot of data in a database), one sometimes wants to shrink the size of the database (compact a database). Here is a sample function to do this\: onePage_1911_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. onePage_1912_h2=Cache Settings onePage_1913_p=\ The database keeps most frequently used data and index pages in the main memory. The amount of memory used for caching can be changed using the setting <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>. This setting has no effect for in-memory databases. onePage_1914_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. onePage_1915_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 for the data and index file. onePage_1916_h1=Performance onePage_1917_a=\ Performance Comparison onePage_1918_a=\ PolePosition Benchmark onePage_1919_a=\ Application Profiling onePage_1920_a=\ Database Profiling onePage_1921_a=\ Database Performance Tuning onePage_1922_a=\ Using the Built-In Profiler onePage_1923_a=\ Fast Database Import onePage_1924_h2=Performance Comparison onePage_1925_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. onePage_1926_h3=Embedded onePage_1927_th=Test Case onePage_1928_th=Unit onePage_1929_th=H2 onePage_1930_th=HSQLDB onePage_1931_th=Derby onePage_1932_td=Simple\: Init onePage_1933_td=ms onePage_1934_td=547 onePage_1935_td=532 onePage_1936_td=2594 onePage_1937_td=Simple\: Query (random) onePage_1938_td=ms onePage_1939_td=250 onePage_1940_td=391 onePage_1941_td=1515 onePage_1942_td=Simple\: Query (sequential) onePage_1943_td=ms onePage_1944_td=188 onePage_1945_td=313 onePage_1946_td=1406 onePage_1947_td=Simple\: Update (random) onePage_1948_td=ms onePage_1949_td=812 onePage_1950_td=1750 onePage_1951_td=17704 onePage_1952_td=Simple\: Delete (sequential) onePage_1953_td=ms onePage_1954_td=203 onePage_1955_td=250 onePage_1956_td=8843 onePage_1957_td=Simple\: Memory Usage onePage_1958_td=MB onePage_1959_td=7 onePage_1960_td=11 onePage_1961_td=11 onePage_1962_td=BenchA\: Init onePage_1963_td=ms onePage_1964_td=578 onePage_1965_td=719 onePage_1966_td=3328 onePage_1967_td=BenchA\: Transactions onePage_1968_td=ms onePage_1969_td=3047 onePage_1970_td=2406 onePage_1971_td=12907 onePage_1972_td=BenchA\: Memory Usage onePage_1973_td=MB onePage_1974_td=10 onePage_1975_td=15 onePage_1976_td=10 onePage_1977_td=BenchB\: Init onePage_1978_td=ms onePage_1979_td=2141 onePage_1980_td=2406 onePage_1981_td=11562 onePage_1982_td=BenchB\: Transactions onePage_1983_td=ms onePage_1984_td=1125 onePage_1985_td=1375 onePage_1986_td=3625 onePage_1987_td=BenchB\: Memory Usage onePage_1988_td=MB onePage_1989_td=9 onePage_1990_td=11 onePage_1991_td=8 onePage_1992_td=BenchC\: Init onePage_1993_td=ms onePage_1994_td=688 onePage_1995_td=594 onePage_1996_td=4500 onePage_1997_td=BenchC\: Transactions onePage_1998_td=ms onePage_1999_td=1906 onePage_2000_td=64062 onePage_2001_td=6047 onePage_2002_td=BenchC\: Memory Usage onePage_2003_td=MB onePage_2004_td=11 onePage_2005_td=17 onePage_2006_td=11 onePage_2007_td=Executed statements onePage_2008_td=\# onePage_2009_td=322929 onePage_2010_td=322929 onePage_2011_td=322929 onePage_2012_td=Total time onePage_2013_td=ms onePage_2014_td=11485 onePage_2015_td=74798 onePage_2016_td=74031 onePage_2017_td=Statements per second onePage_2018_td=\# onePage_2019_td=28117 onePage_2020_td=4317 onePage_2021_td=4362 onePage_2022_h3=Client-Server onePage_2023_th=Test Case onePage_2024_th=Unit onePage_2025_th=H2 onePage_2026_th=HSQLDB onePage_2027_th=Derby onePage_2028_th=PostgreSQL onePage_2029_th=MySQL onePage_2030_td=Simple\: Init onePage_2031_td=ms onePage_2032_td=2782 onePage_2033_td=2656 onePage_2034_td=5625 onePage_2035_td=4563 onePage_2036_td=3484 onePage_2037_td=Simple\: Query (random) onePage_2038_td=ms onePage_2039_td=3093 onePage_2040_td=2703 onePage_2041_td=6688 onePage_2042_td=4812 onePage_2043_td=3860 onePage_2044_td=Simple\: Query (sequential) onePage_2045_td=ms onePage_2046_td=2969 onePage_2047_td=2594 onePage_2048_td=6437 onePage_2049_td=4719 onePage_2050_td=3625 onePage_2051_td=Simple\: Update (random) onePage_2052_td=ms onePage_2053_td=2969 onePage_2054_td=3531 onePage_2055_td=18250 onePage_2056_td=5953 onePage_2057_td=5125 onePage_2058_td=Simple\: Delete (sequential) onePage_2059_td=ms onePage_2060_td=1047 onePage_2061_td=1250 onePage_2062_td=6875 onePage_2063_td=2485 onePage_2064_td=2390 onePage_2065_td=Simple\: Memory Usage onePage_2066_td=MB onePage_2067_td=7 onePage_2068_td=11 onePage_2069_td=14 onePage_2070_td=0 onePage_2071_td=0 onePage_2072_td=BenchA\: Init onePage_2073_td=ms onePage_2074_td=2250 onePage_2075_td=2453 onePage_2076_td=6031 onePage_2077_td=4328 onePage_2078_td=3625 onePage_2079_td=BenchA\: Transactions onePage_2080_td=ms onePage_2081_td=10250 onePage_2082_td=9016 onePage_2083_td=21484 onePage_2084_td=15609 onePage_2085_td=11172 onePage_2086_td=BenchA\: Memory Usage onePage_2087_td=MB onePage_2088_td=10 onePage_2089_td=15 onePage_2090_td=10 onePage_2091_td=0 onePage_2092_td=1 onePage_2093_td=BenchB\: Init onePage_2094_td=ms onePage_2095_td=9500 onePage_2096_td=10672 onePage_2097_td=22609 onePage_2098_td=19609 onePage_2099_td=13406 onePage_2100_td=BenchB\: Transactions onePage_2101_td=ms onePage_2102_td=2734 onePage_2103_td=2656 onePage_2104_td=3875 onePage_2105_td=4688 onePage_2106_td=2531 onePage_2107_td=BenchB\: Memory Usage onePage_2108_td=MB onePage_2109_td=10 onePage_2110_td=11 onePage_2111_td=11 onePage_2112_td=1 onePage_2113_td=1 onePage_2114_td=BenchC\: Init onePage_2115_td=ms onePage_2116_td=1860 onePage_2117_td=1484 onePage_2118_td=6890 onePage_2119_td=2219 onePage_2120_td=3438 onePage_2121_td=BenchC\: Transactions onePage_2122_td=ms onePage_2123_td=9046 onePage_2124_td=63266 onePage_2125_td=18641 onePage_2126_td=11703 onePage_2127_td=7421 onePage_2128_td=BenchC\: Memory Usage onePage_2129_td=MB onePage_2130_td=12 onePage_2131_td=17 onePage_2132_td=13 onePage_2133_td=0 onePage_2134_td=1 onePage_2135_td=Executed statements onePage_2136_td=\# onePage_2137_td=322929 onePage_2138_td=322929 onePage_2139_td=322929 onePage_2140_td=322929 onePage_2141_td=322929 onePage_2142_td=Total time onePage_2143_td=ms onePage_2144_td=48500 onePage_2145_td=102281 onePage_2146_td=123405 onePage_2147_td=80688 onePage_2148_td=60077 onePage_2149_td=Statements per second onePage_2150_td=\# onePage_2151_td=6658 onePage_2152_td=3157 onePage_2153_td=2616 onePage_2154_td=4002 onePage_2155_td=5375 onePage_2156_h3=Benchmark Results and Comments onePage_2157_h4=H2 onePage_2158_p=\ Version 1.1.114 (2009-06-01) was used for the test. For simpler operations, the performance of H2 is about the same as for HSQLDB. For more complex queries, the query optimizer is very important. However H2 is not very fast in every case, certain kind of queries may still be slow. One situation where is 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. The open/close time is almost fixed, because of the file locking protocol\: the engine waits some time after opening a database to ensure the database files are not opened by another process. onePage_2159_h4=HSQLDB onePage_2160_p=\ Version 1.8.0.10 was used for the test. Cached tables are used in this test (hsqldb.default_table_type\=cached), and the write delay is 1 second (<code>SET WRITE_DELAY 1</code>). HSQLDB is fast when using simple operations. HSQLDB is very slow in the last test (BenchC\: Transactions), probably because is has a bad query optimizer. One query where HSQLDB is slow is a two-table join\: onePage_2161_p=\ The PolePosition benchmark also shows that the query optimizer does not do a very good job for some queries. Another disadvantage of HSQLDB is the slow startup / shutdown time (currently not listed) when using bigger databases. The reason is, a backup of the whole data is made whenever the database is opened or closed. onePage_2162_h4=Derby onePage_2163_p=\ Version 10.4.2.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 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. onePage_2164_h4=PostgreSQL onePage_2165_p=\ Version 8.3.7 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. It looks like the base performance is slower than MySQL, the reason could be the network layer. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured. onePage_2166_h4=MySQL onePage_2167_p=\ Version 5.1.34-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</code> file) was set to 0. Otherwise (and by default), MySQL is really 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</code>, and then restart the service. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured. onePage_2168_h4=Firebird onePage_2169_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. onePage_2170_h4=Why Oracle / MS SQL Server / DB2 are Not Listed onePage_2171_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. onePage_2172_h3=About this Benchmark onePage_2173_h4=How to Run onePage_2174_p=\ This test was executed as follows\: onePage_2175_h4=Separate Process per Database onePage_2176_p=\ For each database, a new process is started, to ensure the previous test does not impact the current test. onePage_2177_h4=Number of Connections onePage_2178_p=\ This is mostly a single-connection benchmark. BenchB uses multiple connections; the other tests use one connection. onePage_2179_h4=Real-World Tests onePage_2180_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. onePage_2181_h4=Comparing Embedded with Server Databases onePage_2182_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. onePage_2183_h4=Test Platform onePage_2184_p=\ This test is run on Windows XP with the virus scanner switched off. The VM used is Sun JDK 1.5. onePage_2185_h4=Multiple Runs onePage_2186_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. onePage_2187_h4=Memory Usage onePage_2188_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. onePage_2189_h4=Delayed Operations onePage_2190_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). onePage_2191_h4=Transaction Commit / Durability onePage_2192_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. onePage_2193_h4=Using Prepared Statements onePage_2194_p=\ Wherever possible, the test cases use prepared statements. onePage_2195_h4=Currently Not Tested\: Startup Time onePage_2196_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. onePage_2197_h2=PolePosition Benchmark onePage_2198_p=\ The PolePosition is an open source benchmark. The algorithms are all quite simple. It was developed / sponsored by db4o. onePage_2199_th=Test Case onePage_2200_th=Unit onePage_2201_th=H2 onePage_2202_th=HSQLDB onePage_2203_th=MySQL onePage_2204_td=Melbourne write onePage_2205_td=ms onePage_2206_td=369 onePage_2207_td=249 onePage_2208_td=2022 onePage_2209_td=Melbourne read onePage_2210_td=ms onePage_2211_td=47 onePage_2212_td=49 onePage_2213_td=93 onePage_2214_td=Melbourne read_hot onePage_2215_td=ms onePage_2216_td=24 onePage_2217_td=43 onePage_2218_td=95 onePage_2219_td=Melbourne delete onePage_2220_td=ms onePage_2221_td=147 onePage_2222_td=133 onePage_2223_td=176 onePage_2224_td=Sepang write onePage_2225_td=ms onePage_2226_td=965 onePage_2227_td=1201 onePage_2228_td=3213 onePage_2229_td=Sepang read onePage_2230_td=ms onePage_2231_td=765 onePage_2232_td=948 onePage_2233_td=3455 onePage_2234_td=Sepang read_hot onePage_2235_td=ms onePage_2236_td=789 onePage_2237_td=859 onePage_2238_td=3563 onePage_2239_td=Sepang delete onePage_2240_td=ms onePage_2241_td=1384 onePage_2242_td=1596 onePage_2243_td=6214 onePage_2244_td=Bahrain write onePage_2245_td=ms onePage_2246_td=1186 onePage_2247_td=1387 onePage_2248_td=6904 onePage_2249_td=Bahrain query_indexed_string onePage_2250_td=ms onePage_2251_td=336 onePage_2252_td=170 onePage_2253_td=693 onePage_2254_td=Bahrain query_string onePage_2255_td=ms onePage_2256_td=18064 onePage_2257_td=39703 onePage_2258_td=41243 onePage_2259_td=Bahrain query_indexed_int onePage_2260_td=ms onePage_2261_td=104 onePage_2262_td=134 onePage_2263_td=678 onePage_2264_td=Bahrain update onePage_2265_td=ms onePage_2266_td=191 onePage_2267_td=87 onePage_2268_td=159 onePage_2269_td=Bahrain delete onePage_2270_td=ms onePage_2271_td=1215 onePage_2272_td=729 onePage_2273_td=6812 onePage_2274_td=Imola retrieve onePage_2275_td=ms onePage_2276_td=198 onePage_2277_td=194 onePage_2278_td=4036 onePage_2279_td=Barcelona write onePage_2280_td=ms onePage_2281_td=413 onePage_2282_td=832 onePage_2283_td=3191 onePage_2284_td=Barcelona read onePage_2285_td=ms onePage_2286_td=119 onePage_2287_td=160 onePage_2288_td=1177 onePage_2289_td=Barcelona query onePage_2290_td=ms onePage_2291_td=20 onePage_2292_td=5169 onePage_2293_td=101 onePage_2294_td=Barcelona delete onePage_2295_td=ms onePage_2296_td=388 onePage_2297_td=319 onePage_2298_td=3287 onePage_2299_td=Total onePage_2300_td=ms onePage_2301_td=26724 onePage_2302_td=53962 onePage_2303_td=87112 onePage_2304_p=\ There are a few problems with the PolePosition test\: onePage_2305_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>. onePage_2306_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> onePage_2307_li=The amount of cache memory is quite important, specially for the PolePosition test. Unfortunately, the PolePosition test does not take this into account. onePage_2308_h2=Application Profiling onePage_2309_h3=Analyze First onePage_2310_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. onePage_2311_p=\ A simple way to profile an application is to use the built-in profiling tool of java. Example\: onePage_2312_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 <pid></code> or <code>kill -QUIT <pid></code> (Linux) or press Ctrl+C (Windows). onePage_2313_p=\ A simple profiling tool is included in H2. To use it, the application needs to be changed slightly. Example\: onePage_2314_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. onePage_2315_h2=Database Profiling onePage_2316_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>. As an example, execute the the following script using the H2 Console\: onePage_2317_p=\ Now convert the <code>.trace.db</code> file using the <code>ConvertTraceFile</code> tool\: onePage_2318_p=\ The generated file <code>test.sql</code> will contain the SQL statements as well as the following profiling data (results vary)\: onePage_2319_h2=Database Performance Tuning onePage_2320_h3=Keep Connections Open or Use a Connection Pool onePage_2321_p=\ If your application opens and closes connections a lot (for example, for each request), you should consider using a <a href\="\#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. onePage_2322_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\="\#closing_a_database">Closing a database</a>. onePage_2323_h3=Use a Modern JVM onePage_2324_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. onePage_2325_h3=Virus Scanners onePage_2326_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. onePage_2327_h3=Using the Trace Options onePage_2328_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\="\#trace_options">Using the Trace Options</a>. onePage_2329_h3=Index Usage onePage_2330_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. onePage_2331_h3=Optimizer onePage_2332_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. onePage_2333_h3=Expression Optimization onePage_2334_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. onePage_2335_h3=COUNT(*) Optimization onePage_2336_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>. onePage_2337_h3=Updating Optimizer Statistics / Column Selectivity onePage_2338_p=\ When executing a query, at most one index per joined table can be used. If the same table is joined multiple times, for each join only one index is used. 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. onePage_2339_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. onePage_2340_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. onePage_2341_h3=In-Memory (Hash) Indexes onePage_2342_p=\ Using in-memory indexes, specially in-memory hash indexes, can speed up queries and data manipulation. onePage_2343_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. onePage_2344_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 < ?</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>. onePage_2345_h3=Use Prepared Statements onePage_2346_p=\ If possible, use prepared statements with parameters. Avoid generating SQL statements with a variable size IN(...) list. Instead, use arrays as in the following example\: onePage_2347_h3=Optimization Examples onePage_2348_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. onePage_2349_h3=Cache Size and Type onePage_2350_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\="\#cache_settings">Cache Settings</a>. onePage_2351_h3=Data Types onePage_2352_p=\ Each data type has different storage and performance characteristics\: onePage_2353_li=The <code>DECIMAL/NUMERIC</code> type is slower and requires more storage than the <code>REAL</code> and <code>DOUBLE</code> types. onePage_2354_li=Text types are slower to read, write, and compare than numeric types and generally require more storage. onePage_2355_li=See <a href\="\#large_objects">Large Objects</a> for information on <code>BINARY</code> vs. <code>BLOB</code> and <code>VARCHAR</code> vs. <code>CLOB</code> performance. onePage_2356_li=Parsing and formatting takes longer for the <code>TIME</code>, <code>DATE</code>, and <code>TIMESTAMP</code> types than the numeric types. onePage_2357_code=SMALLINT/TINYINT/BOOLEAN onePage_2358_li=\ are not significantly smaller or faster to work with than <code>INTEGER</code> in most modes. onePage_2359_h3=Sorted Insert Optimization onePage_2360_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\: onePage_2361_h2=Using the Built-In Profiler onePage_2362_p=\ A very simple Java profiler is built-in. To use it, use the following template\: onePage_2363_h2=Fast Database Import onePage_2364_p=\ To speed up large imports, consider using the following options temporarily\: onePage_2365_code=SET CACHE_SIZE onePage_2366_li=\ (a large cache is faster) onePage_2367_code=SET LOCK_MODE 0 onePage_2368_li=\ (disable locking) onePage_2369_code=SET UNDO_LOG 0 onePage_2370_li=\ (disable the session undo log) onePage_2371_p=\ These options can be set in the database URL\: <code>jdbc\:h2\:~/test;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. onePage_2372_h1=Advanced onePage_2373_a=\ Result Sets onePage_2374_a=\ Large Objects onePage_2375_a=\ Linked Tables onePage_2376_a=\ Transaction Isolation onePage_2377_a=\ Multi-Version Concurrency Control (MVCC) onePage_2378_a=\ Clustering / High Availability onePage_2379_a=\ Two Phase Commit onePage_2380_a=\ Compatibility onePage_2381_a=\ Standards Compliance onePage_2382_a=\ Run as Windows Service onePage_2383_a=\ ODBC Driver onePage_2384_a=\ Using H2 in Microsoft .NET onePage_2385_a=\ ACID onePage_2386_a=\ Durability Problems onePage_2387_a=\ Using the Recover Tool onePage_2388_a=\ File Locking Protocols onePage_2389_a=\ File Locking Method 'Serialized' onePage_2390_a=\ Protection against SQL Injection onePage_2391_a=\ Protection against Remote Access onePage_2392_a=\ Restricting Class Loading and Usage onePage_2393_a=\ Security Protocols onePage_2394_a=\ SSL/TLS Connections onePage_2395_a=\ Universally Unique Identifiers (UUID) onePage_2396_a=\ Settings Read from System Properties onePage_2397_a=\ Setting the Server Bind Address onePage_2398_a=\ Pluggable File System onePage_2399_a=\ Limits and Limitations onePage_2400_a=\ Glossary and Links onePage_2401_h2=Result Sets onePage_2402_h3=Statements that Return a Result Set onePage_2403_p=\ The following statements return a result set\: <code>SELECT, EXPLAIN, CALL, SCRIPT, SHOW, HELP</code>. All other statements return an update count. onePage_2404_h3=Limiting the Number of Rows onePage_2405_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>. onePage_2406_h3=Large Result Sets and External Sorting onePage_2407_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. onePage_2408_h2=Large Objects onePage_2409_h3=Storing and Reading Large Objects onePage_2410_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. onePage_2411_h3=When to use CLOB/BLOB onePage_2412_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\="\#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. onePage_2413_h3=Large Object Compression onePage_2414_p=\ CLOB and BLOB values can be compressed by using <a href\="\#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. onePage_2415_h2=Linked Tables onePage_2416_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\: onePage_2417_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. onePage_2418_p=\ To view the statements that are executed against the target table, set the trace level to 3. onePage_2419_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>. onePage_2420_p=\ The statement <a href\="\#create_linked_table" class\="notranslate" >CREATE LINKED TABLE</a> supports an optional schema name parameter. onePage_2421_h2=Transaction Isolation onePage_2422_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. onePage_2423_p=\ This database supports the following transaction isolation levels\: onePage_2424_b=Read Committed onePage_2425_li=\ This is the default level. Read locks are released immediately. Higher concurrency is possible when using this level. onePage_2426_li=\ To enable, execute the SQL statement <code>SET LOCK_MODE 3</code> onePage_2427_li=\ or append <code>;LOCK_MODE\=3</code> to the database URL\: <code>jdbc\:h2\:~/test;LOCK_MODE\=3</code> onePage_2428_b=Serializable onePage_2429_li=\ To enable, execute the SQL statement <code>SET LOCK_MODE 1</code> onePage_2430_li=\ or append <code>;LOCK_MODE\=1</code> to the database URL\: <code>jdbc\:h2\:~/test;LOCK_MODE\=1</code> onePage_2431_b=Read Uncommitted onePage_2432_li=\ This level means that transaction isolation is disabled. onePage_2433_li=\ To enable, execute the SQL statement <code>SET LOCK_MODE 0</code> onePage_2434_li=\ or append <code>;LOCK_MODE\=0</code> to the database URL\: <code>jdbc\:h2\:~/test;LOCK_MODE\=0</code> onePage_2435_p=\ When using the isolation level 'serializable', dirty reads, non-repeatable reads, and phantom reads are prohibited. onePage_2436_b=Dirty Reads onePage_2437_li=\ Means a connection can read uncommitted changes made by another connection. onePage_2438_li=\ Possible with\: read uncommitted onePage_2439_b=Non-Repeatable Reads onePage_2440_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. onePage_2441_li=\ Possible with\: read uncommitted, read committed onePage_2442_b=Phantom Reads onePage_2443_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. onePage_2444_li=\ Possible with\: read uncommitted, read committed onePage_2445_h3=Table Level Locking onePage_2446_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. onePage_2447_h3=Lock Timeout onePage_2448_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. onePage_2449_h2=Multi-Version Concurrency Control (MVCC) onePage_2450_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. onePage_2451_p=\ To use the MVCC feature, append <code>;MVCC\=TRUE</code> to the database URL\: onePage_2452_p=\ 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). onePage_2453_h2=Clustering / High Availability onePage_2454_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. onePage_2455_p=\ Clustering can only be used in the server mode (the embedded mode does not support clustering). It is possible to restore the cluster without stopping the server, however it is critical that no other application is changing the data in the first database while the second database is restored, so restoring the cluster is currently a manual process. onePage_2456_p=\ To initialize the cluster, use the following steps\: onePage_2457_li=Create a database onePage_2458_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. onePage_2459_li=Start two servers (one for each copy of the database) onePage_2460_li=You are now ready to connect to the databases with the client application(s) onePage_2461_h3=Using the CreateCluster Tool onePage_2462_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. onePage_2463_li=Create two directories\: <code>server1, server2</code>. Each directory will simulate a directory on a computer. onePage_2464_li=Start a TCP server pointing to the first directory. You can do this using the command line\: onePage_2465_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\: onePage_2466_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\: onePage_2467_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> onePage_2468_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. onePage_2469_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. onePage_2470_h3=Detect Which Cluster Instances are Running onePage_2471_p=\ To find out which cluster nodes are currently running, execute the following SQL statement\: onePage_2472_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>. onePage_2473_h3=Clustering Algorithm and Limitations onePage_2474_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. onePage_2475_h2=Two Phase Commit onePage_2476_p=\ The two phase commit protocol is supported. 2-phase-commit works as follows\: onePage_2477_li=Autocommit needs to be switched off onePage_2478_li=A transaction is started, for example by inserting a row onePage_2479_li=The transaction is marked 'prepared' by executing the SQL statement <code>PREPARE COMMIT transactionName</code> onePage_2480_li=The transaction can now be committed or rolled back onePage_2481_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' onePage_2482_li=When re-connecting to the database, the in-doubt transactions can be listed with <code>SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT</code> onePage_2483_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> onePage_2484_li=The database needs to be closed and re-opened to apply the changes onePage_2485_h2=Compatibility onePage_2486_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. onePage_2487_h3=Transaction Commit when Autocommit is On onePage_2488_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. onePage_2489_h3=Keywords / Reserved Words onePage_2490_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\: onePage_2491_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, WHERE onePage_2492_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>. onePage_2493_h2=Standards Compliance onePage_2494_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. onePage_2495_h2=Run as Windows Service onePage_2496_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>. onePage_2497_h3=Install the Service onePage_2498_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. onePage_2499_h3=Start the Service onePage_2500_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. onePage_2501_h3=Connect to the H2 Console onePage_2502_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. onePage_2503_h3=Stop the Service onePage_2504_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. onePage_2505_h3=Uninstall the Service onePage_2506_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. onePage_2507_h2=ODBC Driver onePage_2508_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. onePage_2509_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> onePage_2510_h3=ODBC Installation onePage_2511_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>. onePage_2512_h3=Starting the Server onePage_2513_p=\ After installing the ODBC driver, start the H2 Server using the command line\: onePage_2514_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\: onePage_2515_p=\ The PG server can be started and stopped from within a Java application as follows\: onePage_2516_p=\ By default, only connections from localhost are allowed. To allow remote connections, use <code>-pgAllowOthers</code> when starting the server. onePage_2517_h3=ODBC Configuration onePage_2518_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\: onePage_2519_th=Property onePage_2520_th=Example onePage_2521_th=Remarks onePage_2522_td=Data Source onePage_2523_td=H2 Test onePage_2524_td=The name of the ODBC Data Source onePage_2525_td=Database onePage_2526_td=test onePage_2527_td=\ The database name. Only simple names are supported at this time; onePage_2528_td=\ relative or absolute path are not supported in the database name. onePage_2529_td=\ By default, the database is stored in the current working directory onePage_2530_td=\ where the Server is started except when the -baseDir setting is used. onePage_2531_td=\ The name must be at least 3 characters. onePage_2532_td=Server onePage_2533_td=localhost onePage_2534_td=The server name or IP address. onePage_2535_td=By default, only remote connections are allowed onePage_2536_td=User Name onePage_2537_td=sa onePage_2538_td=The database user name. onePage_2539_td=SSL Mode onePage_2540_td=disabled onePage_2541_td=At this time, SSL is not supported. onePage_2542_td=Port onePage_2543_td=5435 onePage_2544_td=The port where the PG Server is listening. onePage_2545_td=Password onePage_2546_td=sa onePage_2547_td=The database password. onePage_2548_p=\ To improve performance, please enable 'server side prepare' under Options / Datasource / Page 2 / Server side prepare. onePage_2549_p=\ Afterwards, you may use this data source. onePage_2550_h3=PG Protocol Support Limitations onePage_2551_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. onePage_2552_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. onePage_2553_h3=Security Considerations onePage_2554_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. onePage_2555_h2=Using H2 in Microsoft .NET onePage_2556_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. onePage_2557_h3=Using the ADO.NET API on .NET onePage_2558_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>. onePage_2559_h3=Using the JDBC API on .NET onePage_2560_li=Install the .NET Framework from <a href\="http\://www.microsoft.com">Microsoft</a>. Mono has not yet been tested. onePage_2561_li=Install <a href\="http\://www.ikvm.net">IKVM.NET</a>. onePage_2562_li=Copy the <code>h2*.jar</code> file to <code>ikvm/bin</code> onePage_2563_li=Run the H2 Console using\: <code>ikvm -jar h2*.jar</code> onePage_2564_li=Convert the H2 Console to an <code>.exe</code> file using\: <code>ikvmc -target\:winexe h2*.jar</code>. You may ignore the warnings. onePage_2565_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> onePage_2566_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\: onePage_2567_h2=ACID onePage_2568_p=\ In the database world, ACID stands for\: onePage_2569_li=Atomicity\: transactions must be atomic, meaning either all tasks are performed or none. onePage_2570_li=Consistency\: all operations must comply with the defined constraints. onePage_2571_li=Isolation\: transactions must be isolated from each other. onePage_2572_li=Durability\: committed transaction will not be lost. onePage_2573_h3=Atomicity onePage_2574_p=\ Transactions in this database are always atomic. onePage_2575_h3=Consistency onePage_2576_p=\ By default, this database is always in a consistent state. Referential integrity rules are enforced except when explicitly disabled. onePage_2577_h3=Isolation onePage_2578_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'. onePage_2579_h3=Durability onePage_2580_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. onePage_2581_h2=Durability Problems onePage_2582_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>. onePage_2583_h3=Ways to (Not) Achieve Durability onePage_2584_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>\: onePage_2585_code=rwd onePage_2586_li=\: every update to the file's content is written synchronously to the underlying storage device. onePage_2587_code=rws onePage_2588_li=\: in addition to <code>rwd</code>, every update to the metadata is written synchronously. onePage_2589_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. onePage_2590_p=\ Calling <code>fsync</code> flushes the buffers. There are two ways to do that in Java\: onePage_2591_code=FileDescriptor.sync() onePage_2592_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. onePage_2593_code=FileChannel.force() onePage_2594_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. onePage_2595_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. onePage_2596_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. onePage_2597_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. onePage_2598_h3=Running the Durability Test onePage_2599_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. onePage_2600_h2=Using the Recover Tool onePage_2601_p=\ The <code>Recover</code> tool can be used to extract the contents of a data file, even if the database is corrupted. It also extracts the content of the log file or large objects (CLOB or BLOB). To run the tool, type on the command line\: onePage_2602_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. onePage_2603_p=\ The <code>Recover</code> tool creates a SQL script from database files. It also processes the transaction log file(s), however it does not automatically apply those changes. Usually, many of those changes are already applied in the database. onePage_2604_h2=File Locking Protocols onePage_2605_p=\ 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 terminates, this lock file is deleted. onePage_2606_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'. onePage_2607_p=\ The file locking protocols 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. onePage_2608_h3=File Locking Method 'File' onePage_2609_p=\ The default method for database file locking is the 'File Method'. The algorithm is\: onePage_2610_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. onePage_2611_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. onePage_2612_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. onePage_2613_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. onePage_2614_h3=File Locking Method 'Socket' onePage_2615_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\: onePage_2616_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. onePage_2617_li=If the lock file exists, and the lock method is 'file', then the software switches to the 'file' method. onePage_2618_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. onePage_2619_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. onePage_2620_h2=File Locking Method 'Serialized' onePage_2621_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. onePage_2622_p=\ To enable this feature, append <code>;FILE_LOCK\=SERIALIZED</code> to the database URL. onePage_2623_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). onePage_2624_h2=Protection against SQL Injection onePage_2625_h3=What is SQL Injection onePage_2626_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\: onePage_2627_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\: onePage_2628_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>. onePage_2629_h3=Disabling Literals onePage_2630_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\: onePage_2631_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\: onePage_2632_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. onePage_2633_h3=Using Constants onePage_2634_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\: onePage_2635_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. onePage_2636_h3=Using the ZERO() Function onePage_2637_p=\ It is not required to create a constant for the number 0 as there is already a built-in function <code>ZERO()</code>\: onePage_2638_h2=Protection against Remote Access onePage_2639_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. Also, ensure the existing accessible databases are protected using a strong password. onePage_2640_h2=Restricting Class Loading and Usage onePage_2641_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\: onePage_2642_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\: onePage_2643_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. onePage_2644_h2=Security Protocols onePage_2645_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. onePage_2646_h3=User Password Encryption onePage_2647_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. onePage_2648_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. onePage_2649_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. onePage_2650_h3=File Encryption onePage_2651_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 about twice as fast as AES) and to have an alternative algorithm if AES is suddenly broken. onePage_2652_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. onePage_2653_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. onePage_2654_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. onePage_2655_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. onePage_2656_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. onePage_2657_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. onePage_2658_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. onePage_2659_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). onePage_2660_h3=Wrong Password / User Name Delay onePage_2661_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. onePage_2662_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. onePage_2663_h3=HTTPS Connections onePage_2664_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. onePage_2665_h2=SSL/TLS Connections onePage_2666_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>. onePage_2667_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. onePage_2668_p=\ To disable anonymous SSL, set the system property <code>h2.enableAnonymousSSL</code> to false. onePage_2669_h2=Universally Unique Identifiers (UUID) onePage_2670_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\: onePage_2671_p=\ Some values are\: onePage_2672_th=Number of UUIs onePage_2673_th=Probability of Duplicates onePage_2674_td=2^36\=68'719'476'736 onePage_2675_td=0.000'000'000'000'000'4 onePage_2676_td=2^41\=2'199'023'255'552 onePage_2677_td=0.000'000'000'000'4 onePage_2678_td=2^46\=70'368'744'177'664 onePage_2679_td=0.000'000'000'4 onePage_2680_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. onePage_2681_h2=Settings Read from System Properties onePage_2682_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\: onePage_2683_p=\ The current value of the settings can be read in the table <code>INFORMATION_SCHEMA.SETTINGS</code>. onePage_2684_p=\ For a complete list of settings, see <a href\="../javadoc/org/h2/constant/SysProperties.html">SysProperties</a>. onePage_2685_h2=Setting the Server Bind Address onePage_2686_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. onePage_2687_h2=Pluggable File System onePage_2688_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\: onePage_2689_code=zip\: onePage_2690_li=\ read-only zip-file based file system. Format\: <code>zip\:/zipFileName\!/fileName</code>. onePage_2691_code=nio\: onePage_2692_li=\ file system that uses <code>FileChannel</code> instead of <code>RandomAccessFile</code> (faster in some operating systems). onePage_2693_code=nioMapped\: onePage_2694_li=\ file system that uses memory mapped files (faster in some operating systems). onePage_2695_code=split\: onePage_2696_li=\ file system that splits files in 1 GB files (stackable with other file systems). onePage_2697_code=memFS\: onePage_2698_li=\ in-memory file system (experimental; used for testing). onePage_2699_code=memLZF\: onePage_2700_li=\ compressing in-memory file system (experimental; used for testing). onePage_2701_p=\ As an example, to use the the <code>nio</code> file system, use the following database URL\: <code>jdbc\:h2\:nio\:~/test</code>. onePage_2702_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. onePage_2703_h2=Limits and Limitations onePage_2704_p=\ This database has the following known limitations\: onePage_2705_li=Database file size limits (excluding BLOB and CLOB data)\: With the default storage mechanism, the maximum file size is currently 256 GB for the data, and 256 GB for the index. With the page store (experimental)\: 4 TB or higher. onePage_2706_li=BLOB and CLOB size limit\: every CLOB or BLOB can be up to 256 GB. onePage_2707_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>. onePage_2708_li=The maximum number of rows per table is 2'147'483'648. onePage_2709_li=Main memory requirements\: The larger the database, the more main memory is required. With the default storage mechanism, the minimum main memory required for a 12 GB database is around 240 MB. With the page store (experimental), the minimum main memory required is much lower, around 1 MB for each 8 GB database file size. onePage_2710_li=Limit on the complexity of SQL statements. Statements of the following form will result in a stack overflow exception\: onePage_2711_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. onePage_2712_li=For limitations on data types, see the documentation of the respective Java data type or the data type documentation of this database. onePage_2713_h2=Glossary and Links onePage_2714_th=Term onePage_2715_th=Description onePage_2716_td=AES-128 onePage_2717_td=A block encryption algorithm. See also\: <a href\="http\://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Wikipedia\: AES</a> onePage_2718_td=Birthday Paradox onePage_2719_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> onePage_2720_td=Digest onePage_2721_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> onePage_2722_td=GCJ onePage_2723_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> onePage_2724_td=HTTPS onePage_2725_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> onePage_2726_td=Modes of Operation onePage_2727_a=Wikipedia\: Block cipher modes of operation onePage_2728_td=Salt onePage_2729_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> onePage_2730_td=SHA-256 onePage_2731_td=A cryptographic one-way hash function. See also\: <a href\="http\://en.wikipedia.org/wiki/SHA_family">Wikipedia\: SHA hash functions</a> onePage_2732_td=SQL Injection onePage_2733_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> onePage_2734_td=Watermark Attack onePage_2735_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' onePage_2736_td=SSL/TLS onePage_2737_td=Secure Sockets Layer / Transport Layer Security. See also\: <a href\="http\://java.sun.com/products/jsse/">Java Secure Socket Extension (JSSE)</a> onePage_2738_td=XTEA onePage_2739_td=A block encryption algorithm. See also\: <a href\="http\://en.wikipedia.org/wiki/XTEA">Wikipedia\: XTEA</a> onePage_2740_h1=SQL Grammar onePage_2741_h2=Commands (Data Manipulation) onePage_2742_a=SELECT onePage_2743_a=INSERT onePage_2744_a=UPDATE onePage_2745_a=DELETE onePage_2746_a=BACKUP onePage_2747_a=CALL onePage_2748_a=EXPLAIN onePage_2749_a=MERGE onePage_2750_a=RUNSCRIPT onePage_2751_a=SCRIPT onePage_2752_a=SHOW onePage_2753_h2=Commands (Data Definition) onePage_2754_a=ALTER INDEX RENAME onePage_2755_a=ALTER SEQUENCE onePage_2756_a=ALTER TABLE ADD onePage_2757_a=ALTER TABLE ADD CONSTRAINT onePage_2758_a=ALTER TABLE ALTER onePage_2759_a=ALTER TABLE DROP COLUMN onePage_2760_a=ALTER TABLE DROP CONSTRAINT onePage_2761_a=ALTER TABLE SET onePage_2762_a=ALTER TABLE RENAME onePage_2763_a=ALTER USER ADMIN onePage_2764_a=ALTER USER RENAME onePage_2765_a=ALTER USER SET PASSWORD onePage_2766_a=ALTER VIEW onePage_2767_a=ANALYZE onePage_2768_a=COMMENT onePage_2769_a=CREATE AGGREGATE onePage_2770_a=CREATE ALIAS onePage_2771_a=CREATE CONSTANT onePage_2772_a=CREATE DOMAIN onePage_2773_a=CREATE INDEX onePage_2774_a=CREATE LINKED TABLE onePage_2775_a=CREATE ROLE onePage_2776_a=CREATE SCHEMA onePage_2777_a=CREATE SEQUENCE onePage_2778_a=CREATE TABLE onePage_2779_a=CREATE TRIGGER onePage_2780_a=CREATE USER onePage_2781_a=CREATE VIEW onePage_2782_a=DROP AGGREGATE onePage_2783_a=DROP ALIAS onePage_2784_a=DROP ALL OBJECTS onePage_2785_a=DROP CONSTANT onePage_2786_a=DROP DOMAIN onePage_2787_a=DROP INDEX onePage_2788_a=DROP ROLE onePage_2789_a=DROP SCHEMA onePage_2790_a=DROP SEQUENCE onePage_2791_a=DROP TABLE onePage_2792_a=DROP TRIGGER onePage_2793_a=DROP USER onePage_2794_a=DROP VIEW onePage_2795_a=TRUNCATE TABLE onePage_2796_h2=Commands (Other) onePage_2797_a=CHECKPOINT onePage_2798_a=CHECKPOINT SYNC onePage_2799_a=COMMIT onePage_2800_a=COMMIT TRANSACTION onePage_2801_a=GRANT RIGHT onePage_2802_a=GRANT ROLE onePage_2803_a=HELP onePage_2804_a=PREPARE COMMIT onePage_2805_a=REVOKE RIGHT onePage_2806_a=REVOKE ROLE onePage_2807_a=ROLLBACK onePage_2808_a=ROLLBACK TRANSACTION onePage_2809_a=SAVEPOINT onePage_2810_a=SET @ onePage_2811_a=SET ALLOW_LITERALS onePage_2812_a=SET AUTOCOMMIT onePage_2813_a=SET CACHE_SIZE onePage_2814_a=SET CLUSTER onePage_2815_a=SET COLLATION onePage_2816_a=SET COMPRESS_LOB onePage_2817_a=SET DATABASE_EVENT_LISTENER onePage_2818_a=SET DB_CLOSE_DELAY onePage_2819_a=SET DEFAULT_LOCK_TIMEOUT onePage_2820_a=SET DEFAULT_TABLE_TYPE onePage_2821_a=SET EXCLUSIVE onePage_2822_a=SET IGNORECASE onePage_2823_a=SET LOCK_MODE onePage_2824_a=SET LOCK_TIMEOUT onePage_2825_a=SET MAX_LENGTH_INPLACE_LOB onePage_2826_a=SET MAX_LOG_SIZE onePage_2827_a=SET MAX_MEMORY_ROWS onePage_2828_a=SET MAX_MEMORY_UNDO onePage_2829_a=SET MAX_OPERATION_MEMORY onePage_2830_a=SET MODE onePage_2831_a=SET MULTI_THREADED onePage_2832_a=SET OPTIMIZE_REUSE_RESULTS onePage_2833_a=SET PASSWORD onePage_2834_a=SET QUERY_TIMEOUT onePage_2835_a=SET REFERENTIAL_INTEGRITY onePage_2836_a=SET SALT HASH onePage_2837_a=SET SCHEMA onePage_2838_a=SET SCHEMA_SEARCH_PATH onePage_2839_a=SET THROTTLE onePage_2840_a=SET TRACE_LEVEL onePage_2841_a=SET TRACE_MAX_FILE_SIZE onePage_2842_a=SET UNDO_LOG onePage_2843_a=SET WRITE_DELAY onePage_2844_a=SHUTDOWN onePage_2845_h2=Other Grammar onePage_2846_a=Alias onePage_2847_a=And Condition onePage_2848_a=Array onePage_2849_a=Boolean onePage_2850_a=Bytes onePage_2851_a=Case onePage_2852_a=Case When onePage_2853_a=Cipher onePage_2854_a=Column Definition onePage_2855_a=Comments onePage_2856_a=Compare onePage_2857_a=Condition onePage_2858_a=Condition Right Hand Side onePage_2859_a=Constraint onePage_2860_a=Constraint Name Definition onePage_2861_a=Csv Options onePage_2862_a=Data Type onePage_2863_a=Date onePage_2864_a=Decimal onePage_2865_a=Digit onePage_2866_a=Dollar Quoted String onePage_2867_a=Double onePage_2868_a=Expression onePage_2869_a=Factor onePage_2870_a=Hex onePage_2871_a=Hex Number onePage_2872_a=Index Column onePage_2873_a=Int onePage_2874_a=Long onePage_2875_a=Name onePage_2876_a=Null onePage_2877_a=Number onePage_2878_a=Operand onePage_2879_a=Order onePage_2880_a=Quoted Name onePage_2881_a=Referential Constraint onePage_2882_a=Select Expression onePage_2883_a=String onePage_2884_a=Summand onePage_2885_a=Table Expression onePage_2886_a=Term onePage_2887_a=Time onePage_2888_a=Timestamp onePage_2889_a=Value onePage_2890_h2=System Tables onePage_2891_a=Information Schema onePage_2892_a=Range Table onePage_2893_h3=SELECT onePage_2894_a=term onePage_2895_a=selectExpression onePage_2896_a=tableExpression onePage_2897_a=expression onePage_2898_a=expression onePage_2899_a=expression onePage_2900_a=select onePage_2901_a=order onePage_2902_a=expression onePage_2903_a=expression onePage_2904_a=rowCountInt onePage_2905_p=Selects data from a table or multiple tables. GROUP BY groups the the result by the given expression(s). HAVING filter rows after grouping. ORDER BY sorts the result by the given column(s) or expression(s). UNION combines the result of this query with the results of another query. onePage_2906_p=LIMIT limits the number of rows returned by the query, OFFSET specified how many rows to skip. SAMPLE_SIZE limits the number of rows read for aggregate queries. onePage_2907_p=Multiple set operators (UNION/INTERSECT/MINUS/EXPECT) are evaluated from left to right. For compatibility with other databases and future versions of H2 please use parentheses. onePage_2908_p=If FOR UPDATE is specified, the tables are locked for writing. onePage_2909_p=Example\: onePage_2910_p=\ SELECT * FROM TEST; onePage_2911_p=SELECT * FROM TEST ORDER BY NAME; onePage_2912_p=SELECT ID, COUNT(*) FROM TEST GROUP BY ID; onePage_2913_p=SELECT NAME, COUNT(*) FROM TEST GROUP BY NAME HAVING COUNT(*) > 2; onePage_2914_p=SELECT &\#39;ID&\#39; COL, MAX(ID) AS MAX FROM TEST UNION SELECT &\#39;NAME&\#39;, MAX(NAME) FROM TEST; onePage_2915_p=SELECT * FROM TEST LIMIT 1000; onePage_2916_p=SELECT * FROM (SELECT ID, COUNT(*) FROM TEST onePage_2917_p= GROUP BY ID UNION SELECT NULL, COUNT(*) FROM TEST) onePage_2918_p= ORDER BY 1 NULLS LAST; onePage_2919_h3=INSERT onePage_2920_a=tableName onePage_2921_a=columnName onePage_2922_a=expression onePage_2923_a=select onePage_2924_p=Inserts a new row / new rows into a table. onePage_2925_p=Example\: onePage_2926_p=\ INSERT INTO TEST VALUES(1, &\#39;Hello&\#39;) onePage_2927_h3=UPDATE onePage_2928_a=tableName onePage_2929_a=newTableAlias onePage_2930_a=columnName onePage_2931_a=expression onePage_2932_a=expression onePage_2933_p=Updates data in a table. onePage_2934_p=Example\: onePage_2935_p=\ UPDATE TEST SET NAME\=&\#39;Hi&\#39; WHERE ID\=1; onePage_2936_p=UPDATE PERSON P SET NAME\=(SELECT A.NAME FROM ADDRESS A WHERE A.ID\=P.ID); onePage_2937_h3=DELETE onePage_2938_a=tableName onePage_2939_a=expression onePage_2940_p=Deletes rows form a table. onePage_2941_p=Example\: onePage_2942_p=\ DELETE FROM TEST WHERE ID\=2 onePage_2943_h3=BACKUP onePage_2944_a=fileNameString onePage_2945_p=Backs up the database files to a .zip file. Objects are not locked. Admin rights are required to execute this command. onePage_2946_p=Example\: onePage_2947_p=\ BACKUP TO &\#39;backup.zip&\#39; onePage_2948_h3=CALL onePage_2949_a=expression onePage_2950_p=Calculates a simple expression. onePage_2951_p=Example\: onePage_2952_p=\ CALL 15*25 onePage_2953_h3=EXPLAIN onePage_2954_a=select onePage_2955_a=insert onePage_2956_a=update onePage_2957_a=delete onePage_2958_p=Shows the execution plan for a statement. onePage_2959_p=Example\: onePage_2960_p=\ EXPLAIN SELECT * FROM TEST WHERE ID\=1 onePage_2961_h3=MERGE onePage_2962_a=tableName onePage_2963_a=columnName onePage_2964_a=columnName onePage_2965_a=expression onePage_2966_a=select onePage_2967_p=Updates existing rows, and insert rows that don&\#39;t exist. If no key column is specified, the primary key columns are used to find the row. If more than one row per new row is affected, an exception is thrown. If the table contains an auto-incremented key or identity column, and the row was updated, the generated key is set to 0; otherwise it is set to the new key. onePage_2968_p=Example\: onePage_2969_p=\ MERGE INTO TEST KEY(ID) VALUES(2, &\#39;World&\#39;) onePage_2970_h3=RUNSCRIPT onePage_2971_a=fileNameString onePage_2972_a=cipher onePage_2973_a=string onePage_2974_a=charsetString onePage_2975_p=Runs a SQL script from a file. The script is a text file containing SQL statements; each statement must end with &\#39;;&\#39;. This command can be used to restore a database from a backup. The password must be in single quotes; it is case sensitive and can contain spaces. onePage_2976_p=The compression algorithm must match the one used when creating the script. When using encryption, only DEFLATE and LZF are supported (LZF is faster but uses more space). Instead of a file, an URL may be used. onePage_2977_p=Admin rights are required to execute this command. onePage_2978_p=Example\: onePage_2979_p=\ RUNSCRIPT FROM &\#39;backup&\#39; onePage_2980_h3=SCRIPT onePage_2981_a=blockSizeInt onePage_2982_a=fileNameString onePage_2983_a=cipher onePage_2984_a=string onePage_2985_p=Creates a SQL script from the database. onePage_2986_p=SIMPLE does not use multi-row insert statements. NODATA will not emit INSERT statements. If the DROP option is specified, drop statements are created for tables, views, and sequences. If the block size is set, CLOB and BLOB values larger than this size are split into separate blocks. onePage_2987_p=If no file name is specified, the script is returned as a result set. This command can be used to create a backup of the database. For long term storage, it is more portable than copying the database files. onePage_2988_p=If a file name is specified, then the whole script (including insert statements) is written to this file, and a result set without the insert statements is returned. When using encryption, only DEFLATE and LZF are supported (LZF is faster but uses more space). onePage_2989_p=This command locks objects while it is running. The password must be in single quotes; it is case sensitive and can contain spaces. onePage_2990_p=Example\: onePage_2991_p=\ SCRIPT NODATA onePage_2992_h3=SHOW onePage_2993_a=schemaName onePage_2994_a=tableName onePage_2995_a=schemaName onePage_2996_p=Lists the schemas, tables, or the columns of a table. onePage_2997_p=Example\: onePage_2998_p=\ SHOW TABLES onePage_2999_h3=ALTER INDEX RENAME onePage_3000_a=indexName onePage_3001_a=newIndexName onePage_3002_p=Renames an index. This command commits an open transaction. onePage_3003_p=Example\: onePage_3004_p=\ ALTER INDEX IDXNAME RENAME TO IDX_TEST_NAME onePage_3005_h3=ALTER SEQUENCE onePage_3006_a=sequenceName onePage_3007_a=long onePage_3008_a=long onePage_3009_p=Changes the next value and the increment of a sequence. This command does not commit the current transaction; however the new value is used by other transactions immediately, and rolling back this command has no effect. onePage_3010_p=Example\: onePage_3011_p=\ ALTER SEQUENCE SEQ_ID RESTART WITH 1000 onePage_3012_h3=ALTER TABLE ADD onePage_3013_a=tableName onePage_3014_a=name onePage_3015_a=dataType onePage_3016_a=expression onePage_3017_a=columnName onePage_3018_p=Adds a new column to a table. This command commits an open transaction. onePage_3019_p=Example\: onePage_3020_p=\ ALTER TABLE TEST ADD CREATEDATE TIMESTAMP onePage_3021_h3=ALTER TABLE ADD CONSTRAINT onePage_3022_a=tableName onePage_3023_a=constraint onePage_3024_p=Adds a constraint to a table. If NOCHECK is specified, existing rows are not checked for consistency (the default is to check consistency for existing rows). The required indexes are automatically created if they don&\#39;t exist yet. It is not possible to disable checking for unique constraints. This command commits an open transaction. onePage_3025_p=Example\: onePage_3026_p=\ ALTER TABLE TEST ADD CONSTRAINT NAME_UNIQUE UNIQUE(NAME) onePage_3027_h3=ALTER TABLE ALTER onePage_3028_a=tableName onePage_3029_a=columnName onePage_3030_a=dataType onePage_3031_a=expression onePage_3032_a=name onePage_3033_a=long onePage_3034_a=int onePage_3035_a=expression onePage_3036_p=Changes the data type of a column, rename a column, change the identity value, or change the selectivity. onePage_3037_p=Changing the data type fails if the data can not be converted. onePage_3038_p=RESTART changes the next value of an auto increment column. The column must already be an auto increment column. For RESTART, the same transactional rules as for ALTER SEQUENCE apply. onePage_3039_p=SELECTIVITY sets the selectivity (1-100) for a column. Setting the selectivity to 0 means the default value. Selectivity is used by the cost based optimizer to calculate the estimated cost of an index. Selectivity 100 means values are unique, 10 means every distinct value appears 10 times on average. onePage_3040_p=SET DEFAULT changes the default value of a column. onePage_3041_p=SET NULL sets a column to allow NULL. The row may not be part of a primary key or multi-column hash index. Single column indexes on this column are dropped. onePage_3042_p=SET NOT NULL sets a column to not allow NULL. Rows may not contains NULL in this column. onePage_3043_p=This command commits an open transaction. onePage_3044_p=Example\: onePage_3045_p=\ ALTER TABLE TEST ALTER COLUMN NAME CLOB; onePage_3046_p=ALTER TABLE TEST ALTER COLUMN NAME RENAME TO TEXT; onePage_3047_p=ALTER TABLE TEST ALTER COLUMN ID RESTART WITH 10000; onePage_3048_p=ALTER TABLE TEST ALTER COLUMN NAME SELECTIVITY 100; onePage_3049_p=ALTER TABLE TEST ALTER COLUMN NAME SET DEFAULT &\#39;&\#39;; onePage_3050_p=ALTER TABLE TEST ALTER COLUMN NAME SET NOT NULL; onePage_3051_p=ALTER TABLE TEST ALTER COLUMN NAME SET NULL; onePage_3052_h3=ALTER TABLE DROP COLUMN onePage_3053_a=tableName onePage_3054_a=columnName onePage_3055_p=Removes a column from a table. This command commits an open transaction. onePage_3056_p=Example\: onePage_3057_p=\ ALTER TABLE TEST DROP COLUMN NAME onePage_3058_h3=ALTER TABLE DROP CONSTRAINT onePage_3059_a=tableName onePage_3060_a=constraintName onePage_3061_p=Removes a constraint or a primary key from a table. This command commits an open transaction. onePage_3062_p=Example\: onePage_3063_p=\ ALTER TABLE TEST DROP CONSTRAINT UNIQUE_NAME onePage_3064_h3=ALTER TABLE SET onePage_3065_a=tableName onePage_3066_p=Disables or enables referential integrity checking for a table. This command can be used inside a transaction. Enabling referential integrity does not check existing data, except if CHECK is specified. Use SET REFERENTIAL_INTEGRITY to disable it for all tables; the global flag and the flag for each table are independent. onePage_3067_p=This command commits an open transaction. onePage_3068_p=Example\: onePage_3069_p=\ ALTER TABLE TEST SET REFERENTIAL_INTEGRITY FALSE onePage_3070_h3=ALTER TABLE RENAME onePage_3071_a=tableName onePage_3072_a=newName onePage_3073_p=Renames a table. This command commits an open transaction. onePage_3074_p=Example\: onePage_3075_p=\ ALTER TABLE TEST RENAME TO MY_DATA onePage_3076_h3=ALTER USER ADMIN onePage_3077_a=userName onePage_3078_p=Switches the admin flag of a user on or off. onePage_3079_p=Only unquoted or uppercase user names are allowed. Admin rights are required to execute this command. This command commits an open transaction. onePage_3080_p=Example\: onePage_3081_p=\ ALTER USER TOM ADMIN TRUE onePage_3082_h3=ALTER USER RENAME onePage_3083_a=userName onePage_3084_a=newUserName onePage_3085_p=Renames a user. After renaming a user, the password becomes invalid and needs to be changed as well. onePage_3086_p=Only unquoted or uppercase user names are allowed. Admin rights are required to execute this command. This command commits an open transaction. onePage_3087_p=Example\: onePage_3088_p=\ ALTER USER TOM RENAME TO THOMAS onePage_3089_h3=ALTER USER SET PASSWORD onePage_3090_a=userName onePage_3091_a=string onePage_3092_a=bytes onePage_3093_a=bytes onePage_3094_p=Changes the password of a user. Only unquoted or uppercase user names are allowed. The password must be enclosed in single quotes. It is case sensitive and can contain spaces. The salt and hash values are hex strings. onePage_3095_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3096_p=Example\: onePage_3097_p=\ ALTER USER SA SET PASSWORD &\#39;rioyxlgt&\#39; onePage_3098_h3=ALTER VIEW onePage_3099_a=viewName onePage_3100_p=Recompiles a view after the underlying tables have been changed or created. This command commits an open transaction. onePage_3101_p=Example\: onePage_3102_p=\ ALTER VIEW ADDRESS_VIEW RECOMPILE onePage_3103_h3=ANALYZE onePage_3104_a=rowCountInt onePage_3105_p=Updates the selectivity statistics of all tables. The selectivity is used by the cost based optimizer to select the best index for a given query. If no sample size is set, up to 10000 rows per table are read. The value 0 means all rows are read. The selectivity can be set manually using ALTER TABLE ALTER COLUMN SELECTIVITY. Manual values are overwritten by this statement. The selectivity is available in the INFORMATION_SCHEMA.COLUMNS table. onePage_3106_p=This command commits an open transaction. onePage_3107_p=Example\: onePage_3108_p=\ ANALYZE SAMPLE_SIZE 1000 onePage_3109_h3=COMMENT onePage_3110_a=schemaName onePage_3111_a=tableName onePage_3112_a=columnName onePage_3113_a=schemaName onePage_3114_a=objectName onePage_3115_a=expression onePage_3116_p=Sets the comment of a database object. Use NULL to remove the comment. onePage_3117_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3118_p=Example\: onePage_3119_p=\ COMMENT ON TABLE TEST IS &\#39;Table used for testing&\#39; onePage_3120_h3=CREATE AGGREGATE onePage_3121_a=newAggregateName onePage_3122_a=className onePage_3123_p=Creates a new user-defined aggregate function. The method name must be the full qualified class name. The class must implement the interface org.h2.api.AggregateFunction. onePage_3124_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3125_p=Example\: onePage_3126_p=\ CREATE AGGREGATE MEDIAN FOR "com.acme.db.Median" onePage_3127_h3=CREATE ALIAS onePage_3128_a=newFunctionAliasName onePage_3129_a=classAndMethodName onePage_3130_a=sourceCodeString onePage_3131_p=Creates a new function alias. Deterministic functions must always return the same value for the same parameters. The result of such functions is cached if possible. onePage_3132_p=The method name must be the full qualified class and method name, and may optionally include the parameter classes as in "java.lang.Integer.parseInt(java.lang.String, int)"). The class and the method must both be public, and the method must be static. The 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). onePage_3133_p=When defining a function alias with source code, the Sun javac is compiler is used if the tools.jar is in the classpath. If not, javac 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. If import statements are used, then the tag @CODE must be added before the method. onePage_3134_p=If the method throws a SQLException, it is directly re-thrown to the calling application; all other exceptions are first converted to a SQLException. onePage_3135_p=If the first parameter of the Java function is a java.sql.Connection, then a connection to the database is provided. This connection must not be closed. If the class contains multiple methods with the given name but different parameter count, all methods are mapped. onePage_3136_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3137_p=Example\: onePage_3138_p=\ CREATE ALIAS MY_SQRT FOR "java.lang.Math.sqrt"; onePage_3139_p=CREATE ALIAS GET_SYSTEM_PROPERTY FOR "java.lang.System.getProperty"; onePage_3140_p=CALL GET_SYSTEM_PROPERTY(&\#39;java.class.path&\#39;); onePage_3141_p=CALL GET_SYSTEM_PROPERTY(&\#39;com.acme.test&\#39;, &\#39;true&\#39;); onePage_3142_p=CREATE ALIAS REVERSE AS &\#36;&\#36; String reverse(String s) { return new StringBuilder(s).reverse().toString(); } &\#36;&\#36;; onePage_3143_p=CALL REVERSE(&\#39;Test&\#39;); onePage_3144_h3=CREATE CONSTANT onePage_3145_a=newConstantName onePage_3146_a=expression onePage_3147_p=Creates a new constant. This command commits an open transaction. onePage_3148_p=Example\: onePage_3149_p=\ CREATE CONSTANT ONE VALUE 1 onePage_3150_h3=CREATE DOMAIN onePage_3151_a=newDomainName onePage_3152_a=dataType onePage_3153_a=expression onePage_3154_a=selectivity onePage_3155_a=condition onePage_3156_p=Creates a new data type (domain). The check condition must evaluate to true or to NULL (to prevent NULL, use NOT NULL). In the condition, the term VALUE refers to the value being tested. onePage_3157_p=This command commits an open transaction. onePage_3158_p=Example\: onePage_3159_p=\ CREATE DOMAIN EMAIL AS VARCHAR(255) CHECK (POSITION(&\#39;@&\#39;, VALUE) > 1) onePage_3160_h3=CREATE INDEX onePage_3161_a=newIndexName onePage_3162_a=tableName onePage_3163_a=indexColumn onePage_3164_p=Creates a new index. This command commits an open transaction. onePage_3165_p=Hash indexes are kept in memory. They can only test for equality, and do not support range queries (similar to a hash table). They do support non-unique keys. A multi-column hash index is only used if all column values are known. onePage_3166_p=Example\: onePage_3167_p=\ CREATE INDEX IDXNAME ON TEST(NAME) onePage_3168_h3=CREATE LINKED TABLE onePage_3169_a=name onePage_3170_a=driverString onePage_3171_a=urlString onePage_3172_a=userString onePage_3173_a=passwordString onePage_3174_a=originalSchemaString onePage_3175_a=originalTableString onePage_3176_p=Creates a table link to an external table. The driver name may be empty if the driver is already loaded. If the schema name is not set, only one table with that name may exist in the target database. onePage_3177_p=Usually, for update statements, the old rows are deleted first and then the new rows are inserted. It is possible to emit update statements (except on rollback), however in this case multi-row unique key updates may not always work. Linked tables to the same database share one connection. onePage_3178_p=If a query is used instead of the original table name, the table is read only. Queries must be enclosed in parenthesis\: (SELECT * FROM ORDERS). onePage_3179_p=To use JNDI to get the connection, the driver class must be a javax.naming.Context (for example javax.naming.InitialContext), and the URL must be the resource name (for example java\:comp/env/jdbc/Test). onePage_3180_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3181_p=Example\: onePage_3182_p=\ CREATE LINKED TABLE LINK(&\#39;org.h2.Driver&\#39;, &\#39;jdbc\:h2\:test2&\#39;, &\#39;sa&\#39;, &\#39;sa&\#39;, &\#39;TEST&\#39;); onePage_3183_p=CREATE LINKED TABLE LINK(&\#39;&\#39;, &\#39;jdbc\:h2\:test2&\#39;, &\#39;sa&\#39;, &\#39;sa&\#39;, onePage_3184_p= &\#39;(SELECT * FROM TEST WHERE ID>0)&\#39;); onePage_3185_p=CREATE LINKED TABLE LINK(&\#39;javax.naming.InitialContext&\#39;, onePage_3186_p= &\#39;java\:comp/env/jdbc/Test&\#39;, NULL, NULL, &\#39;(SELECT * FROM TEST WHERE ID>0)&\#39;); onePage_3187_h3=CREATE ROLE onePage_3188_a=newRoleName onePage_3189_p=Creates a new role. This command commits an open transaction. onePage_3190_p=Example\: onePage_3191_p=\ CREATE ROLE READONLY onePage_3192_h3=CREATE SCHEMA onePage_3193_a=name onePage_3194_a=ownerUserName onePage_3195_p=Creates a new schema. If no owner is specified, the current user is used. The user that executes the command must have admin rights, as well as the owner. onePage_3196_p=This command commits an open transaction. onePage_3197_p=Example\: onePage_3198_p=\ CREATE SCHEMA TEST_SCHEMA AUTHORIZATION SA onePage_3199_h3=CREATE SEQUENCE onePage_3200_a=newSequenceName onePage_3201_a=long onePage_3202_a=long onePage_3203_a=long onePage_3204_p=Creates a new sequence. The data type of a sequence is BIGINT. Used values are never re-used, even when the transaction is rolled back. The cache is the number of pre-allocated numbers. If the system crashes without closing the database, at most this many numbers are lost. The default cache size is 32. onePage_3205_p=This command commits an open transaction. onePage_3206_p=Example\: onePage_3207_p=\ CREATE SEQUENCE SEQ_ID onePage_3208_h3=CREATE TABLE onePage_3209_a=name onePage_3210_a=columnDefinition onePage_3211_a=constraint onePage_3212_a=select onePage_3213_a=select onePage_3214_p=Creates a new table. onePage_3215_p=Cached tables (the default) are persistent, and the number of rows is not limited by the main memory. Memory tables are persistent, but the index data is kept in main memory, that means memory tables should not get too large. onePage_3216_p=Tables with the NOT PERSISTENT modifier are kept fully in memory, and all rows are lost when the database is closed. Temporary tables are not persistent. Temporary tables can be global (accessible by all connections) or local (only accessible by the current connection). The default is for temporary tables is global. onePage_3217_p=This command commits an open transaction. onePage_3218_p=Example\: onePage_3219_p=\ CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255)) onePage_3220_h3=CREATE TRIGGER onePage_3221_a=newTriggerName onePage_3222_a=tableName onePage_3223_a=int onePage_3224_a=triggeredClassName onePage_3225_p=Creates a new trigger. The trigger class must be public. Nested and inner classes are not supported. The 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). onePage_3226_p=&\#39;BEFORE&\#39; triggers are called after data conversion is made, default values are set, null and length constraint checks have been made; but before other constraints have been checked. onePage_3227_p=Only row based &\#39;AFTER&\#39; trigger can be called on rollback. Exceptions that occur within such triggers are ignored. onePage_3228_p=&\#39;INSTEAD OF&\#39; triggers are implicitly row based and behave like &\#39;BEFORE&\#39; triggers. Only the first such trigger is called. Such triggers on views are supported. onePage_3229_p=The MERGE statement will call both INSERT and UPDATE triggers. Not supported are SELECT triggers with the option FOR EACH ROW, and AFTER SELECT triggers. onePage_3230_p=Committing or rolling back a transaction within a trigger is not allowed, except for SELECT triggers. onePage_3231_p=This command commits an open transaction. onePage_3232_p=Example\: onePage_3233_p=\ CREATE TRIGGER TRIG_INS BEFORE INSERT ON TEST FOR EACH ROW CALL "MyTrigger" onePage_3234_h3=CREATE USER onePage_3235_a=newUserName onePage_3236_a=string onePage_3237_a=bytes onePage_3238_a=bytes onePage_3239_p=Creates a new user. For compatibility, only unquoted or uppercase user names are allowed. The password must be in single quotes. It is case sensitive and can contain spaces. The salt and hash values are hex strings. onePage_3240_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3241_p=Example\: onePage_3242_p=\ CREATE USER GUEST PASSWORD &\#39;abc&\#39; onePage_3243_h3=CREATE VIEW onePage_3244_a=newViewName onePage_3245_a=columnName onePage_3246_a=select onePage_3247_p=Creates a new view. If the force option is used, then the view is created even if the underlying table(s) don&\#39;t exist. onePage_3248_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3249_p=Example\: onePage_3250_p=\ CREATE VIEW TEST_VIEW AS SELECT * FROM TEST WHERE ID < 100 onePage_3251_h3=DROP AGGREGATE onePage_3252_a=aggregateName onePage_3253_p=Drops an existing user-defined aggregate function. onePage_3254_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3255_p=Example\: onePage_3256_p=\ CREATE AGGREGATE MEDIAN onePage_3257_h3=DROP ALIAS onePage_3258_a=existingFunctionAliasName onePage_3259_p=Drops an existing function alias. onePage_3260_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3261_p=Example\: onePage_3262_p=\ CREATE ALIAS MY_SQRT onePage_3263_h3=DROP ALL OBJECTS onePage_3264_p=Drops all existing views, tables, sequences, schemas, function aliases, roles, user-defined aggregate functions, domains, and users (except the current user). If DELETE FILES is specified, the database files will be removed when the last user disconnects from the database. Warning\: this command can not be rolled back. onePage_3265_p=Admin rights are required to execute this command. onePage_3266_p=Example\: onePage_3267_p=\ DROP ALL OBJECTS onePage_3268_h3=DROP CONSTANT onePage_3269_a=constantName onePage_3270_p=Drops a constant. This command commits an open transaction. onePage_3271_p=Example\: onePage_3272_p=\ DROP CONSTANT ONE onePage_3273_h3=DROP DOMAIN onePage_3274_a=domainName onePage_3275_p=Drops a data type (domain). This command commits an open transaction. onePage_3276_p=Example\: onePage_3277_p=\ DROP DOMAIN EMAIL onePage_3278_h3=DROP INDEX onePage_3279_a=indexName onePage_3280_p=Drops an index. This command commits an open transaction. onePage_3281_p=Example\: onePage_3282_p=\ DROP INDEX IF EXISTS IDXNAME onePage_3283_h3=DROP ROLE onePage_3284_a=roleName onePage_3285_p=Drops a role. This command commits an open transaction. onePage_3286_p=Example\: onePage_3287_p=\ DROP ROLE READONLY onePage_3288_h3=DROP SCHEMA onePage_3289_a=schemaName onePage_3290_p=Drops a schema. This command commits an open transaction. onePage_3291_p=Example\: onePage_3292_p=\ DROP SCHEMA TEST_SCHEMA onePage_3293_h3=DROP SEQUENCE onePage_3294_a=sequenceName onePage_3295_p=Drops a sequence. This command commits an open transaction. onePage_3296_p=Example\: onePage_3297_p=\ DROP SEQUENCE SEQ_ID onePage_3298_h3=DROP TABLE onePage_3299_a=tableName onePage_3300_p=Drops an existing table, or a list of existing tables. This command commits an open transaction. onePage_3301_p=Example\: onePage_3302_p=\ DROP TABLE TEST onePage_3303_h3=DROP TRIGGER onePage_3304_a=triggerName onePage_3305_p=Drops an existing trigger. This command commits an open transaction. onePage_3306_p=Example\: onePage_3307_p=\ DROP TRIGGER TRIG_INS onePage_3308_h3=DROP USER onePage_3309_a=userName onePage_3310_p=Drops a user. The current user cannot be dropped. For compatibility, only unquoted or uppercase user names are allowed. onePage_3311_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3312_p=Example\: onePage_3313_p=\ DROP USER TOM onePage_3314_h3=DROP VIEW onePage_3315_a=viewName onePage_3316_p=Drops a view. This command commits an open transaction. onePage_3317_p=Example\: onePage_3318_p=\ DROP VIEW TEST_VIEW onePage_3319_h3=TRUNCATE TABLE onePage_3320_a=tableName onePage_3321_p=Removes all rows from a table. Unlike DELETE FROM without where clause, this command can not be rolled back. This command is faster than DELETE without where clause. Only regular data tables without foreign key constraints can be truncated. Linked tables can&\#39;t be truncated. onePage_3322_p=This command commits an open transaction. onePage_3323_p=Example\: onePage_3324_p=\ TRUNCATE TABLE TEST onePage_3325_h3=CHECKPOINT onePage_3326_p=Flushes the log and data files and switches to a new log file if possible. onePage_3327_p=Admin rights are required to execute this command. onePage_3328_p=Example\: onePage_3329_p=\ CHECKPOINT onePage_3330_h3=CHECKPOINT SYNC onePage_3331_p=Flushes the log, data and index files and forces all system buffers be written to the underlying device. onePage_3332_p=Admin rights are required to execute this command. onePage_3333_p=Example\: onePage_3334_p=\ CHECKPOINT SYNC onePage_3335_h3=COMMIT onePage_3336_p=Commits a transaction. onePage_3337_p=Example\: onePage_3338_p=\ COMMIT onePage_3339_h3=COMMIT TRANSACTION onePage_3340_a=transactionName onePage_3341_p=Sets the resolution of an in-doubt transaction to &\#39;commit&\#39;. onePage_3342_p=Admin rights are required to execute this command. This command is part of the 2-phase-commit protocol. onePage_3343_p=Example\: onePage_3344_p=\ COMMIT TRANSACTION XID_TEST onePage_3345_h3=GRANT RIGHT onePage_3346_a=tableName onePage_3347_a=userName onePage_3348_a=roleName onePage_3349_p=Grants rights for a table to a user or role. onePage_3350_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3351_p=Example\: onePage_3352_p=\ GRANT SELECT ON TEST TO READONLY onePage_3353_h3=GRANT ROLE onePage_3354_a=roleName onePage_3355_a=userName onePage_3356_a=roleName onePage_3357_p=Grants a role to a user or role. onePage_3358_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3359_p=Example\: onePage_3360_p=\ GRANT READONLY TO PUBLIC onePage_3361_h3=HELP onePage_3362_p=Displays the help pages of SQL commands or keywords. onePage_3363_p=Example\: onePage_3364_p=\ HELP SELECT onePage_3365_h3=PREPARE COMMIT onePage_3366_a=newTransactionName onePage_3367_p=Prepares committing a transaction. This command is part of the 2-phase-commit protocol. onePage_3368_p=Example\: onePage_3369_p=\ PREPARE COMMIT XID_TEST onePage_3370_h3=REVOKE RIGHT onePage_3371_a=tableName onePage_3372_a=userName onePage_3373_a=roleName onePage_3374_p=Removes rights for a table from a user or role. onePage_3375_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3376_p=Example\: onePage_3377_p=\ REVOKE SELECT ON TEST FROM READONLY onePage_3378_h3=REVOKE ROLE onePage_3379_a=roleName onePage_3380_a=userName onePage_3381_a=roleName onePage_3382_p=Removes a role from a user or role. onePage_3383_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3384_p=Example\: onePage_3385_p=\ REVOKE READONLY FROM TOM onePage_3386_h3=ROLLBACK onePage_3387_a=savepointName onePage_3388_p=Rolls back a transaction. If a savepoint name is used, the transaction is only rolled back to the specified savepoint. onePage_3389_p=Example\: onePage_3390_p=\ ROLLBACK onePage_3391_h3=ROLLBACK TRANSACTION onePage_3392_a=transactionName onePage_3393_p=Sets the resolution of an in-doubt transaction to &\#39;rollback&\#39;. onePage_3394_p=Admin rights are required to execute this command. This command is part of the 2-phase-commit protocol. onePage_3395_p=Example\: onePage_3396_p=\ ROLLBACK TRANSACTION XID_TEST onePage_3397_h3=SAVEPOINT onePage_3398_a=savepointName onePage_3399_p=Create a new savepoint. See also ROLLBACK. Savepoints are only valid until the transaction is committed or rolled back. onePage_3400_p=Example\: onePage_3401_p=\ SAVEPOINT HALF_DONE onePage_3402_h3=SET @ onePage_3403_a=@variableName onePage_3404_a=expression onePage_3405_p=Updates a user-defined variable. This command does not commit a transaction, and rollback does not affect it. onePage_3406_p=Example\: onePage_3407_p=\ SET @TOTAL\=0 onePage_3408_h3=SET ALLOW_LITERALS onePage_3409_p=This setting can help solve the SQL injection problem. By default, text and number literals are allowed in SQL statements. However, this enables SQL injection if the application dynamically builds SQL statements. SQL injection is not possible if user data is set using parameters (&\#39;?&\#39;). onePage_3410_p=NONE means literals of any kind are not allowed, only parameters and constants are allowed. NUMBERS mean only numerical and boolean literals are allowed. ALL means all literals are allowed (default). onePage_3411_p=See also CREATE CONSTANT. onePage_3412_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. This setting can be appended to the database URL\: jdbc\:h2\:test;ALLOW_LITERALS\=NONE onePage_3413_p=Example\: onePage_3414_p=\ SET ALLOW_LITERALS NONE onePage_3415_h3=SET AUTOCOMMIT onePage_3416_p=Switches auto commit on or off. This setting can be appended to the database URL\: jdbc\:h2\:test;AUTOCOMMIT\=OFF onePage_3417_p=Example\: onePage_3418_p=\ SET AUTOCOMMIT OFF onePage_3419_h3=SET CACHE_SIZE onePage_3420_a=int onePage_3421_p=Sets the size of the cache in KB (each KB being 1024 bytes) for the current database. The default value is 16384 (16 MB). The value is rounded to the next higher power of two. Depending on the virtual machine, the actual memory required may be higher. onePage_3422_p=This setting is persistent and affects all connections as there is only one cache per database. This setting only affects the database engine (the server in a client/server environment). It has no effect for in-memory databases. onePage_3423_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. This setting can be appended to the database URL\: jdbc\:h2\:test;CACHE_SIZE\=8192 onePage_3424_p=Example\: onePage_3425_p=\ SET CACHE_SIZE 8192 onePage_3426_h3=SET CLUSTER onePage_3427_a=serverListString onePage_3428_p=This command should not be used directly by an application, the statement is executed automatically by the system. The behavior may change in future releases. Sets the cluster server list. An empty string switches off the cluster mode. Switching on the cluster mode requires admin rights, but any user can switch it off (this is automatically done when the client detects the other server is not responding). onePage_3429_p=Admin rights are required to execute this command. This command commits an open transaction. onePage_3430_p=Example\: onePage_3431_p=\ SET CLUSTER &\#39;&\#39; onePage_3432_h3=SET COLLATION onePage_3433_a=collationName onePage_3434_p=Sets the collation used for comparing strings. This command can only be executed if there are no tables defined. See java.text.Collator for details about STRENGTH. onePage_3435_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3436_p=Example\: onePage_3437_p=\ SET COLLATION ENGLISH onePage_3438_h3=SET COMPRESS_LOB onePage_3439_p=Sets the compression algorithm for BLOB and CLOB data. Compression is usually slower, but needs less disk space. LZF is faster but uses more space. onePage_3440_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3441_p=Example\: onePage_3442_p=\ SET COMPRESS_LOB LZF onePage_3443_h3=SET DATABASE_EVENT_LISTENER onePage_3444_a=classNameString onePage_3445_p=Sets the event listener class. An empty string (&\#39;&\#39;) means no listener should be used. This setting is not persistent. onePage_3446_p=Admin rights are required to execute this command, except if it is set when opening the database (in this case it is reset just after opening the database). This setting can be appended to the database URL\: jdbc\:h2\:test;DATABASE_EVENT_LISTENER\=&\#39;sample.MyListener&\#39; onePage_3447_p=Example\: onePage_3448_p=\ SET DATABASE_EVENT_LISTENER &\#39;sample.MyListener&\#39; onePage_3449_h3=SET DB_CLOSE_DELAY onePage_3450_a=int onePage_3451_p=Sets the delay for closing a database if all connections are closed. The value -1 means the database is never closed until the close delay is set to some other value or SHUTDOWN is called. The value 0 means no delay (default; the database is closed if the last connection to it is closed). Values 1 and larger mean the number of seconds the database is left open after closing the last connection. onePage_3452_p=If the application exits normally or System.exit is called, the database is closed immediately, even if a delay is set. onePage_3453_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. This setting can be appended to the database URL\: jdbc\:h2\:test;DB_CLOSE_DELAY\=-1 onePage_3454_p=Example\: onePage_3455_p=\ SET DB_CLOSE_DELAY -1 onePage_3456_h3=SET DEFAULT_LOCK_TIMEOUT onePage_3457_a=int onePage_3458_p=Sets the default lock timeout (in milliseconds) in this database that is used for the new sessions. The default value for this setting is 1000 (one second). onePage_3459_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3460_p=Example\: onePage_3461_p=\ SET DEFAULT_LOCK_TIMEOUT 5000 onePage_3462_h3=SET DEFAULT_TABLE_TYPE onePage_3463_p=Sets the default table storage type that is used when creating new tables. Memory tables are kept fully in the main memory (including indexes), however changes to the data are stored in the log file. The size of memory tables is limited by the memory. The default is CACHED. onePage_3464_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3465_p=Example\: onePage_3466_p=\ SET DEFAULT_TABLE_TYPE MEMORY onePage_3467_h3=SET EXCLUSIVE onePage_3468_p=Switched the database to exclusive mode and back. In exclusive mode, new connections are rejected, and operations by other connections are paused until the exclusive mode is disabled. Only the connection that set the exclusive mode can disable it. When the connection is closed, it is automatically disabled. onePage_3469_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3470_p=Example\: onePage_3471_p=\ SET EXCLUSIVE TRUE onePage_3472_h3=SET IGNORECASE onePage_3473_p=If IGNORECASE is enabled, text columns in newly created tables will be case-insensitive. Already existing tables are not affected. The effect of case-insensitive columns is similar to using a collation with strength PRIMARY. Case-insensitive columns are compared faster than when using a collation. onePage_3474_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3475_p=Example\: onePage_3476_p=\ SET IGNORECASE TRUE onePage_3477_h3=SET LOCK_MODE onePage_3478_a=int onePage_3479_p=Sets the lock mode. The values 0, 1, 2, and 3 are supported. The default is 3 (READ_COMMITTED). This setting affects all connections. onePage_3480_p=The value 0 means no locking (should only be used for testing; also known as READ_UNCOMMITTED). Please note that using SET LOCK_MODE 0 while at the same time using multiple connections may result in inconsistent transactions. onePage_3481_p=The value 1 means table level locking (also known as SERIALIZABLE). onePage_3482_p=The value 2 means table level locking with garbage collection (if the application does not close all connections). onePage_3483_p=The value 3 means table level locking, but read locks are released immediately (default; also known as READ_COMMITTED). onePage_3484_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. This setting can be appended to the database URL\: jdbc\:h2\:test;LOCK_MODE\=3 onePage_3485_p=Example\: onePage_3486_p=\ SET LOCK_MODE 1 onePage_3487_h3=SET LOCK_TIMEOUT onePage_3488_a=int onePage_3489_p=Sets the lock timeout (in milliseconds) for the current session. The default value for this setting is 1000 (one second). onePage_3490_p=This command does not commit a transaction, and rollback does not affect it. This setting can be appended to the database URL\: jdbc\:h2\:test;LOCK_TIMEOUT\=10000 onePage_3491_p=Example\: onePage_3492_p=\ SET LOCK_TIMEOUT 1000 onePage_3493_h3=SET MAX_LENGTH_INPLACE_LOB onePage_3494_a=int onePage_3495_p=Sets the maximum size of an in-place LOB object. LOB objects larger that this size are stored in a separate file, otherwise stored directly in the database (in-place). The default max size is 1024. onePage_3496_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3497_p=Example\: onePage_3498_p=\ SET MAX_LENGTH_INPLACE_LOB 128 onePage_3499_h3=SET MAX_LOG_SIZE onePage_3500_a=int onePage_3501_p=Sets the maximum file size of a log file, in megabytes. If the file exceeds the limit, a new file is created. Old files (that are not used for recovery) are deleted automatically, but multiple log files may exist for some time. The default max size is 32 MB. onePage_3502_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3503_p=Example\: onePage_3504_p=\ SET MAX_LOG_SIZE 2 onePage_3505_h3=SET MAX_MEMORY_ROWS onePage_3506_a=int onePage_3507_p=The maximum number of rows in a result set that are kept in-memory. If more rows are read, then the rows are buffered to disk. The default value is 10000. onePage_3508_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3509_p=Example\: onePage_3510_p=\ SET MAX_MEMORY_ROWS 1000 onePage_3511_h3=SET MAX_MEMORY_UNDO onePage_3512_a=int onePage_3513_p=The maximum number of undo records per a session that are kept in-memory. If a transaction is larger, the records are buffered to disk. The default value is 50000. Changes to tables without a primary key can not be buffered to disk. This setting is not supported when using multi-version concurrency. onePage_3514_p=Admin rights are required to execute this command. This command commits an open transaction. This setting is persistent. onePage_3515_p=Example\: onePage_3516_p=\ SET MAX_MEMORY_UNDO 1000 onePage_3517_h3=SET MAX_OPERATION_MEMORY onePage_3518_a=int onePage_3519_p=Sets the maximum memory used for large operations (delete and insert), in bytes. Operations that use more memory are buffered to disk, slowing down the operation. The default max size is 100000. 0 means no limit. onePage_3520_p=This setting is not persistent. Admin rights are required to execute this command. This setting can be appended to the database URL\: jdbc\:h2\:test;MAX_OPERATION_MEMORY\=10000 onePage_3521_p=Example\: onePage_3522_p=\ SET MAX_OPERATION_MEMORY 0 onePage_3523_h3=SET MODE onePage_3524_p=Changes to another database compatibility mode. For details, see Compatibility Modes in the feature section. onePage_3525_p=This setting is not persistent. Admin rights are required to execute this command. This command commits an open transaction. This setting can be appended to the database URL\: jdbc\:h2\:test;MODE\=MYSQL onePage_3526_p=Example\: onePage_3527_p=\ SET MODE HSQLDB onePage_3528_h3=SET MULTI_THREADED onePage_3529_p=Enabled (1) or disabled (0) multi-threading inside the database engine. By default, this setting is disabled. Currently, enabling this is experimental only. onePage_3530_p=This is a global setting, which means it is not possible to open multiple databases with different modes at the same time in the same virtual machine. This setting is not persistent, however the value is kept until the virtual machine exits or it is changed. onePage_3531_p=Admin rights are required to execute this command. This command commits an open transaction. This setting can be appended to the database URL\: jdbc\:h2\:test;MULTI_THREADED\=1 onePage_3532_p=Example\: onePage_3533_p=\ SET MULTI_THREADED 1 onePage_3534_h3=SET OPTIMIZE_REUSE_RESULTS onePage_3535_p=Enabled (1) or disabled (0) the result reuse optimization. If enabled, subqueries and views used as subqueries are only re-run if the data in one of the tables was changed. This option is enabled by default. onePage_3536_p=Admin rights are required to execute this command. This command commits an open transaction. This setting can be appended to the database URL\: jdbc\:h2\:test;OPTIMIZE_REUSE_RESULTS\=0 onePage_3537_p=Example\: onePage_3538_p=\ SET OPTIMIZE_REUSE_RESULTS 0 onePage_3539_h3=SET PASSWORD onePage_3540_a=string onePage_3541_p=Changes the password of the current user. The password must be in single quotes. It is case sensitive and can contain spaces. onePage_3542_p=This command commits an open transaction. onePage_3543_p=Example\: onePage_3544_p=\ SET PASSWORD &\#39;abcstzri\!.5&\#39; onePage_3545_h3=SET QUERY_TIMEOUT onePage_3546_a=int onePage_3547_p=Set the query timeout of the current session to the given value. The timeout is in milliseconds. All kinds of statements will throw an exception if they take longer than the given value. The default timeout is 0, meaning no timeout. onePage_3548_p=This command does not commit a transaction, and rollback does not affect it. onePage_3549_p=Example\: onePage_3550_p=\ SET QUERY_TIMEOUT 10000 onePage_3551_h3=SET REFERENTIAL_INTEGRITY onePage_3552_p=Disabled or enables referential integrity checking for the whole database. Enabling it does not check existing data. Use ALTER TABLE SET to disable it only for one table. onePage_3553_p=This setting is not persistent. This command commits an open transaction. Admin rights are required to execute this command. onePage_3554_p=Example\: onePage_3555_p=\ SET REFERENTIAL_INTEGRITY FALSE onePage_3556_h3=SET SALT HASH onePage_3557_a=bytes onePage_3558_a=bytes onePage_3559_p=Sets the password salt and hash for the current user. The password must be in single quotes. It is case sensitive and can contain spaces. onePage_3560_p=This command commits an open transaction. onePage_3561_p=Example\: onePage_3562_p=\ SET SALT &\#39;00&\#39; HASH &\#39;1122&\#39; onePage_3563_h3=SET SCHEMA onePage_3564_a=schemaName onePage_3565_p=Changes the default schema of the current connection. The default schema is used in statements where no schema is set explicitly. The default schema for new connections is PUBLIC. onePage_3566_p=This command does not commit a transaction, and rollback does not affect it. This setting can be appended to the database URL\: jdbc\:h2\:test;SCHEMA\=ABC onePage_3567_p=Example\: onePage_3568_p=\ SET SCHEMA INFORMATION_SCHEMA onePage_3569_h3=SET SCHEMA_SEARCH_PATH onePage_3570_a=schemaName onePage_3571_p=Changes the schema search path of the current connection. The default schema is used in statements where no schema is set explicitly. The default schema for new connections is PUBLIC. onePage_3572_p=This command does not commit a transaction, and rollback does not affect it. This setting can be appended to the database URL\: jdbc\:h2\:test;SCHEMA_SEARCH_PATH\=ABC,DEF onePage_3573_p=Example\: onePage_3574_p=\ SET SCHEMA_SEARCH_PATH INFORMATION_SCHEMA, PUBLIC onePage_3575_h3=SET THROTTLE onePage_3576_a=int onePage_3577_p=Sets the throttle for the current connection. The value is the number of milliseconds delay after each 50 ms. The default value is 0 (throttling disabled). onePage_3578_p=This command does not commit a transaction, and rollback does not affect it. This setting can be appended to the database URL\: jdbc\:h2\:test;THROTTLE\=50 onePage_3579_p=Example\: onePage_3580_p=\ SET THROTTLE 200 onePage_3581_h3=SET TRACE_LEVEL onePage_3582_a=int onePage_3583_p=Sets the trace level for file the file or system out stream. Levels are\: 0\=off, 1\=error, 2\=info, 3\=debug. The default level is 1 for file and 0 for system out. To use SLF4J, append ;TRACE_LEVEL_FILE\=4 to the database URL when opening the database. onePage_3584_p=This setting is not persistent. Admin rights are required to execute this command. This command does not commit a transaction, and rollback does not affect it. This setting can be appended to the database URL\: jdbc\:h2\:test;TRACE_LEVEL_SYSTEM_OUT\=3 onePage_3585_p=Example\: onePage_3586_p=\ SET TRACE_LEVEL_SYSTEM_OUT 3 onePage_3587_h3=SET TRACE_MAX_FILE_SIZE onePage_3588_a=int onePage_3589_p=Sets the maximum trace file size. If the file exceeds the limit, the file is renamed to .old and a new file is created. If another .old file exists, it is deleted. The default max size is 16 MB. onePage_3590_p=This setting is persistent. Admin rights are required to execute this command. This command commits an open transaction. This setting can be appended to the database URL\: jdbc\:h2\:test;TRACE_MAX_FILE_SIZE\=3 onePage_3591_p=Example\: onePage_3592_p=\ SET TRACE_MAX_FILE_SIZE 10 onePage_3593_h3=SET UNDO_LOG onePage_3594_a=int onePage_3595_p=Enables (1) or disables (0) the per session undo log. The undo log is enabled by default. When disabled, transactions can not be rolled back. This setting should only be used for bulk operations that don&\#39;t need to be atomic. onePage_3596_p=This command commits an open transaction. onePage_3597_p=Example\: onePage_3598_p=\ SET UNDO_LOG 0 onePage_3599_h3=SET WRITE_DELAY onePage_3600_a=int onePage_3601_p=Set the maximum delay between a commit and flushing the log, in milliseconds. This setting is persistent. The default is 500 ms. onePage_3602_p=Admin rights are required to execute this command. This command commits an open transaction. This setting can be appended to the database URL\: jdbc\:h2\:test;WRITE_DELAY\=0 onePage_3603_p=Example\: onePage_3604_p=\ SET WRITE_DELAY 2000 onePage_3605_h3=SHUTDOWN onePage_3606_p=This statement closes all open connections to the database and closes the database. This command is usually not required, as the database is closed automatically when the last connection to it is closed. onePage_3607_p=If no option is used, then the database is closed normally. All connections are closed, open transactions are rolled back. COMPACT compacts the database (re-creating the database may further reduce the database size). IMMEDIATELY closes the database files without any cleanup. onePage_3608_p=Admin rights are required to execute this command. onePage_3609_p=Example\: onePage_3610_p=\ SHUTDOWN COMPACT onePage_3611_h3=Alias onePage_3612_a=name onePage_3613_p=An alias is a name that is only valid in the context of the statement. onePage_3614_p=Example\: onePage_3615_p=A onePage_3616_h3=And Condition onePage_3617_a=condition onePage_3618_a=condition onePage_3619_p=Value or condition. onePage_3620_p=Example\: onePage_3621_p=ID\=1 AND NAME\=&\#39;Hi&\#39; onePage_3622_h3=Array onePage_3623_a=expression onePage_3624_p=An array of values. onePage_3625_p=Example\: onePage_3626_p=(1, 2) onePage_3627_h3=Boolean onePage_3628_p=A boolean value. onePage_3629_p=Example\: onePage_3630_p=TRUE onePage_3631_h3=Bytes onePage_3632_a=hex onePage_3633_p=A binary value. The hex value is not case sensitive. onePage_3634_p=Example\: onePage_3635_p=X&\#39;01FF&\#39; onePage_3636_h3=Case onePage_3637_a=expression onePage_3638_a=expression onePage_3639_a=expression onePage_3640_a=expression onePage_3641_p=Returns the first expression where the value is equal to the test expression. If no else part is specified, return NULL. onePage_3642_p=Example\: onePage_3643_p=CASE CNT WHEN 0 THEN &\#39;No&\#39; WHEN 1 THEN &\#39;One&\#39; ELSE &\#39;Some&\#39; END onePage_3644_h3=Case When onePage_3645_a=expression onePage_3646_a=expression onePage_3647_a=expression onePage_3648_p=Returns the first expression where the condition is true. If no else part is specified, return NULL. onePage_3649_p=Example\: onePage_3650_p=CASE WHEN CNT<10 THEN &\#39;Low&\#39; ELSE &\#39;High&\#39; END onePage_3651_h3=Cipher onePage_3652_p=Two algorithms are supported, AES (AES-256) and XTEA (using 32 rounds). The AES algorithm is about half as fast as XTEA. onePage_3653_p=Example\: onePage_3654_p=AES onePage_3655_h3=Column Definition onePage_3656_a=columnName onePage_3657_a=dataType onePage_3658_a=expression onePage_3659_a=computedColumnExpression onePage_3660_a=startInt onePage_3661_a=incrementInt onePage_3662_a=selectivity onePage_3663_p=Default expressions are used if no explicit value was used when adding a row. The computed column expression is evaluated and assigned whenever the row changes. onePage_3664_p=Identity and auto-increment columns are columns with a sequence as the default. The column declared as the identity columns is implicitly the primary key column of this table (unlike auto-increment columns). onePage_3665_p=Example\: onePage_3666_p=CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255) DEFAULT &\#39;&\#39;); onePage_3667_p=CREATE TABLE TEST(ID BIGINT IDENTITY); onePage_3668_p=CREATE TABLE TEST(QUANTITY INT, PRICE DECIMAL, AMOUNT DECIMAL AS QUANTITY*PRICE); onePage_3669_h3=Comments onePage_3670_p=Comments can be used anywhere in a command and are ignored by the database. Line comments end with a newline. Block comments cannot be nested, but can be multiple lines long. onePage_3671_p=Example\: onePage_3672_p=// This is a comment onePage_3673_h3=Compare onePage_3674_p=Comparison operator. The operator \!\= is the same as <>. onePage_3675_p=Example\: onePage_3676_p=<> onePage_3677_h3=Condition onePage_3678_a=operand onePage_3679_a=conditionRightHandSide onePage_3680_a=condition onePage_3681_a=select onePage_3682_p=Boolean value or condition. onePage_3683_p=Example\: onePage_3684_p=ID<>2 onePage_3685_h3=Condition Right Hand Side onePage_3686_a=compare onePage_3687_a=select onePage_3688_a=operand onePage_3689_a=operand onePage_3690_a=operand onePage_3691_a=select onePage_3692_a=expression onePage_3693_a=operand onePage_3694_a=string onePage_3695_a=operand onePage_3696_p=The right hand side of a condition. onePage_3697_p=When comparing with LIKE, the wildcards characters are _ (any one character) and % (any characters). The database uses an index when comparing with LIKE except if the operand starts with a wildcard. To search for the characters % and _, the characters need to be escaped. The default escape character is \\ (backslash). To select no escape character, use ESCAPE &\#39;&\#39; (empty string). At most one escape character is allowed. Each character that follows the escape character in the pattern needs to match exactly. Patterns that end with an escape character are invalid and the expression returns NULL. onePage_3698_p=When comparing with REGEXP, regular expression matching is used. See Java Matcher.find for details. onePage_3699_p=Example\: onePage_3700_p=LIKE &\#39;Jo%&\#39; onePage_3701_h3=Constraint onePage_3702_a=constraintNameDefinition onePage_3703_a=expression onePage_3704_a=columnName onePage_3705_a=referentialConstraint onePage_3706_a=columnName onePage_3707_p=Defines a constraint. The check condition must evaluate to true or to NULL (to prevent NULL, use NOT NULL). onePage_3708_p=Example\: onePage_3709_p=PRIMARY KEY(ID, NAME) onePage_3710_h3=Constraint Name Definition onePage_3711_a=newConstraintName onePage_3712_p=Defines a constraint name. onePage_3713_p=Example\: onePage_3714_p=CONSTRAINT CONST_ID onePage_3715_h3=Csv Options onePage_3716_a=charsetString onePage_3717_a=fieldSepString onePage_3718_a=fieldDelimString onePage_3719_a=escString onePage_3720_a=nullString onePage_3721_p=Optional parameters for CSVREAD and CSVWRITE. onePage_3722_p=Example\: onePage_3723_p=CALL CSVWRITE(&\#39;test2.csv&\#39;, &\#39;SELECT * FROM TEST&\#39;, &\#39;UTF-8&\#39;, &\#39;|&\#39;); onePage_3724_h3=Data Type onePage_3725_a=intType onePage_3726_a=booleanType onePage_3727_a=tinyintType onePage_3728_a=smallintType onePage_3729_a=bigintType onePage_3730_a=identityType onePage_3731_a=decimalType onePage_3732_a=doubleType onePage_3733_a=realType onePage_3734_a=dateType onePage_3735_a=timeType onePage_3736_a=timestampType onePage_3737_a=binaryType onePage_3738_a=otherType onePage_3739_a=varcharType onePage_3740_a=varcharIgnorecaseType onePage_3741_a=charType onePage_3742_a=blobType onePage_3743_a=clobType onePage_3744_a=uuidType onePage_3745_a=arrayType onePage_3746_p=A data type definition. onePage_3747_p=Example\: onePage_3748_p=INT onePage_3749_h3=Date onePage_3750_p=A date literal. The limitations are the same as for the Java data type java.sql.Date, but for compatibility with other databases the suggested minimum and maximum years are 0001 and 9999. onePage_3751_p=Example\: onePage_3752_p=DATE &\#39;2004-12-31&\#39; onePage_3753_h3=Decimal onePage_3754_a=number onePage_3755_a=number onePage_3756_p=Number with fixed precision and scale. onePage_3757_p=Example\: onePage_3758_p=-1600.05 onePage_3759_h3=Digit onePage_3760_p=A digit. onePage_3761_p=Example\: onePage_3762_p=0 onePage_3763_h3=Dollar Quoted String onePage_3764_p=A string starts and ends with two dollar signs. Two dollar signs are not allowed within the text. A whitespace is required before the first set of dollar signs. No escaping is required within the text. onePage_3765_p=Example\: onePage_3766_p=&\#36;&\#36;John&\#39;s car&\#36;&\#36; onePage_3767_h3=Double onePage_3768_a=number onePage_3769_a=number onePage_3770_a=number onePage_3771_a=expNumber onePage_3772_p=The limitations are the same as for the Java data type Double. onePage_3773_p=Example\: onePage_3774_p=-1.4e-10 onePage_3775_h3=Expression onePage_3776_a=andCondition onePage_3777_a=andCondition onePage_3778_p=Value or condition. onePage_3779_p=Example\: onePage_3780_p=ID\=1 OR NAME\=&\#39;Hi&\#39; onePage_3781_h3=Factor onePage_3782_a=term onePage_3783_a=term onePage_3784_p=A value or a numeric factor. onePage_3785_p=Example\: onePage_3786_p=ID * 10 onePage_3787_h3=Hex onePage_3788_a=digit onePage_3789_a=digit onePage_3790_p=The hexadecimal representation of a number or of bytes. Two characters are one byte. onePage_3791_p=Example\: onePage_3792_p=cafe onePage_3793_h3=Hex Number onePage_3794_a=hex onePage_3795_p=A number written in hexadecimal notation. onePage_3796_p=Example\: onePage_3797_p=0xff onePage_3798_h3=Index Column onePage_3799_a=columnName onePage_3800_p=Indexes this column in ascending or descending order. Usually it is not required to specify the order; however doing so will speed up large queries that order the column in the same way. onePage_3801_p=Example\: onePage_3802_p=NAME onePage_3803_h3=Int onePage_3804_a=number onePage_3805_p=The maximum integer number is 2147483647, the minimum is -2147483648. onePage_3806_p=Example\: onePage_3807_p=10 onePage_3808_h3=Long onePage_3809_a=number onePage_3810_p=Long numbers are between -9223372036854775808 and 9223372036854775807. onePage_3811_p=Example\: onePage_3812_p=100000 onePage_3813_h3=Name onePage_3814_a=quotedName onePage_3815_p=Names are not case sensitive. There is no maximum name length. onePage_3816_p=Example\: onePage_3817_p=TEST onePage_3818_h3=Null onePage_3819_p=NULL is a value without data type and means &\#39;unknown value&\#39;. onePage_3820_p=Example\: onePage_3821_p=NULL onePage_3822_h3=Number onePage_3823_a=digit onePage_3824_p=The maximum length of the number depends on the data type used. onePage_3825_p=Example\: onePage_3826_p=100 onePage_3827_h3=Operand onePage_3828_a=summand onePage_3829_a=summand onePage_3830_p=A value or a concatenation of values. onePage_3831_p=Example\: onePage_3832_p=&\#39;Hi&\#39; || &\#39; Eva&\#39; onePage_3833_h3=Order onePage_3834_a=int onePage_3835_a=expression onePage_3836_p=Sorts the result by the given column number, or by an expression. If the expression is a single parameter, then the value is interpreted as a column number. Negative column numbers reverse the sort order. onePage_3837_p=Example\: onePage_3838_p=NAME DESC NULLS LAST onePage_3839_h3=Quoted Name onePage_3840_p=Quoted names are case sensitive, and can contain spaces. There is no maximum name length. Two double quotes can be used to create a single double quote inside an identifier. onePage_3841_p=Example\: onePage_3842_p="FirstName" onePage_3843_h3=Referential Constraint onePage_3844_a=columnName onePage_3845_a=refTableName onePage_3846_a=refColumnName onePage_3847_p=Defines a referential constraint. If the table name is not specified, then the same table is referenced. As this database does not support deferred checking, RESTRICT and NO ACTION will both throw an exception if the constraint is violated. If the referenced columns are not specified, then the primary key columns are used. The required indexes are automatically created if required. onePage_3848_p=Example\: onePage_3849_p=FOREIGN KEY(ID) REFERENCES TEST(ID) onePage_3850_h3=Select Expression onePage_3851_a=expression onePage_3852_a=columnAlias onePage_3853_a=tableAlias onePage_3854_p=An expression in a SELECT statement. onePage_3855_p=Example\: onePage_3856_p=ID AS VALUE onePage_3857_h3=String onePage_3858_p=A string starts and ends with a single quote. Two single quotes can be used to create a single quote inside a string. onePage_3859_p=Example\: onePage_3860_p=&\#39;John&\#39;&\#39;s car&\#39; onePage_3861_h3=Summand onePage_3862_a=factor onePage_3863_a=factor onePage_3864_p=A value or a numeric sum. onePage_3865_p=Example\: onePage_3866_p=ID + 20 onePage_3867_h3=Table Expression onePage_3868_a=schemaName onePage_3869_a=tableName onePage_3870_a=select onePage_3871_a=newTableAlias onePage_3872_a=tableExpression onePage_3873_a=expression onePage_3874_p=Joins a table. The join expression is not supported for cross and natural joins. A natural join is an inner join, where the condition is automatically on the columns with the same name. onePage_3875_p=Example\: onePage_3876_p=TEST AS T LEFT JOIN TEST AS T1 ON T.ID \= T1.ID onePage_3877_h3=Term onePage_3878_a=value onePage_3879_a=columnName onePage_3880_a=int onePage_3881_a=sequenceName onePage_3882_a=term onePage_3883_a=expression onePage_3884_a=select onePage_3885_a=case onePage_3886_a=caseWhen onePage_3887_a=tableAlias onePage_3888_a=columnName onePage_3889_p=A value. Parameters can be indexed, for example ?1 meaning the first parameter. onePage_3890_p=Example\: onePage_3891_p=&\#39;Hello&\#39; onePage_3892_h3=Time onePage_3893_p=A time literal. onePage_3894_p=Example\: onePage_3895_p=TIME &\#39;23\:59\:59&\#39; onePage_3896_h3=Timestamp onePage_3897_p=A timestamp literal. The limitations are the same as for the Java data type java.sql.Timestamp, but for compatibility with other databases the suggested minimum and maximum years are 0001 and 9999. onePage_3898_p=Example\: onePage_3899_p=TIMESTAMP &\#39;2005-12-31 23\:59\:59&\#39; onePage_3900_h3=Value onePage_3901_a=string onePage_3902_a=dollarQuotedString onePage_3903_a=hexNumber onePage_3904_a=int onePage_3905_a=long onePage_3906_a=decimal onePage_3907_a=double onePage_3908_a=date onePage_3909_a=time onePage_3910_a=timestamp onePage_3911_a=boolean onePage_3912_a=bytes onePage_3913_a=array onePage_3914_a=null onePage_3915_p=A value of any data type, or null. onePage_3916_p=Example\: onePage_3917_p=10 onePage_3918_h3=Information Schema onePage_3919_p=\ The system tables in the schema <code>INFORMATION_SCHEMA</code> contain the meta data of all tables in the database as well as the current settings. onePage_3920_th=Table onePage_3921_th=Columns onePage_3922_td=CATALOGS onePage_3923_td=CATALOG_NAME onePage_3924_td=COLLATIONS onePage_3925_td=NAME, KEY onePage_3926_td=COLUMNS onePage_3927_td=TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE, CHARACTER_SET_NAME, COLLATION_NAME, TYPE_NAME, NULLABLE, IS_COMPUTED, SELECTIVITY, CHECK_CONSTRAINT, SEQUENCE_NAME, REMARKS, SOURCE_DATA_TYPE onePage_3928_td=COLUMN_PRIVILEGES onePage_3929_td=GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, PRIVILEGE_TYPE, IS_GRANTABLE onePage_3930_td=CONSTANTS onePage_3931_td=CONSTANT_CATALOG, CONSTANT_SCHEMA, CONSTANT_NAME, DATA_TYPE, REMARKS, SQL, ID onePage_3932_td=CONSTRAINTS onePage_3933_td=CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, UNIQUE_INDEX_NAME, CHECK_EXPRESSION, COLUMN_LIST, REMARKS, SQL, ID onePage_3934_td=CROSS_REFERENCES onePage_3935_td=PKTABLE_CATALOG, PKTABLE_SCHEMA, PKTABLE_NAME, PKCOLUMN_NAME, FKTABLE_CATALOG, FKTABLE_SCHEMA, FKTABLE_NAME, FKCOLUMN_NAME, ORDINAL_POSITION, UPDATE_RULE, DELETE_RULE, FK_NAME, PK_NAME, DEFERRABILITY onePage_3936_td=DOMAINS onePage_3937_td=DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, PRECISION, SCALE, TYPE_NAME, SELECTIVITY, CHECK_CONSTRAINT, REMARKS, SQL, ID onePage_3938_td=FUNCTION_ALIASES onePage_3939_td=ALIAS_CATALOG, ALIAS_SCHEMA, ALIAS_NAME, JAVA_CLASS, JAVA_METHOD, DATA_TYPE, COLUMN_COUNT, RETURNS_RESULT, REMARKS, ID, SOURCE onePage_3940_td=FUNCTION_COLUMNS onePage_3941_td=ALIAS_CATALOG, ALIAS_SCHEMA, ALIAS_NAME, JAVA_CLASS, JAVA_METHOD, COLUMN_COUNT, POS, COLUMN_NAME, DATA_TYPE, TYPE_NAME, PRECISION, SCALE, RADIX, NULLABLE, COLUMN_TYPE, REMARKS, COLUMN_DEFAULT onePage_3942_td=HELP onePage_3943_td=ID, SECTION, TOPIC, SYNTAX, TEXT onePage_3944_td=INDEXES onePage_3945_td=TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, NON_UNIQUE, INDEX_NAME, ORDINAL_POSITION, COLUMN_NAME, CARDINALITY, PRIMARY_KEY, INDEX_TYPE_NAME, IS_GENERATED, INDEX_TYPE, ASC_OR_DESC, PAGES, FILTER_CONDITION, REMARKS, SQL, ID, SORT_TYPE, CONSTRAINT_NAME onePage_3946_td=IN_DOUBT onePage_3947_td=TRANSACTION, STATE onePage_3948_td=LOCKS onePage_3949_td=TABLE_SCHEMA, TABLE_NAME, SESSION_ID, LOCK_TYPE onePage_3950_td=RIGHTS onePage_3951_td=GRANTEE, GRANTEETYPE, GRANTEDROLE, RIGHTS, TABLE_SCHEMA, TABLE_NAME, ID onePage_3952_td=ROLES onePage_3953_td=NAME, REMARKS, ID onePage_3954_td=SCHEMATA onePage_3955_td=CATALOG_NAME, SCHEMA_NAME, SCHEMA_OWNER, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME, IS_DEFAULT, REMARKS, ID onePage_3956_td=SEQUENCES onePage_3957_td=SEQUENCE_CATALOG, SEQUENCE_SCHEMA, SEQUENCE_NAME, CURRENT_VALUE, INCREMENT, IS_GENERATED, REMARKS, CACHE, ID onePage_3958_td=SESSIONS onePage_3959_td=ID, USER_NAME, SESSION_START, STATEMENT, STATEMENT_START onePage_3960_td=SESSION_STATE onePage_3961_td=KEY, SQL onePage_3962_td=SETTINGS onePage_3963_td=NAME, VALUE onePage_3964_td=TABLES onePage_3965_td=TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, STORAGE_TYPE, SQL, REMARKS, LAST_MODIFICATION, ID, TYPE_NAME onePage_3966_td=TABLE_PRIVILEGES onePage_3967_td=GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, PRIVILEGE_TYPE, IS_GRANTABLE onePage_3968_td=TABLE_TYPES onePage_3969_td=TYPE onePage_3970_td=TRIGGERS onePage_3971_td=TRIGGER_CATALOG, TRIGGER_SCHEMA, TRIGGER_NAME, TRIGGER_TYPE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, BEFORE, JAVA_CLASS, QUEUE_SIZE, NO_WAIT, REMARKS, SQL, ID onePage_3972_td=TYPE_INFO onePage_3973_td=TYPE_NAME, DATA_TYPE, PRECISION, PREFIX, SUFFIX, PARAMS, AUTO_INCREMENT, MINIMUM_SCALE, MAXIMUM_SCALE, RADIX, POS, CASE_SENSITIVE, NULLABLE, SEARCHABLE onePage_3974_td=USERS onePage_3975_td=NAME, ADMIN, REMARKS, ID onePage_3976_td=VIEWS onePage_3977_td=TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, VIEW_DEFINITION, CHECK_OPTION, IS_UPDATABLE, STATUS, REMARKS, ID onePage_3978_h3=Range Table onePage_3979_p=\ The range table is a dynamic system table that contains all values from a start to an end value. The table contains one column called X. Both the start and end values are included in the result. The table is used as follows\: onePage_3980_p=Example\: onePage_3981_h1=Functions onePage_3982_h2=Aggregate Functions onePage_3983_a=AVG onePage_3984_a=BOOL_AND onePage_3985_a=BOOL_OR onePage_3986_a=COUNT onePage_3987_a=GROUP_CONCAT onePage_3988_a=MAX onePage_3989_a=MIN onePage_3990_a=SUM onePage_3991_a=SELECTIVITY onePage_3992_a=STDDEV_POP onePage_3993_a=STDDEV_SAMP onePage_3994_a=VAR_POP onePage_3995_a=VAR_SAMP onePage_3996_h2=Numeric Functions onePage_3997_a=ABS onePage_3998_a=ACOS onePage_3999_a=ASIN onePage_4000_a=ATAN onePage_4001_a=COS onePage_4002_a=COT onePage_4003_a=SIN onePage_4004_a=TAN onePage_4005_a=ATAN2 onePage_4006_a=BITAND onePage_4007_a=BITOR onePage_4008_a=BITXOR onePage_4009_a=MOD onePage_4010_a=CEILING onePage_4011_a=DEGREES onePage_4012_a=EXP onePage_4013_a=FLOOR onePage_4014_a=LOG onePage_4015_a=LOG10 onePage_4016_a=RADIANS onePage_4017_a=SQRT onePage_4018_a=PI onePage_4019_a=POWER onePage_4020_a=RAND onePage_4021_a=RANDOM_UUID onePage_4022_a=ROUND onePage_4023_a=ROUNDMAGIC onePage_4024_a=SECURE_RAND onePage_4025_a=SIGN onePage_4026_a=ENCRYPT onePage_4027_a=DECRYPT onePage_4028_a=HASH onePage_4029_a=TRUNCATE onePage_4030_a=COMPRESS onePage_4031_a=EXPAND onePage_4032_a=ZERO onePage_4033_h2=String Functions onePage_4034_a=ASCII onePage_4035_a=BIT_LENGTH onePage_4036_a=LENGTH onePage_4037_a=OCTET_LENGTH onePage_4038_a=CHAR onePage_4039_a=CONCAT onePage_4040_a=DIFFERENCE onePage_4041_a=HEXTORAW onePage_4042_a=RAWTOHEX onePage_4043_a=INSTR onePage_4044_a=INSERT Function onePage_4045_a=LOWER onePage_4046_a=UPPER onePage_4047_a=LEFT onePage_4048_a=RIGHT onePage_4049_a=LOCATE onePage_4050_a=POSITION onePage_4051_a=LPAD onePage_4052_a=RPAD onePage_4053_a=LTRIM onePage_4054_a=RTRIM onePage_4055_a=TRIM onePage_4056_a=REGEXP_REPLACE onePage_4057_a=REPEAT onePage_4058_a=REPLACE onePage_4059_a=SOUNDEX onePage_4060_a=SPACE onePage_4061_a=STRINGDECODE onePage_4062_a=STRINGENCODE onePage_4063_a=STRINGTOUTF8 onePage_4064_a=SUBSTRING onePage_4065_a=UTF8TOSTRING onePage_4066_a=XMLATTR onePage_4067_a=XMLNODE onePage_4068_a=XMLCOMMENT onePage_4069_a=XMLCDATA onePage_4070_a=XMLSTARTDOC onePage_4071_a=XMLTEXT onePage_4072_h2=Time and Date Functions onePage_4073_a=CURRENT_DATE onePage_4074_a=CURRENT_TIME onePage_4075_a=CURRENT_TIMESTAMP onePage_4076_a=DATEADD onePage_4077_a=DATEDIFF onePage_4078_a=DAYNAME onePage_4079_a=DAY_OF_MONTH onePage_4080_a=DAY_OF_WEEK onePage_4081_a=DAY_OF_YEAR onePage_4082_a=EXTRACT onePage_4083_a=FORMATDATETIME onePage_4084_a=HOUR onePage_4085_a=MINUTE onePage_4086_a=MONTH onePage_4087_a=MONTHNAME onePage_4088_a=PARSEDATETIME onePage_4089_a=QUARTER onePage_4090_a=SECOND onePage_4091_a=WEEK onePage_4092_a=YEAR onePage_4093_h2=System Functions onePage_4094_a=ARRAY_GET onePage_4095_a=ARRAY_LENGTH onePage_4096_a=AUTOCOMMIT onePage_4097_a=CANCEL_SESSION onePage_4098_a=CASEWHEN Function onePage_4099_a=CAST onePage_4100_a=COALESCE onePage_4101_a=CONVERT onePage_4102_a=CURRVAL onePage_4103_a=CSVREAD onePage_4104_a=CSVWRITE onePage_4105_a=DATABASE onePage_4106_a=DATABASE_PATH onePage_4107_a=FILE_READ onePage_4108_a=GREATEST onePage_4109_a=IDENTITY onePage_4110_a=IFNULL onePage_4111_a=LEAST onePage_4112_a=LOCK_MODE onePage_4113_a=LOCK_TIMEOUT onePage_4114_a=LINK_SCHEMA onePage_4115_a=MEMORY_FREE onePage_4116_a=MEMORY_USED onePage_4117_a=NEXTVAL onePage_4118_a=NULLIF onePage_4119_a=READONLY onePage_4120_a=ROWNUM onePage_4121_a=SCHEMA onePage_4122_a=SCOPE_IDENTITY onePage_4123_a=SESSION_ID onePage_4124_a=SET onePage_4125_a=TABLE onePage_4126_a=TRANSACTION_ID onePage_4127_a=USER onePage_4128_h3=AVG onePage_4129_a=int onePage_4130_a=long onePage_4131_a=decimal onePage_4132_a=double onePage_4133_p=The average (mean) value. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. The returned value is of the same data type as the parameter. onePage_4134_p=Example\: onePage_4135_p=AVG(X) onePage_4136_h3=BOOL_AND onePage_4137_a=boolean onePage_4138_p=Returns true if all expressions are true. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. onePage_4139_p=Example\: onePage_4140_p=BOOL_AND(ID>10) onePage_4141_h3=BOOL_OR onePage_4142_a=boolean onePage_4143_p=Returns true if any expression is true. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. onePage_4144_p=Example\: onePage_4145_p=BOOL_OR(NAME LIKE &\#39;W%&\#39;) onePage_4146_h3=COUNT onePage_4147_a=expression onePage_4148_p=The count of all row, or of the non-null values. This method returns a long. If no rows are selected, the result is 0. Aggregates are only allowed in select statements. onePage_4149_p=Example\: onePage_4150_p=COUNT(*) onePage_4151_h3=GROUP_CONCAT onePage_4152_a=string onePage_4153_a=expression onePage_4154_a=expression onePage_4155_p=Concatenates strings with a separator. The default separator is a &\#39;,&\#39; (without space). This method returns a string. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. onePage_4156_p=Example\: onePage_4157_p=GROUP_CONCAT(NAME ORDER BY ID SEPARATOR &\#39;, &\#39;) onePage_4158_h3=MAX onePage_4159_a=value onePage_4160_p=The highest value. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. The returned value is of the same data type as the parameter. onePage_4161_p=Example\: onePage_4162_p=MAX(NAME) onePage_4163_h3=MIN onePage_4164_a=value onePage_4165_p=The lowest value. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. The returned value is of the same data type as the parameter. onePage_4166_p=Example\: onePage_4167_p=MIN(NAME) onePage_4168_h3=SUM onePage_4169_a=int onePage_4170_a=long onePage_4171_a=decimal onePage_4172_a=double onePage_4173_p=The sum of all values. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. The returned value is of the same data type as the parameter. onePage_4174_p=Example\: onePage_4175_p=SUM(X) onePage_4176_h3=SELECTIVITY onePage_4177_a=value onePage_4178_p=Estimates the selectivity (0-100) of a value. The value is defined as (100 * distinctCount / rowCount). The selectivity of 0 rows is 0 (unknown). Up to 10000 values are kept in memory. Aggregates are only allowed in select statements. onePage_4179_p=Example\: onePage_4180_p=SELECT SELECTIVITY(FIRSTNAME), SELECTIVITY(NAME) FROM TEST WHERE ROWNUM()<20000 onePage_4181_h3=STDDEV_POP onePage_4182_a=double onePage_4183_p=The population standard deviation. This method returns a double. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. onePage_4184_p=Example\: onePage_4185_p=STDDEV_POP(X) onePage_4186_h3=STDDEV_SAMP onePage_4187_a=double onePage_4188_p=The sample standard deviation. This method returns a double. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. onePage_4189_p=Example\: onePage_4190_p=STDDEV(X) onePage_4191_h3=VAR_POP onePage_4192_a=double onePage_4193_p=The population variance (square of the population standard deviation). This method returns a double. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. onePage_4194_p=Example\: onePage_4195_p=VAR_POP(X) onePage_4196_h3=VAR_SAMP onePage_4197_a=double onePage_4198_p=The sample variance (square of the sample standard deviation). This method returns a double. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. onePage_4199_p=Example\: onePage_4200_p=VAR_SAMP(X) onePage_4201_h3=ABS onePage_4202_a=int onePage_4203_a=long onePage_4204_a=decimal onePage_4205_a=double onePage_4206_p=See also Java Math.abs. Please note that Math.abs(Integer.MIN_VALUE) \=\= Integer.MIN_VALUE and Math.abs(Long.MIN_VALUE) \=\= Long.MIN_VALUE. The returned value is of the same data type as the parameter. onePage_4207_p=Example\: onePage_4208_p=ABS(ID) onePage_4209_h3=ACOS onePage_4210_a=double onePage_4211_p=See also Java Math.* functions. This method returns a double. onePage_4212_p=Example\: onePage_4213_p=ACOS(D) onePage_4214_h3=ASIN onePage_4215_a=double onePage_4216_p=See also Java Math.* functions. This method returns a double. onePage_4217_p=Example\: onePage_4218_p=ASIN(D) onePage_4219_h3=ATAN onePage_4220_a=double onePage_4221_p=See also Java Math.* functions. This method returns a double. onePage_4222_p=Example\: onePage_4223_p=ATAN(D) onePage_4224_h3=COS onePage_4225_a=double onePage_4226_p=See also Java Math.* functions. This method returns a double. onePage_4227_p=Example\: onePage_4228_p=COS(ANGLE) onePage_4229_h3=COT onePage_4230_a=double onePage_4231_p=See also Java Math.* functions. This method returns a double. onePage_4232_p=Example\: onePage_4233_p=COT(ANGLE) onePage_4234_h3=SIN onePage_4235_a=double onePage_4236_p=See also Java Math.* functions. This method returns a double. onePage_4237_p=Example\: onePage_4238_p=SIN(ANGLE) onePage_4239_h3=TAN onePage_4240_a=double onePage_4241_p=See also Java Math.* functions. This method returns a double. onePage_4242_p=Example\: onePage_4243_p=TAN(ANGLE) onePage_4244_h3=ATAN2 onePage_4245_a=double onePage_4246_a=double onePage_4247_p=See also Java Math.atan2. This method returns a double. onePage_4248_p=Example\: onePage_4249_p=ATAN2(X, Y) onePage_4250_h3=BITAND onePage_4251_a=long onePage_4252_a=long onePage_4253_p=The bitwise AND operation. This method returns a long. See also Java operator &. onePage_4254_p=Example\: onePage_4255_p=BITAND(A, B) onePage_4256_h3=BITOR onePage_4257_a=long onePage_4258_a=long onePage_4259_p=The bitwise OR operation. This method returns a long. See also Java operator |. onePage_4260_p=Example\: onePage_4261_p=BITOR(A, B) onePage_4262_h3=BITXOR onePage_4263_a=long onePage_4264_a=long onePage_4265_p=The bitwise XOR operation. This method returns a long. See also Java operator ^. onePage_4266_p=Example\: onePage_4267_p=BITXOR(A, B) onePage_4268_h3=MOD onePage_4269_a=long onePage_4270_a=long onePage_4271_p=The modulo operation. This method returns a long. See also Java operator %. onePage_4272_p=Example\: onePage_4273_p=MOD(A, B) onePage_4274_h3=CEILING onePage_4275_a=double onePage_4276_p=See also Java Math.ceil. This method returns a double. onePage_4277_p=Example\: onePage_4278_p=LOG(A) onePage_4279_h3=DEGREES onePage_4280_a=double onePage_4281_p=See also Java Math.toDegrees. This method returns a double. onePage_4282_p=Example\: onePage_4283_p=DEGREES(A) onePage_4284_h3=EXP onePage_4285_a=double onePage_4286_p=See also Java Math.exp. This method returns a double. onePage_4287_p=Example\: onePage_4288_p=EXP(A) onePage_4289_h3=FLOOR onePage_4290_a=double onePage_4291_p=See also Java Math.floor. This method returns a double. onePage_4292_p=Example\: onePage_4293_p=FLOOR(A) onePage_4294_h3=LOG onePage_4295_a=double onePage_4296_p=See also Java Math.log. This method returns a double. onePage_4297_p=Example\: onePage_4298_p=LOG(A) onePage_4299_h3=LOG10 onePage_4300_a=double onePage_4301_p=See also Java Math.log10 (in Java 5). This method returns a double. onePage_4302_p=Example\: onePage_4303_p=LOG10(A) onePage_4304_h3=RADIANS onePage_4305_a=double onePage_4306_p=See also Java Math.toRadians. This method returns a double. onePage_4307_p=Example\: onePage_4308_p=RADIANS(A) onePage_4309_h3=SQRT onePage_4310_a=double onePage_4311_p=See also Java Math.sqrt. This method returns a double. onePage_4312_p=Example\: onePage_4313_p=SQRT(A) onePage_4314_h3=PI onePage_4315_p=See also Java Math.PI. This method returns a double. onePage_4316_p=Example\: onePage_4317_p=PI() onePage_4318_h3=POWER onePage_4319_a=double onePage_4320_a=double onePage_4321_p=See also Java Math.pow. This method returns a double. onePage_4322_p=Example\: onePage_4323_p=POWER(A, B) onePage_4324_h3=RAND onePage_4325_a=int onePage_4326_p=Calling the function without parameter returns the next a pseudo random number. Calling it with an parameter seeds the session&\#39;s random number generator. This method returns a double. onePage_4327_p=Example\: onePage_4328_p=RAND() onePage_4329_h3=RANDOM_UUID onePage_4330_p=Returns a new UUID with 122 pseudo random bits. onePage_4331_p=Example\: onePage_4332_p=RANDOM_UUID() onePage_4333_h3=ROUND onePage_4334_a=double onePage_4335_a=digitsInt onePage_4336_p=Rounds to a number of digits. This method returns a double. onePage_4337_p=Example\: onePage_4338_p=ROUND(VALUE, 2) onePage_4339_h3=ROUNDMAGIC onePage_4340_a=double onePage_4341_p=This function rounds numbers in a good way, but it is slow. It has a special handling for numbers around 0. Only numbers smaller or equal +/-1000000000000 are supported. The value is converted to a String internally, and then the last last 4 characters are checked. &\#39;000x&\#39; becomes &\#39;0000&\#39; and &\#39;999x&\#39; becomes &\#39;999999&\#39;, which is rounded automatically. This method returns a double. onePage_4342_p=Example\: onePage_4343_p=ROUNDMAGIC(VALUE/3*3) onePage_4344_h3=SECURE_RAND onePage_4345_a=int onePage_4346_p=Generates a number of cryptographically secure random numbers. This method returns bytes. onePage_4347_p=Example\: onePage_4348_p=CALL SECURE_RAND(16) onePage_4349_h3=SIGN onePage_4350_a=int onePage_4351_a=long onePage_4352_a=decimal onePage_4353_a=double onePage_4354_p=Returns -1 if the value is smaller 0, 0 if zero, and otherwise 1. onePage_4355_p=Example\: onePage_4356_p=SIGN(VALUE) onePage_4357_h3=ENCRYPT onePage_4358_a=algorithmString onePage_4359_a=keyBytes onePage_4360_a=dataBytes onePage_4361_p=Encrypts data using a key. Supported algorithms are XTEA and AES. The block size is 16 bytes. This method returns bytes. onePage_4362_p=Example\: onePage_4363_p=CALL ENCRYPT(&\#39;AES&\#39;, &\#39;00&\#39;, STRINGTOUTF8(&\#39;Test&\#39;)) onePage_4364_h3=DECRYPT onePage_4365_a=algorithmString onePage_4366_a=keyBytes onePage_4367_a=dataBytes onePage_4368_p=Decrypts data using a key. Supported algorithms are XTEA and AES. The block size is 16 bytes. This method returns bytes. onePage_4369_p=Example\: onePage_4370_p=CALL TRIM(CHAR(0) FROM UTF8TOSTRING( onePage_4371_p= DECRYPT(&\#39;AES&\#39;, &\#39;00&\#39;, &\#39;3fabb4de8f1ee2e97d7793bab2db1116&\#39;))) onePage_4372_h3=HASH onePage_4373_a=algorithmString onePage_4374_a=dataBytes onePage_4375_a=iterationInt onePage_4376_p=Calculate the hash value using an algorithm, and repeat this process for a number of iterations. Currently, the only algorithm supported is SHA256. This method returns bytes. onePage_4377_p=Example\: onePage_4378_p=CALL HASH(&\#39;SHA256&\#39;, STRINGTOUTF8(&\#39;Password&\#39;), 1000) onePage_4379_h3=TRUNCATE onePage_4380_a=double onePage_4381_a=digitsInt onePage_4382_p=Truncates to a number of digits (to the next value closer to 0). This method returns a double. onePage_4383_p=Example\: onePage_4384_p=TRUNCATE(VALUE, 2) onePage_4385_h3=COMPRESS onePage_4386_a=dataBytes onePage_4387_a=algorithmString onePage_4388_p=Compresses the data using the specified compression algorithm. Supported algorithms are\: LZF (faster but lower compression; default), and DEFLATE (higher compression). Compression does not always reduce size. Very small objects and objects with little redundancy may get larger. This method returns bytes. onePage_4389_p=Example\: onePage_4390_p=COMPRESS(STRINGTOUTF8(&\#39;Test&\#39;)) onePage_4391_h3=EXPAND onePage_4392_a=bytes onePage_4393_p=Expands data that was compressed using the COMPRESS function. This method returns bytes. onePage_4394_p=Example\: onePage_4395_p=UTF8TOSTRING(EXPAND(COMPRESS(STRINGTOUTF8(&\#39;Test&\#39;)))) onePage_4396_h3=ZERO onePage_4397_p=Returns the value 0. This function can be used even if numeric literals are disabled. onePage_4398_p=Example\: onePage_4399_p=ZERO() onePage_4400_h3=ASCII onePage_4401_a=string onePage_4402_p=Returns the ASCII value of the first character in the string. This method returns an int. onePage_4403_p=Example\: onePage_4404_p=ASCII(&\#39;Hi&\#39;) onePage_4405_h3=BIT_LENGTH onePage_4406_a=string onePage_4407_p=Returns the number of bits in a string. This method returns a long. For BLOB, CLOB, BYTES and JAVA_OBJECT, the precision is used. Each character needs 16 bits. onePage_4408_p=Example\: onePage_4409_p=BIT_LENGTH(NAME) onePage_4410_h3=LENGTH onePage_4411_a=string onePage_4412_p=Returns the number of characters in a string. This method returns a long. For BLOB, CLOB, BYTES and JAVA_OBJECT, the precision is used. onePage_4413_p=Example\: onePage_4414_p=LENGTH(NAME) onePage_4415_h3=OCTET_LENGTH onePage_4416_a=string onePage_4417_p=Returns the number of bytes in a string. This method returns a long. For BLOB, CLOB, BYTES and JAVA_OBJECT, the precision is used. Each character needs 2 bytes. onePage_4418_p=Example\: onePage_4419_p=OCTET_LENGTH(NAME) onePage_4420_h3=CHAR onePage_4421_a=int onePage_4422_p=Returns the character that represents the ASCII value. This method returns a string. onePage_4423_p=Example\: onePage_4424_p=CHAR(65) onePage_4425_h3=CONCAT onePage_4426_a=string onePage_4427_a=string onePage_4428_p=Combines strings. This method returns a string. onePage_4429_p=Example\: onePage_4430_p=CONCAT(NAME, &\#39;\!&\#39;) onePage_4431_h3=DIFFERENCE onePage_4432_a=string onePage_4433_a=string onePage_4434_p=Returns the difference between the sounds of two strings. This method returns an int. onePage_4435_p=Example\: onePage_4436_p=DIFFERENCE(T1.NAME, T2.NAME) onePage_4437_h3=HEXTORAW onePage_4438_a=string onePage_4439_p=Converts a hex representation of a string to a string. 4 hex characters per string character are used. onePage_4440_p=Example\: onePage_4441_p=HEXTORAW(DATA) onePage_4442_h3=RAWTOHEX onePage_4443_a=string onePage_4444_p=Converts a string to the hex representation. 4 hex characters per string character are used. This method returns a string. onePage_4445_p=Example\: onePage_4446_p=RAWTOHEX(DATA) onePage_4447_h3=INSTR onePage_4448_a=string onePage_4449_a=searchString onePage_4450_a=startInt onePage_4451_p=Returns the location of a search string in a string (s). If a start position is used, the characters before it are ignored. If position is negative, the rightmost location is returned. 0 is returned if the search string is not found. onePage_4452_p=Example\: onePage_4453_p=INSTR(EMAIL,&\#39;@&\#39;) onePage_4454_h3=INSERT Function onePage_4455_a=originalString onePage_4456_a=startInt onePage_4457_a=lengthInt onePage_4458_a=addString onePage_4459_p=Inserts a additional string into the original string at a specified start position. The length specifies the number of characters that are removed at the start position in the original string. This method returns a string. onePage_4460_p=Example\: onePage_4461_p=INSERT(NAME, 1, 1, &\#39; &\#39;) onePage_4462_h3=LOWER onePage_4463_a=string onePage_4464_p=Converts a string to lowercase. onePage_4465_p=Example\: onePage_4466_p=LOWER(NAME) onePage_4467_h3=UPPER onePage_4468_a=string onePage_4469_p=Converts a string to uppercase. onePage_4470_p=Example\: onePage_4471_p=UPPER(NAME) onePage_4472_h3=LEFT onePage_4473_a=string onePage_4474_a=int onePage_4475_p=Returns the leftmost number of characters. onePage_4476_p=Example\: onePage_4477_p=LEFT(NAME, 3) onePage_4478_h3=RIGHT onePage_4479_a=string onePage_4480_a=int onePage_4481_p=Returns the rightmost number of characters. onePage_4482_p=Example\: onePage_4483_p=RIGHT(NAME, 3) onePage_4484_h3=LOCATE onePage_4485_a=searchString onePage_4486_a=string onePage_4487_a=startInt onePage_4488_p=Returns the location of a search string in a string. If a start position is used, the characters before it are ignored. If position is negative, the rightmost location is returned. 0 is returned if the search string is not found. onePage_4489_p=Example\: onePage_4490_p=LOCATE(&\#39;.&\#39;, NAME) onePage_4491_h3=POSITION onePage_4492_a=searchString onePage_4493_a=string onePage_4494_p=Returns the location of a search string in a string. See also LOCATE. onePage_4495_p=Example\: onePage_4496_p=POSITION(&\#39;.&\#39;, NAME) onePage_4497_h3=LPAD onePage_4498_a=string onePage_4499_a=int onePage_4500_a=paddingString onePage_4501_p=Left pad the string to the specified length. If the length is shorter than the string, it will be truncated at the end. If the padding string is not set, spaces will be used. onePage_4502_p=Example\: onePage_4503_p=LPAD(AMOUNT, 10, &\#39;*&\#39;) onePage_4504_h3=RPAD onePage_4505_a=string onePage_4506_a=int onePage_4507_a=paddingString onePage_4508_p=Right pad the string to the specified length. If the length is shorter than the string, it will be truncated. If the padding string is not set, spaces will be used. onePage_4509_p=Example\: onePage_4510_p=RPAD(TEXT, 10, &\#39;-&\#39;) onePage_4511_h3=LTRIM onePage_4512_a=string onePage_4513_p=Removes all leading spaces from a string. onePage_4514_p=Example\: onePage_4515_p=LTRIM(NAME) onePage_4516_h3=RTRIM onePage_4517_a=string onePage_4518_p=Removes all trailing spaces from a string. onePage_4519_p=Example\: onePage_4520_p=RTRIM(NAME) onePage_4521_h3=TRIM onePage_4522_a=string onePage_4523_a=string onePage_4524_p=Removes all leading spaces, trailing spaces, or spaces at both ends, from a string. Other characters can be removed as well. onePage_4525_p=Example\: onePage_4526_p=TRIM(BOTH &\#39;_&\#39; FROM NAME) onePage_4527_h3=REGEXP_REPLACE onePage_4528_a=inputString onePage_4529_a=regexString onePage_4530_a=replacementString onePage_4531_p=Replaces each substring that matches a regular expression. For details, see the Java String.replaceAll() method. onePage_4532_p=Example\: onePage_4533_p=REGEXP_REPLACE(&\#39;Hello World&\#39;, &\#39; +&\#39;, &\#39; &\#39;) onePage_4534_h3=REPEAT onePage_4535_a=string onePage_4536_a=int onePage_4537_p=Returns a string repeated some number of times. onePage_4538_p=Example\: onePage_4539_p=REPEAT(NAME || &\#39; &\#39;, 10) onePage_4540_h3=REPLACE onePage_4541_a=string onePage_4542_a=searchString onePage_4543_a=replacementString onePage_4544_p=Replaces all occurrences of a search string in a text with another string. If no replacement is specified, the search string is removed from the original string. onePage_4545_p=Example\: onePage_4546_p=REPLACE(NAME, &\#39; &\#39;) onePage_4547_h3=SOUNDEX onePage_4548_a=string onePage_4549_p=Returns a four character code representing the sound of a string. See also http\://www.archives.gov/genealogy/census/soundex.html . This method returns a string. onePage_4550_p=Example\: onePage_4551_p=SOUNDEX(NAME) onePage_4552_h3=SPACE onePage_4553_a=int onePage_4554_p=Returns a string consisting of a number of spaces. onePage_4555_p=Example\: onePage_4556_p=SPACE(80) onePage_4557_h3=STRINGDECODE onePage_4558_a=string onePage_4559_p=Converts a encoded string using the Java string literal encoding format. Special characters are \\b, \\t, \\n, \\f, \\r, \\", \\\\, \\<octal>, \\u<unicode>. This method returns a string. onePage_4560_p=Example\: onePage_4561_p=CALL STRINGENCODE(STRINGDECODE(&\#39;Lines 1\\nLine 2&\#39;)) onePage_4562_h3=STRINGENCODE onePage_4563_a=string onePage_4564_p=Encodes special characters in a string using the Java string literal encoding format. Special characters are \\b, \\t, \\n, \\f, \\r, \\", \\\\, \\<octal>, \\u<unicode>. This method returns a string. onePage_4565_p=Example\: onePage_4566_p=CALL STRINGENCODE(STRINGDECODE(&\#39;Lines 1\\nLine 2&\#39;)) onePage_4567_h3=STRINGTOUTF8 onePage_4568_a=string onePage_4569_p=Encodes a string to a byte array using the UTF8 encoding format. This method returns bytes. onePage_4570_p=Example\: onePage_4571_p=CALL UTF8TOSTRING(STRINGTOUTF8(&\#39;This is a test&\#39;)) onePage_4572_h3=SUBSTRING onePage_4573_a=string onePage_4574_a=startInt onePage_4575_a=lengthInt onePage_4576_p=Returns a substring of a string starting at a position. The length is optional. Also supported is\: SUBSTRING(string FROM start [FOR length]). onePage_4577_p=Example\: onePage_4578_p=SUBSTR(NAME, 1) onePage_4579_h3=UTF8TOSTRING onePage_4580_a=bytes onePage_4581_p=Decodes a byte array in the UTF8 format to a string. onePage_4582_p=Example\: onePage_4583_p=CALL UTF8TOSTRING(STRINGTOUTF8(&\#39;This is a test&\#39;)) onePage_4584_h3=XMLATTR onePage_4585_a=nameString onePage_4586_a=valueString onePage_4587_p=Creates an XML attribute element of the form name\="value". The value is encoded as XML text. This method returns a string. onePage_4588_p=Example\: onePage_4589_p=CALL XMLNODE(&\#39;a&\#39;, XMLATTR(&\#39;href&\#39;, &\#39;http\://h2database.com&\#39;)) onePage_4590_h3=XMLNODE onePage_4591_a=elementString onePage_4592_a=attributesString onePage_4593_a=contentString onePage_4594_p=Create an XML node element. This method returns a string. onePage_4595_p=Example\: onePage_4596_p=CALL XMLNODE(&\#39;a&\#39;, XMLATTR(&\#39;href&\#39;, &\#39;http\://h2database.com&\#39;), &\#39;H2&\#39;) onePage_4597_h3=XMLCOMMENT onePage_4598_a=commentString onePage_4599_p=Creates an XML comment. Two dashes (--) are converted to - -. This method returns a string. onePage_4600_p=Example\: onePage_4601_p=CALL XMLCOMMENT(&\#39;Test&\#39;) onePage_4602_h3=XMLCDATA onePage_4603_a=valueString onePage_4604_p=Creates an XML CDATA element. If the value contains &\#39;]]>&\#39;, an XML text element is created instead. This method returns a string. onePage_4605_p=Example\: onePage_4606_p=CALL XMLCDATA(&\#39;data&\#39;) onePage_4607_h3=XMLSTARTDOC onePage_4608_p=The string &\#39;<?xml version\="1.0"?>&\#39; is returned. onePage_4609_p=Example\: onePage_4610_p=CALL XMLSTARTDOC() onePage_4611_h3=XMLTEXT onePage_4612_a=valueString onePage_4613_p=Creates an XML text element. This method returns a string. onePage_4614_p=Example\: onePage_4615_p=CALL XMLTEXT(&\#39;test&\#39;) onePage_4616_h3=ARRAY_GET onePage_4617_a=arrayExpression onePage_4618_a=indexExpression onePage_4619_p=Returns one element of an array. This method returns a string. onePage_4620_p=Example\: onePage_4621_p=CALL ARRAY_GET((&\#39;Hello&\#39;, &\#39;World&\#39;), 2) onePage_4622_h3=ARRAY_LENGTH onePage_4623_a=arrayExpression onePage_4624_p=Returns the length of an array. onePage_4625_p=Example\: onePage_4626_p=CALL ARRAY_LENGTH((&\#39;Hello&\#39;, &\#39;World&\#39;)) onePage_4627_h3=AUTOCOMMIT onePage_4628_p=Returns true if auto commit is switched on for this session. onePage_4629_p=Example\: onePage_4630_p=AUTOCOMMIT() onePage_4631_h3=CANCEL_SESSION onePage_4632_a=sessionInt onePage_4633_p=Cancels the currently executing statement of another session. The method only works if the multithreaded kernel is enabled (see SET MULTI_THREADED). Returns true if the statement was canceled, false if the session is closed or no statement is currently executing. onePage_4634_p=Admin rights are required to execute this command. onePage_4635_p=Example\: onePage_4636_p=CANCEL_SESSION(3) onePage_4637_h3=CASEWHEN Function onePage_4638_a=boolean onePage_4639_a=aValue onePage_4640_a=bValue onePage_4641_p=Returns &\#39;a&\#39; if the boolean expression is true, otherwise &\#39;b&\#39;. Returns the same data type as the parameter. onePage_4642_p=Example\: onePage_4643_p=CASEWHEN(ID\=1, &\#39;A&\#39;, &\#39;B&\#39;) onePage_4644_h3=CAST onePage_4645_a=value onePage_4646_a=dataType onePage_4647_p=Converts a value to another data type. When converting a text to a number, the default Java conversion rules are used (prefixes 0x or \# for hexadecimal numbers, prefix 0 for octal numbers). onePage_4648_p=Example\: onePage_4649_p=CAST(NAME AS INT) onePage_4650_h3=COALESCE onePage_4651_a=aValue onePage_4652_a=bValue onePage_4653_p=Returns the first value that is not null. onePage_4654_p=Example\: onePage_4655_p=COALESCE(A, B, C) onePage_4656_h3=CONVERT onePage_4657_a=value onePage_4658_a=dataType onePage_4659_p=Converts a value to another data type. onePage_4660_p=Example\: onePage_4661_p=CONVERT(NAME, INT) onePage_4662_h3=CURRVAL onePage_4663_a=schemaName onePage_4664_a=sequenceString onePage_4665_p=Returns the current (last) value of the sequence, independent of the session. If the sequence was just created, the method returns (start - interval). If the schema name is not set, the current schema is used. If the schema name is not set, the sequence name is converted to uppercase (for compatibility). This method returns a long. onePage_4666_p=Example\: onePage_4667_p=CURRVAL(&\#39;TEST_SEQ&\#39;) onePage_4668_h3=CSVREAD onePage_4669_a=fileNameString onePage_4670_a=columnsString onePage_4671_a=csvOptions onePage_4672_p=Returns the result set of reading the CSV (comma separated values) file. For each parameter, NULL means the default value should be used. onePage_4673_p=If the column names are specified (a list of column names separated with the fieldSeparator), those are used, otherwise (or if they are set to NULL) the first line of the file is interpreted as the column names. In that case, column names that contain no special characters (only letters, &\#39;_&\#39;, and digits; similar to the rule for Java identifiers) are considered case insensitive. Other column names are case sensitive, that means you need to use quoted identifiers (see below). onePage_4674_p=The default charset is the default value for this system, and the default field separator is a comma. Missing unquoted values as well as data that matches nullString is parsed as NULL. All columns of type VARCHAR. onePage_4675_p=This function can be used like a table\: SELECT * FROM CSVREAD(...). Instead of a file, an URL may be used, for example jar\:file\:///c\:/temp/example.zip\!/org/example/nested.zip. onePage_4676_p=Admin rights are required to execute this command. onePage_4677_p=Example\: onePage_4678_p=CALL CSVREAD(&\#39;test.csv&\#39;); onePage_4679_p=-- Read a file containing the columns ID, NAME with onePage_4680_p=-- UTF-8 encoding and the pipe (|) as field separator onePage_4681_p=CALL CSVREAD(&\#39;test2.csv&\#39;, &\#39;ID|NAME&\#39;, &\#39;UTF-8&\#39;, &\#39;|&\#39;); onePage_4682_p=-- Read a semicolon-separated file onePage_4683_p=SELECT * FROM CSVREAD(&\#39;data/test.csv&\#39;, NULL, NULL, &\#39;;&\#39;); onePage_4684_p=SELECT "Last Name" FROM CSVREAD(&\#39;address.csv&\#39;); onePage_4685_h3=CSVWRITE onePage_4686_a=fileNameString onePage_4687_a=queryString onePage_4688_a=csvOptions onePage_4689_a=lineSepString onePage_4690_p=Writes a CSV (comma separated values). The file is overwritten if it exists. If only a file name is specified, it will be written to the current working directory. For each parameter, NULL means the default value should be used. The default charset is the default value for this system, and the default field separator is a comma. onePage_4691_p=The values are converted to text using the default string representation; if another conversion is required you need to change the select statement accordingly. The parameter nullString is used when writing NULL (by default nothing is written when NULL appears). The default line separator is the default value for this system (&\#39;line.separator&\#39; system property). onePage_4692_p=The returned value is the number or rows written. Admin rights are required to execute this command. onePage_4693_p=Example\: onePage_4694_p=CALL CSVWRITE(&\#39;test.csv&\#39;, &\#39;SELECT * FROM TEST&\#39;); onePage_4695_p=-- Write a file with UTF-8 encoding and the pipe (|) as field separator onePage_4696_p=CALL CSVWRITE(&\#39;test2.csv&\#39;, &\#39;SELECT * FROM TEST&\#39;, &\#39;UTF-8&\#39;, &\#39;|&\#39;); onePage_4697_h3=DATABASE onePage_4698_p=Returns the name of the database. onePage_4699_p=Example\: onePage_4700_p=CALL DATABASE(); onePage_4701_h3=DATABASE_PATH onePage_4702_p=Returns the directory of the database files and the database name, if it is file based. Returns NULL otherwise. onePage_4703_p=Example\: onePage_4704_p=CALL DATABASE_PATH(); onePage_4705_h3=FILE_READ onePage_4706_a=fileNameString onePage_4707_a=encodingString onePage_4708_p=Returns the contents of a file. If only one parameter is supplied, the data are returned as a BLOB. If two parameters are used, the data is returned as a CLOB (text). The second parameter is the character set to use, NULL meaning the default character set for this system. File names and URLs are supported. Admin rights are required to execute this command. onePage_4709_p=Example\: onePage_4710_p=SELECT LENGTH(FILE_READ(&\#39;~/.h2.server.properties&\#39;)) LEN; onePage_4711_p=SELECT FILE_READ(&\#39;http\://localhost\:8182/stylesheet.css&\#39;, NULL) CSS; onePage_4712_h3=GREATEST onePage_4713_a=aValue onePage_4714_a=bValue onePage_4715_p=Returns the largest value that is not NULL, or NULL if all values are NULL. onePage_4716_p=Example\: onePage_4717_p=CALL GREATEST(1, 2, 3); onePage_4718_h3=IDENTITY onePage_4719_p=Returns the last inserted identity value for this session. This value changes whenever a new sequence number was generated, even within a trigger or Java function. See also SCOPE_IDENTITY(). This method returns a long. onePage_4720_p=Example\: onePage_4721_p=CALL IDENTITY(); onePage_4722_h3=IFNULL onePage_4723_a=aValue onePage_4724_a=bValue onePage_4725_p=Returns the value of &\#39;a&\#39; if it is not null, otherwise &\#39;b&\#39;. onePage_4726_p=Example\: onePage_4727_p=CALL IFNULL(NULL, &\#39;&\#39;); onePage_4728_h3=LEAST onePage_4729_a=aValue onePage_4730_a=bValue onePage_4731_p=Returns the smallest value that is not NULL, or NULL if all values are NULL. onePage_4732_p=Example\: onePage_4733_p=CALL LEAST(1, 2, 3); onePage_4734_h3=LOCK_MODE onePage_4735_p=Returns the current lock mode. See SET LOCK_MODE. This method returns an int. onePage_4736_p=Example\: onePage_4737_p=CALL LOCK_MODE(); onePage_4738_h3=LOCK_TIMEOUT onePage_4739_p=Returns the lock timeout of the current session (in milliseconds). onePage_4740_p=Example\: onePage_4741_p=LOCK_TIMEOUT() onePage_4742_h3=LINK_SCHEMA onePage_4743_a=targetSchemaString onePage_4744_a=driverString onePage_4745_a=urlString onePage_4746_a=userString onePage_4747_a=passwordString onePage_4748_a=sourceSchemaString onePage_4749_p=Creates table links for all tables in a schema. If tables with the same name already exist, they are dropped first. The target schema is created automatically if it does not yet exist. The driver name may be empty if the driver is already loaded. The list of tables linked is returned in the form of a result set. Admin rights are required to execute this command. onePage_4750_p=Example\: onePage_4751_p=CALL LINK_SCHEMA(&\#39;TEST2&\#39;, &\#39;&\#39;, &\#39;jdbc\:h2\:test2&\#39;, &\#39;sa&\#39;, &\#39;sa&\#39;, &\#39;PUBLIC&\#39;); onePage_4752_h3=MEMORY_FREE onePage_4753_p=Returns the free memory in KB (where 1024 bytes is a KB). This method returns an int. The garbage is run before returning the value. Admin rights are required to execute this command. onePage_4754_p=Example\: onePage_4755_p=MEMORY_FREE() onePage_4756_h3=MEMORY_USED onePage_4757_p=Returns the used memory in KB (where 1024 bytes is a KB). This method returns an int. The garbage is run before returning the value. Admin rights are required to execute this command. onePage_4758_p=Example\: onePage_4759_p=MEMORY_USED() onePage_4760_h3=NEXTVAL onePage_4761_a=schemaName onePage_4762_a=sequenceString onePage_4763_p=Returns the next value of the sequence. Used values are never re-used, even when the transaction is rolled back. If the schema name is not set, the current schema is used, and the sequence name is converted to uppercase (for compatibility). This method returns a long. onePage_4764_p=Example\: onePage_4765_p=NEXTVAL(&\#39;TEST_SEQ&\#39;) onePage_4766_h3=NULLIF onePage_4767_a=aValue onePage_4768_a=bValue onePage_4769_p=Returns NULL if &\#39;a&\#39; is equals to &\#39;b&\#39;, otherwise &\#39;a&\#39;. onePage_4770_p=Example\: onePage_4771_p=NULLIF(A, B) onePage_4772_h3=READONLY onePage_4773_p=Returns true if the database is read-only. onePage_4774_p=Example\: onePage_4775_p=READONLY() onePage_4776_h3=ROWNUM onePage_4777_p=Returns the number of the current row. This method returns an int. This function is supported for SELECT statements, as well as for DELETE and UPDATE. The first row has the row number 1, and is calculated before ordering and grouping the result set. To get the row number after ordering and grouping, use a subquery. onePage_4778_p=Example\: onePage_4779_p=SELECT ROWNUM(), * FROM TEST; onePage_4780_p=SELECT ROWNUM(), * FROM (SELECT * FROM TEST ORDER BY NAME); onePage_4781_h3=SCHEMA onePage_4782_p=Returns the name of the default schema for this session. onePage_4783_p=Example\: onePage_4784_p=CALL SCHEMA() onePage_4785_h3=SCOPE_IDENTITY onePage_4786_p=Returns the last inserted identity value for this session for the current scope. Changes within triggers and Java functions are ignored. See also IDENTITY(). This method returns a long. onePage_4787_p=Example\: onePage_4788_p=CALL SCOPE_IDENTITY(); onePage_4789_h3=SESSION_ID onePage_4790_p=Returns the unique session id number for the current database connection. This id stays the same while the connection is open. This method returns an int. The database engine may re-use a session id after the connection is closed. onePage_4791_p=Example\: onePage_4792_p=CALL SESSION_ID() onePage_4793_h3=SET onePage_4794_a=@variableName onePage_4795_a=value onePage_4796_p=Updates a variable with the given value. The new value is returned. When used in a query, the value is updated in the order the rows are read. onePage_4797_p=Example\: onePage_4798_p=SELECT X, SET(@I, IFNULL(@I, 0)+X) RUNNING_TOTAL FROM SYSTEM_RANGE(1, 10) onePage_4799_h3=TABLE onePage_4800_a=name onePage_4801_a=dataType onePage_4802_a=expression onePage_4803_p=Returns the result set. TABLE_DISTINCT removes duplicate rows. onePage_4804_p=Example\: onePage_4805_p=SELECT * FROM TABLE(ID INT\=(1, 2), NAME VARCHAR\=(&\#39;Hello&\#39;, &\#39;World&\#39;)) onePage_4806_h3=TRANSACTION_ID onePage_4807_p=Returns the current transaction id for this session. This method returns NULL if there is no uncommitted change, or if the the database is not persisted. Otherwise a value of the following form is returned\: logFileId-position-sessionId. This method returns a string. The value is unique across database restarts (values are not re-used). onePage_4808_p=Example\: onePage_4809_p=CALL TRANSACTION_ID() onePage_4810_h3=USER onePage_4811_p=Returns the name of the current user of this session. onePage_4812_p=Example\: onePage_4813_p=CURRENT_USER() onePage_4814_h3=CURRENT_DATE onePage_4815_p=Returns the current date. onePage_4816_p=Example\: onePage_4817_p=CURRENT_DATE() onePage_4818_h3=CURRENT_TIME onePage_4819_p=Returns the current time. onePage_4820_p=Example\: onePage_4821_p=CURRENT_TIME() onePage_4822_h3=CURRENT_TIMESTAMP onePage_4823_a=int onePage_4824_a=int onePage_4825_p=Returns the current timestamp. The precision parameter for nanoseconds precision is optional. onePage_4826_p=Example\: onePage_4827_p=CURRENT_TIMESTAMP() onePage_4828_h3=DATEADD onePage_4829_a=unitString onePage_4830_a=addInt onePage_4831_a=timestamp onePage_4832_p=Adds units to a timestamp. The string indicates the unit. Use negative values to subtract units. The same units as in the EXTRACT function are supported. This method returns a timestamp. onePage_4833_p=Example\: onePage_4834_p=DATEADD(&\#39;MONTH&\#39;, 1, DATE &\#39;2001-01-31&\#39;) onePage_4835_h3=DATEDIFF onePage_4836_a=unitString onePage_4837_a=aTimestamp onePage_4838_a=bTimestamp onePage_4839_p=Returns the difference between two timestamps. This method returns a long. The string indicates the unit. The same units as in the EXTRACT function are supported. onePage_4840_p=Example\: onePage_4841_p=DATEDIFF(&\#39;YEAR&\#39;, T1.CREATED, T2.CREATED) onePage_4842_h3=DAYNAME onePage_4843_a=date onePage_4844_p=Returns the name of the day (in English). onePage_4845_p=Example\: onePage_4846_p=DAYNAME(CREATED) onePage_4847_h3=DAY_OF_MONTH onePage_4848_a=date onePage_4849_p=Returns the day of the month (1-31). onePage_4850_p=Example\: onePage_4851_p=DAY_OF_MONTH(CREATED) onePage_4852_h3=DAY_OF_WEEK onePage_4853_a=date onePage_4854_p=Returns the day of the week (1 means Sunday). onePage_4855_p=Example\: onePage_4856_p=DAY_OF_WEEK(CREATED) onePage_4857_h3=DAY_OF_YEAR onePage_4858_a=date onePage_4859_p=Returns the day of the year (1-366). onePage_4860_p=Example\: onePage_4861_p=DAY_OF_YEAR(CREATED) onePage_4862_h3=EXTRACT onePage_4863_a=timestamp onePage_4864_p=Returns a specific value from a timestamps. This method returns an int. onePage_4865_p=Example\: onePage_4866_p=EXTRACT(SECOND FROM CURRENT_TIMESTAMP) onePage_4867_h3=FORMATDATETIME onePage_4868_a=timestamp onePage_4869_a=formatString onePage_4870_a=localeString onePage_4871_a=timeZoneString onePage_4872_p=Formats a date, time or timestamp as a string. The most important format characters are\: y year, M month, d day, H hour, m minute, s second. For details of the format, see java.text.SimpleDateFormat. This method returns a string. onePage_4873_p=Example\: onePage_4874_p=CALL FORMATDATETIME(TIMESTAMP &\#39;2001-02-03 04\:05\:06&\#39;, onePage_4875_p= &\#39;EEE, d MMM yyyy HH\:mm\:ss z&\#39;, &\#39;en&\#39;, &\#39;GMT&\#39;) onePage_4876_h3=HOUR onePage_4877_a=timestamp onePage_4878_p=Returns the hour (0-23) from a timestamp. onePage_4879_p=Example\: onePage_4880_p=HOUR(CREATED) onePage_4881_h3=MINUTE onePage_4882_a=timestamp onePage_4883_p=Returns the minute (0-59) from a timestamp. onePage_4884_p=Example\: onePage_4885_p=MINUTE(CREATED) onePage_4886_h3=MONTH onePage_4887_a=timestamp onePage_4888_p=Returns the month (1-12) from a timestamp. onePage_4889_p=Example\: onePage_4890_p=MONTH(CREATED) onePage_4891_h3=MONTHNAME onePage_4892_a=date onePage_4893_p=Returns the name of the month (in English). onePage_4894_p=Example\: onePage_4895_p=MONTHNAME(CREATED) onePage_4896_h3=PARSEDATETIME onePage_4897_a=string onePage_4898_a=formatString onePage_4899_a=localeString onePage_4900_a=timeZoneString onePage_4901_p=Parses a string and returns a timestamp. The most important format characters are\: y year, M month, d day, H hour, m minute, s second. For details of the format, see java.text.SimpleDateFormat. onePage_4902_p=Example\: onePage_4903_p=CALL PARSEDATETIME(&\#39;Sat, 3 Feb 2001 03\:05\:06 GMT&\#39;, onePage_4904_p= &\#39;EEE, d MMM yyyy HH\:mm\:ss z&\#39;, &\#39;en&\#39;, &\#39;GMT&\#39;) onePage_4905_h3=QUARTER onePage_4906_a=timestamp onePage_4907_p=Returns the quarter (1-4) from a timestamp. onePage_4908_p=Example\: onePage_4909_p=QUARTER(CREATED) onePage_4910_h3=SECOND onePage_4911_a=timestamp onePage_4912_p=Returns the second (0-59) from a timestamp. onePage_4913_p=Example\: onePage_4914_p=SECOND(CREATED) onePage_4915_h3=WEEK onePage_4916_a=timestamp onePage_4917_p=Returns the week (1-53) from a timestamp. This method uses the current system locale. onePage_4918_p=Example\: onePage_4919_p=WEEK(CREATED) onePage_4920_h3=YEAR onePage_4921_a=timestamp onePage_4922_p=Returns the year from a timestamp. onePage_4923_p=Example\: onePage_4924_p=YEAR(CREATED) onePage_4925_h1=Data Types onePage_4926_a=INT Type onePage_4927_a=BOOLEAN Type onePage_4928_a=TINYINT Type onePage_4929_a=SMALLINT Type onePage_4930_a=BIGINT Type onePage_4931_a=IDENTITY Type onePage_4932_a=DECIMAL Type onePage_4933_a=DOUBLE Type onePage_4934_a=REAL Type onePage_4935_a=TIME Type onePage_4936_a=DATE Type onePage_4937_a=TIMESTAMP Type onePage_4938_a=BINARY Type onePage_4939_a=OTHER Type onePage_4940_a=VARCHAR Type onePage_4941_a=VARCHAR_IGNORECASE Type onePage_4942_a=CHAR Type onePage_4943_a=BLOB Type onePage_4944_a=CLOB Type onePage_4945_a=UUID Type onePage_4946_a=ARRAY Type onePage_4947_h3=INT Type onePage_4948_p=Possible values\: -2147483648 to 2147483647. onePage_4949_p=Mapped to java.lang.Integer. onePage_4950_p=Example\: onePage_4951_p=INT onePage_4952_h3=BOOLEAN Type onePage_4953_p=Possible values\: TRUE and FALSE. onePage_4954_p=Mapped to java.lang.Boolean. onePage_4955_p=Example\: onePage_4956_p=BOOLEAN onePage_4957_h3=TINYINT Type onePage_4958_p=Possible values are\: -128 to 127. onePage_4959_p=Mapped to java.lang.Byte. onePage_4960_p=Example\: onePage_4961_p=TINYINT onePage_4962_h3=SMALLINT Type onePage_4963_p=Possible values\: -32768 to 32767. onePage_4964_p=Mapped to java.lang.Short. onePage_4965_p=Example\: onePage_4966_p=SMALLINT onePage_4967_h3=BIGINT Type onePage_4968_p=Possible values\: -9223372036854775808 to 9223372036854775807. onePage_4969_p=Mapped to java.lang.Long. onePage_4970_p=Example\: onePage_4971_p=BIGINT onePage_4972_h3=IDENTITY Type onePage_4973_p=Auto-Increment value. Possible values\: -9223372036854775808 to 9223372036854775807. Used values are never re-used, even when the transaction is rolled back. onePage_4974_p=Mapped to java.lang.Long. onePage_4975_p=Example\: onePage_4976_p=IDENTITY onePage_4977_h3=DECIMAL Type onePage_4978_a=precisionInt onePage_4979_a=scaleInt onePage_4980_p=Data type with fixed precision and scale. This data type is recommended for storing currency values. onePage_4981_p=Mapped to java.math.BigDecimal. onePage_4982_p=Example\: onePage_4983_p=DECIMAL(20, 2) onePage_4984_h3=DOUBLE Type onePage_4985_p=Floating point number. Should not be used to represent currency values, because of rounding problems. onePage_4986_p=Mapped to java.lang.Double. onePage_4987_p=Example\: onePage_4988_p=DOUBLE onePage_4989_h3=REAL Type onePage_4990_p=Single precision floating point number. Should not be used to represent currency values, because of rounding problems. onePage_4991_p=Mapped to java.lang.Float. onePage_4992_p=Example\: onePage_4993_p=REAL onePage_4994_h3=TIME Type onePage_4995_p=The format is hh\:mm\:ss. onePage_4996_p=Mapped to java.sql.Time. When converted to a java.sql.Date, the date is set to 1970-01-01. onePage_4997_p=Example\: onePage_4998_p=TIME onePage_4999_h3=DATE Type onePage_5000_p=The format is yyyy-MM-dd. onePage_5001_p=Mapped to java.sql.Date, with the time set to 00\:00\:00 (or to the next possible time if midnight doesn&\#39;t exist for the given date and timezone due to a daylight saving change). onePage_5002_p=Example\: onePage_5003_p=DATE onePage_5004_h3=TIMESTAMP Type onePage_5005_p=The format is yyyy-MM-dd hh\:mm\:ss[.nnnnnnnnn]. onePage_5006_p=Mapped to java.sql.Timestamp (java.util.Date is also supported). onePage_5007_p=Example\: onePage_5008_p=TIMESTAMP onePage_5009_h3=BINARY Type onePage_5010_a=precisionInt onePage_5011_p=Represents a byte array. For very long arrays, use BLOB. The maximum size is 2 GB, but the whole object is kept in memory when using this data type. The precision is a size constraint; only the actual data is persisted. For large text data BLOB or CLOB should be used. onePage_5012_p=Mapped to byte[]. onePage_5013_p=Example\: onePage_5014_p=BINARY(1000) onePage_5015_h3=OTHER Type onePage_5016_p=This type allows storing serialized Java objects. Internally, a byte array is used. Serialization and deserialization is done on the client side only. Deserialization is only done get getObject is called. Java operations cannot be executed inside the database engine for security reasons. Use PreparedStatement.setObject to store values. onePage_5017_p=Mapped to java.lang.Object (or any subclass). onePage_5018_p=Example\: onePage_5019_p=OTHER onePage_5020_h3=VARCHAR Type onePage_5021_a=precisionInt onePage_5022_p=Unicode String. Use two single quotes (&\#39;&\#39;) to create a quote. The maximum precision is Integer.MAX_VALUE. The precision is a size constraint; only the actual data is persisted. The whole text is kept in memory when using this data type. For large text data CLOB should be used; see there for details. onePage_5023_p=Mapped to java.lang.String. onePage_5024_p=Example\: onePage_5025_p=VARCHAR(255) onePage_5026_h3=VARCHAR_IGNORECASE Type onePage_5027_a=precisionInt onePage_5028_p=Same as VARCHAR, but not case sensitive when comparing. Stored in mixed case. The maximum precision is Integer.MAX_VALUE characters, but the whole text is kept in memory when using this data type. For large text data CLOB should be used; see there for details. onePage_5029_p=Mapped to java.lang.String. onePage_5030_p=Example\: onePage_5031_p=VARCHAR_IGNORECASE onePage_5032_h3=CHAR Type onePage_5033_a=precisionInt onePage_5034_p=This type is supported for compatibility with other databases and older applications. The difference to VARCHAR is that trailing spaces are ignored and not persisted. Unicode String. Use two single quotes (&\#39;&\#39;) to create a quote. The maximum precision is Integer.MAX_VALUE. The precision is a size constraint; only the actual data is persisted. The whole text is kept in memory when using this data type. For large text data CLOB should be used; see there for details. onePage_5035_p=Mapped to java.lang.String. onePage_5036_p=Example\: onePage_5037_p=CHAR(10) onePage_5038_h3=BLOB Type onePage_5039_a=precisionInt onePage_5040_p=Like BINARY, but intended for very large values such as files or images. Unlike when using BINARY, large objects are not kept fully in-memory. Use PreparedStatement.setBinaryStream to store values. See also CLOB and Advanced / Large Objects. onePage_5041_p=Mapped to java.sql.Blob (java.io.InputStream is also supported). onePage_5042_p=Example\: onePage_5043_p=BLOB onePage_5044_h3=CLOB Type onePage_5045_a=precisionInt onePage_5046_p=CLOB is like VARCHAR, but intended for very large values. Unlike when using VARCHAR, large CLOB objects are not kept fully in-memory; instead, they are streamed. CLOB should be used for documents and texts with arbitrary size such as XML or HTML documents, text files, or memo fields of unlimited size. Use PreparedStatement.setCharacterStream to store values. See also Advanced / Large Objects. onePage_5047_p=VARCHAR should be used for text with relatively short average size (for example shorter than 200 characters). Short CLOB values are stored inline, but there is an overhead compared to VARCHAR. onePage_5048_p=Mapped to java.sql.Clob (java.io.Reader is also supported). onePage_5049_p=Example\: onePage_5050_p=CLOB onePage_5051_h3=UUID Type onePage_5052_p=Universally unique identifier. This is a 128 bit value. Use PreparedStatement.setBytes or setString to store values. onePage_5053_p=Mapped to java.util.UUID. onePage_5054_p=Example\: onePage_5055_p=UUID onePage_5056_h3=ARRAY Type onePage_5057_p=An array of values. Use a value list (1, 2) or PreparedStatement.setObject(.., new Object[] {..}) to store values. onePage_5058_p=Mapped to java.lang.Object[] (arrays of any non-primitive type are also supported). onePage_5059_p=Example\: onePage_5060_p=ARRAY onePage_5061_h1=Build onePage_5062_a=\ Portability onePage_5063_a=\ Environment onePage_5064_a=\ Building the Software onePage_5065_a=\ Build Targets onePage_5066_a=\ Using Maven 2 onePage_5067_a=\ Translating onePage_5068_a=\ Providing Patches onePage_5069_a=\ Reporting Problems or Requests onePage_5070_a=\ Automated Build onePage_5071_a=\ Generating Railroad Diagrams onePage_5072_h2=Portability onePage_5073_p=\ This database is written in Java and therefore works on many platforms. It can also be compiled to a native executable using GCJ. onePage_5074_p=\ For Java 1.4, the jar file needs to be converted first using <a href\="http\://retrotranslator.sourceforge.net">Retrotranslator</a>. onePage_5075_h2=Environment onePage_5076_p=\ A Java Runtime Environment (JRE) version 1.5 or higher is required to run this database. onePage_5077_p=\ To build the database executables, the following software stack was used. Newer version or compatible software works too. onePage_5078_li=Mac OS X and Windows XP onePage_5079_a=Sun JDK Version 1.5 and 1.6 onePage_5080_a=Eclipse Version 3.4 onePage_5081_li=Eclipse Plugins\: <a href\="http\://subclipse.tigris.org">Subclipse 1.4.6</a>, <a href\="http\://eclipse-cs.sourceforge.net">Eclipse Checkstyle Plug-in 4.4.2</a>, <a href\="http\://www.eclemma.org">EclEmma Java Code Coverage 1.3.0</a> onePage_5082_a=Emma Java Code Coverage onePage_5083_a=Mozilla Firefox 3.0 onePage_5084_a=OpenOffice 3.0 onePage_5085_a=NSIS 2.38 onePage_5086_li=\ (Nullsoft Scriptable Install System) onePage_5087_a=Maven 2.0.9 onePage_5088_h2=Building the Software onePage_5089_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\: onePage_5090_p=\ For Linux and OS X, use <code>./build.sh</code> instead of <code>build</code>. onePage_5091_p=\ You will get a list of targets. If you want to build the <code>jar</code> file, execute (Windows)\: onePage_5092_h3=Switching the Source Code onePage_5093_p=\ By default the source code uses Java 1.5 features, however Java 1.6 is supported as well. To switch the source code to the installed version of Java, run\: onePage_5094_h2=Build Targets onePage_5095_p=\ The build system can generate smaller jar files as well. The following targets are currently supported\: onePage_5096_code=jarClient onePage_5097_li=\ creates the file <code>h2client.jar</code>. This only contains the JDBC client. onePage_5098_code=jarSmall onePage_5099_li=\ creates the file <code>h2small.jar</code>. This only contains the embedded database. Debug information is disabled. onePage_5100_code=jarJaqu onePage_5101_li=\ creates the file <code>h2jaqu.jar</code>. This only contains the JaQu (Java Query) implementation. All other jar files do not include JaQu. onePage_5102_code=javadocImpl onePage_5103_li=\ creates the Javadocs of the implementation. onePage_5104_p=\ To create the file <code>h2client.jar</code>, go to the directory <code>h2</code> and execute the following command\: onePage_5105_h2=Using Maven 2 onePage_5106_h3=Using a Central Repository onePage_5107_p=\ You can include the database in your Maven 2 project as a dependency. Example\: onePage_5108_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. onePage_5109_h3=Using Snapshot Version onePage_5110_p=\ To build a <code>h2-*-SNAPSHOT.jar</code> file and upload it the to the local Maven 2 repository, execute the following command\: onePage_5111_p=\ Afterwards, you can include the database in your Maven 2 project as a dependency\: onePage_5112_h2=Translating onePage_5113_p=\ The translation of this software is split into the following parts\: onePage_5114_li=H2 Console\: <code>src/main/org/h2/server/web/res/_text_*.properties</code> onePage_5115_li=Error messages\: <code>src/main/org/h2/res/_messages_*.properties</code> onePage_5116_li=Web site\: <code>src/docsrc/text/_docs_*.utf8.txt</code> onePage_5117_p=\ To translate the H2 Console, start it and select Preferences / Translate. The conversion between UTF-8 and Java encoding (using the <code>\\u</code> syntax), as well as the HTML entities (<code>&\#..;</code>) is automated by running the tool <code>PropertiesToUTF8</code>. The web site translation is automated as well, using <code>build docs</code>. onePage_5118_h2=Providing Patches onePage_5119_p=\ If you like to provide patches, please consider the following guidelines to simplify merging them\: onePage_5120_li=Only use Java 1.5 features (do not use Java 1.6) (see <a href\="\#environment">Environment</a>). onePage_5121_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>. onePage_5122_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. onePage_5123_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>. onePage_5124_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>. onePage_5125_li=Verify that you did not break other features\: run the test cases by executing <code>build test</code>. onePage_5126_li=Provide end user documentation if required (<code>src/docsrc/html/*</code>). onePage_5127_li=Document grammar changes in <code>src/docsrc/help/help.csv</code> onePage_5128_li=Provide a change log entry (<code>src/docsrc/html/changelog.html</code>). onePage_5129_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>. onePage_5130_li=Run <code>src/installer/buildRelease</code> to find and fix formatting errors. onePage_5131_li=Verify the formatting using <code>build docs</code> and <code>build javadoc</code>. onePage_5132_li=Submit patches as <code>.patch</code> files (compressed if big). To create a patch using Eclipse, use Team / Create Patch. onePage_5133_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\: onePage_5134_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)." onePage_5135_h2=Reporting Problems or Requests onePage_5136_p=\ Please consider the following checklist if you have a question, want to report a problem, or if you have a feature request\: onePage_5137_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>. onePage_5138_li=Before posting problems, check the <a href\="faq.html">FAQ</a> and do a <a href\="http\://google.com">Google search</a>. onePage_5139_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). onePage_5140_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. onePage_5141_li=For large attachments, use a public temporary storage such as <a href\="http\://rapidshare.com">Rapidshare</a>. onePage_5142_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. onePage_5143_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>. onePage_5144_li=It may take a few days to get an answers. Please do not double post. onePage_5145_h2=Automated Build onePage_5146_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\: onePage_5147_a=Test Output onePage_5148_a=Code Coverage Summary onePage_5149_a=Code Coverage Details (download, 1.3 MB) onePage_5150_a=Build Newsfeed onePage_5151_a=Latest Jar File (download, 1 MB) onePage_5152_h2=Generating Railroad Diagrams onePage_5153_p=\ The railroad diagrams are HTML, formatted as nested tables. The diagrams are generated as follows\: onePage_5154_li=The BNF parser (<code>org.h2.bnf.Bnf</code>) reads and parses the BNF from the file <code>help.csv</code>. onePage_5155_li=The page parser (<code>org.h2.server.web.PageParser</code>) reads the template HTML file and fills in the diagrams. onePage_5156_li=The rail images (one straight, four junctions, two turns) are generated using a simple Java application. onePage_5157_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. onePage_5158_h1=History and Roadmap onePage_5159_a=\ Change Log onePage_5160_a=\ Roadmap onePage_5161_a=\ History of this Database Engine onePage_5162_a=\ Why Java onePage_5163_a=\ Supporters onePage_5164_h2=Change Log onePage_5165_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> onePage_5166_h2=Roadmap onePage_5167_p=\ The current roadmap is available at <a href\="http\://www.h2database.com/html/roadmap.html"> http\://www.h2database.com/html/roadmap.html </a> onePage_5168_h2=History of this Database Engine onePage_5169_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. onePage_5170_h2=Why Java onePage_5171_p=\ The main reasons to use a Java database are\: onePage_5172_li=Very simple to integrate in Java applications onePage_5173_li=Support for many different platforms onePage_5174_li=More secure than native applications (no buffer overflows) onePage_5175_li=User defined functions (or triggers) run very fast onePage_5176_li=Unicode support onePage_5177_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. onePage_5178_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. onePage_5179_p=\ Java is future proof\: a lot of companies support Java. Java is now open source. onePage_5180_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. onePage_5181_h2=Supporters onePage_5182_p=\ Many thanks for those who reported bugs, gave valuable feedback, spread the word, and translated this project. Also many thanks to the donors who contributed via PayPal\: onePage_5183_a=NetSuxxess GmbH, Germany onePage_5184_a=Poker Copilot, Steve McLeod, Germany onePage_5185_a=SkyCash, Poland onePage_5186_a=Lumber-mill, Inc., Japan onePage_5187_li=Martin Wildam, Austria onePage_5188_li=Donald Bleyl, USA onePage_5189_li=Frank Berger, Germany onePage_5190_li=Ashwin Jayaprakash, USA onePage_5191_li=Florent Ramiere, France onePage_5192_li=Jun Iyama, Japan onePage_5193_li=Antonio Casqueiro, Portugal onePage_5194_li=Oliver Computing LLC, USA onePage_5195_li=Harpal Grover Consulting Inc., USA onePage_5196_li=Elisabetta Berlini, Italy onePage_5197_li=William Gilbert, USA onePage_5198_li=Antonio Dieguez, Chile onePage_5199_a=Ontology Works, USA onePage_5200_li=Pete Haidinyak, USA onePage_5201_li=William Osmond, USA onePage_5202_li=Joachim Ansorg, Germany onePage_5203_li=Oliver Soerensen, Germany onePage_5204_li=Christos Vasilakis, Greece onePage_5205_li=Fyodor Kupolov, Denmark onePage_5206_li=Jakob Jenkov, Denmark onePage_5207_li=Stéphane Chartrand, Switzerland onePage_5208_li=Glenn Kidd, USA onePage_5209_li=Gustav Trede, Sweden onePage_5210_h1=Frequently Asked Questions onePage_5211_a=\ I Have a Problem or Feature Request onePage_5212_a=\ Are there Known Bugs? When is the Next Release? onePage_5213_a=\ Is this Database Engine Open Source? onePage_5214_a=\ My Query is Slow onePage_5215_a=\ How to Create a New Database? onePage_5216_a=\ How to Connect to a Database? onePage_5217_a=\ Where are the Database Files Stored? onePage_5218_a=\ What is the Size Limit (Maximum Size) of a Database? onePage_5219_a=\ Is it Reliable? onePage_5220_a=\ Why is Opening my Database Slow? onePage_5221_a=\ Column Names are Incorrect? onePage_5222_a=\ Is the GCJ Version Stable? Faster? onePage_5223_a=\ How to Translate this Project? onePage_5224_h3=I Have a Problem or Feature Request onePage_5225_p=\ Please read the <a href\="\#support">support checklist</a>. onePage_5226_h3=Are there Known Bugs? When is the Next Release? onePage_5227_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\: onePage_5228_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 >\= 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>). onePage_5229_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. onePage_5230_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. onePage_5231_p=\ For a complete list, see <a href\="http\://code.google.com/p/h2database/issues/list">Open Issues</a>. onePage_5232_h3=Is this Database Engine Open Source? onePage_5233_p=\ Yes. It is free to use and distribute, and the source code is included. See also under license. onePage_5234_h3=My Query is Slow onePage_5235_p=\ Slow <code>SELECT</code> (or <code>DELETE, UPDATE, MERGE</code>) statement can have multiple reasons. Follow this checklist\: onePage_5236_li=Run <code>ANALYZE</code> (see documentation for details). onePage_5237_li=Run the query with <code>EXPLAIN</code> and check if indexes are used (see documentation for details). onePage_5238_li=If required, create additional indexes and try again using <code>ANALYZE</code> and <code>EXPLAIN</code>. onePage_5239_li=If it doesn't help please report the problem. onePage_5240_h3=How to Create a New Database? onePage_5241_p=\ By default, a new database is automatically created if it does not yet exist. See <a href\="\#creating_new_databases">Creating New Databases</a>. onePage_5242_h3=How to Connect to a Database? onePage_5243_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\: onePage_5244_h3=Where are the Database Files Stored? onePage_5245_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\\<userName></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><Installation Directory>/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> onePage_5246_h3=What is the Size Limit (Maximum Size) of a Database? onePage_5247_p=\ See <a href\="\#limits_limitations">Limits and Limitations</a>. onePage_5248_h3=Is it Reliable? onePage_5249_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\: onePage_5250_li=Using the transaction isolation level <code>READ_UNCOMMITTED</code> (<code>LOCK_MODE 0</code>) while at the same time using multiple connections. onePage_5251_li=Disabling database file protection using <code>FILE_LOCK\=NO</code> in the database URL. onePage_5252_li=Disabling referential integrity using <code>SET REFERENTIAL_INTEGRITY FALSE</code>. onePage_5253_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. onePage_5254_p=\ Some areas of this database are not fully tested. When using one of those features for production, please ensure your use case is well tested (if possible with automated test cases). Those areas are\: onePage_5255_li=Platforms other than Windows XP, Linux, Mac OS X, or JVMs other than Sun 1.5 or 1.6 onePage_5256_li=The features <code>AUTO_SERVER</code> and <code>AUTO_RECONNECT</code> onePage_5257_li=The file locking method 'Serialized' onePage_5258_li=The MVCC (multi version concurrency) mode onePage_5259_li=Cluster mode, 2-phase commit, savepoints onePage_5260_li=24/7 operation onePage_5261_li=Some operations on databases larger than 500 MB may be slower than expected onePage_5262_li=The optimizer may not always select the best plan onePage_5263_li=Fulltext search onePage_5264_li=Operations on LOBs over 2 GB onePage_5265_p=\ Areas considered experimental are\: onePage_5266_li=The PostgreSQL server onePage_5267_li=Multi-threading within the engine using <code>SET MULTI_THREADED\=1</code> onePage_5268_li=Compatibility modes for other databases (only some features are implemented) onePage_5269_li=The soft reference cache (CACHE_TYPE\=SOFT_LRU). It might not improve performance, and out of memory issues have been reported. onePage_5270_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. onePage_5271_h3=Column Names are Incorrect? onePage_5272_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? onePage_5273_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>. Other database don't work like this (they don't follow the JDBC specification). If you need compatibility with those databases, use the <a href\="\#compatibility">Compatibility Mode</a>, or set the system property <a href\="../javadoc/org/h2/constant/SysProperties.html\#h2.aliasColumnName"><code>h2.aliasColumnName</code></a>. onePage_5274_h3=Why is Opening my Database Slow? onePage_5275_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. onePage_5276_p=\ To find out what the problem is, open the database in embedded mode using the H2 Console. This will print progress information. If you have many lines with 'Creating index' it is an indication that the database was not closed the last time. onePage_5277_p=\ Other possible reasons are\: the database is very big (many GB), or contains linked tables that are slow to open. onePage_5278_h3=Is the GCJ Version Stable? Faster? onePage_5279_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. onePage_5280_h3=How to Translate this Project? onePage_5281_p=\ For more information, see <a href\="\#translating">Build/Translating</a>. performance_1000_b=Search\: performance_1001_td=Highlight keyword(s) performance_1002_a=Home performance_1003_a=Download performance_1004_a=Cheat Sheet performance_1005_b=Documentation performance_1006_a=Quickstart performance_1007_a=Installation performance_1008_a=Tutorial performance_1009_a=Features performance_1010_a=Performance performance_1011_a=Advanced performance_1012_b=Reference performance_1013_a=SQL Grammar performance_1014_a=Functions performance_1015_a=Data Types performance_1016_a=Javadoc performance_1017_a=PDF (1 MB) performance_1018_b=Support performance_1019_a=FAQ performance_1020_a=Error Analyzer performance_1021_a=Google Group (English) performance_1022_a=Google Group (Japanese) performance_1023_a=Google Group (Chinese) performance_1024_b=Appendix performance_1025_a=JaQu performance_1026_a=Build performance_1027_a=History & Roadmap performance_1028_a=Links performance_1029_a=License performance_1030_td= performance_1031_h1=Performance performance_1032_a=\ Performance Comparison performance_1033_a=\ PolePosition Benchmark performance_1034_a=\ Application Profiling performance_1035_a=\ Database Profiling performance_1036_a=\ Database Performance Tuning performance_1037_a=\ Using the Built-In Profiler performance_1038_a=\ Fast Database Import performance_1039_h2=Performance Comparison performance_1040_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_1041_h3=Embedded performance_1042_th=Test Case performance_1043_th=Unit performance_1044_th=H2 performance_1045_th=HSQLDB performance_1046_th=Derby performance_1047_td=Simple\: Init performance_1048_td=ms performance_1049_td=547 performance_1050_td=532 performance_1051_td=2594 performance_1052_td=Simple\: Query (random) performance_1053_td=ms performance_1054_td=250 performance_1055_td=391 performance_1056_td=1515 performance_1057_td=Simple\: Query (sequential) performance_1058_td=ms performance_1059_td=188 performance_1060_td=313 performance_1061_td=1406 performance_1062_td=Simple\: Update (random) performance_1063_td=ms performance_1064_td=812 performance_1065_td=1750 performance_1066_td=17704 performance_1067_td=Simple\: Delete (sequential) performance_1068_td=ms performance_1069_td=203 performance_1070_td=250 performance_1071_td=8843 performance_1072_td=Simple\: Memory Usage performance_1073_td=MB performance_1074_td=7 performance_1075_td=11 performance_1076_td=11 performance_1077_td=BenchA\: Init performance_1078_td=ms performance_1079_td=578 performance_1080_td=719 performance_1081_td=3328 performance_1082_td=BenchA\: Transactions performance_1083_td=ms performance_1084_td=3047 performance_1085_td=2406 performance_1086_td=12907 performance_1087_td=BenchA\: Memory Usage performance_1088_td=MB performance_1089_td=10 performance_1090_td=15 performance_1091_td=10 performance_1092_td=BenchB\: Init performance_1093_td=ms performance_1094_td=2141 performance_1095_td=2406 performance_1096_td=11562 performance_1097_td=BenchB\: Transactions performance_1098_td=ms performance_1099_td=1125 performance_1100_td=1375 performance_1101_td=3625 performance_1102_td=BenchB\: Memory Usage performance_1103_td=MB performance_1104_td=9 performance_1105_td=11 performance_1106_td=8 performance_1107_td=BenchC\: Init performance_1108_td=ms performance_1109_td=688 performance_1110_td=594 performance_1111_td=4500 performance_1112_td=BenchC\: Transactions performance_1113_td=ms performance_1114_td=1906 performance_1115_td=64062 performance_1116_td=6047 performance_1117_td=BenchC\: Memory Usage performance_1118_td=MB performance_1119_td=11 performance_1120_td=17 performance_1121_td=11 performance_1122_td=Executed statements performance_1123_td=\# performance_1124_td=322929 performance_1125_td=322929 performance_1126_td=322929 performance_1127_td=Total time performance_1128_td=ms performance_1129_td=11485 performance_1130_td=74798 performance_1131_td=74031 performance_1132_td=Statements per second performance_1133_td=\# performance_1134_td=28117 performance_1135_td=4317 performance_1136_td=4362 performance_1137_h3=Client-Server performance_1138_th=Test Case performance_1139_th=Unit performance_1140_th=H2 performance_1141_th=HSQLDB performance_1142_th=Derby performance_1143_th=PostgreSQL performance_1144_th=MySQL performance_1145_td=Simple\: Init performance_1146_td=ms performance_1147_td=2782 performance_1148_td=2656 performance_1149_td=5625 performance_1150_td=4563 performance_1151_td=3484 performance_1152_td=Simple\: Query (random) performance_1153_td=ms performance_1154_td=3093 performance_1155_td=2703 performance_1156_td=6688 performance_1157_td=4812 performance_1158_td=3860 performance_1159_td=Simple\: Query (sequential) performance_1160_td=ms performance_1161_td=2969 performance_1162_td=2594 performance_1163_td=6437 performance_1164_td=4719 performance_1165_td=3625 performance_1166_td=Simple\: Update (random) performance_1167_td=ms performance_1168_td=2969 performance_1169_td=3531 performance_1170_td=18250 performance_1171_td=5953 performance_1172_td=5125 performance_1173_td=Simple\: Delete (sequential) performance_1174_td=ms performance_1175_td=1047 performance_1176_td=1250 performance_1177_td=6875 performance_1178_td=2485 performance_1179_td=2390 performance_1180_td=Simple\: Memory Usage performance_1181_td=MB performance_1182_td=7 performance_1183_td=11 performance_1184_td=14 performance_1185_td=0 performance_1186_td=0 performance_1187_td=BenchA\: Init performance_1188_td=ms performance_1189_td=2250 performance_1190_td=2453 performance_1191_td=6031 performance_1192_td=4328 performance_1193_td=3625 performance_1194_td=BenchA\: Transactions performance_1195_td=ms performance_1196_td=10250 performance_1197_td=9016 performance_1198_td=21484 performance_1199_td=15609 performance_1200_td=11172 performance_1201_td=BenchA\: Memory Usage performance_1202_td=MB performance_1203_td=10 performance_1204_td=15 performance_1205_td=10 performance_1206_td=0 performance_1207_td=1 performance_1208_td=BenchB\: Init performance_1209_td=ms performance_1210_td=9500 performance_1211_td=10672 performance_1212_td=22609 performance_1213_td=19609 performance_1214_td=13406 performance_1215_td=BenchB\: Transactions performance_1216_td=ms performance_1217_td=2734 performance_1218_td=2656 performance_1219_td=3875 performance_1220_td=4688 performance_1221_td=2531 performance_1222_td=BenchB\: Memory Usage performance_1223_td=MB performance_1224_td=10 performance_1225_td=11 performance_1226_td=11 performance_1227_td=1 performance_1228_td=1 performance_1229_td=BenchC\: Init performance_1230_td=ms performance_1231_td=1860 performance_1232_td=1484 performance_1233_td=6890 performance_1234_td=2219 performance_1235_td=3438 performance_1236_td=BenchC\: Transactions performance_1237_td=ms performance_1238_td=9046 performance_1239_td=63266 performance_1240_td=18641 performance_1241_td=11703 performance_1242_td=7421 performance_1243_td=BenchC\: Memory Usage performance_1244_td=MB performance_1245_td=12 performance_1246_td=17 performance_1247_td=13 performance_1248_td=0 performance_1249_td=1 performance_1250_td=Executed statements performance_1251_td=\# performance_1252_td=322929 performance_1253_td=322929 performance_1254_td=322929 performance_1255_td=322929 performance_1256_td=322929 performance_1257_td=Total time performance_1258_td=ms performance_1259_td=48500 performance_1260_td=102281 performance_1261_td=123405 performance_1262_td=80688 performance_1263_td=60077 performance_1264_td=Statements per second performance_1265_td=\# performance_1266_td=6658 performance_1267_td=3157 performance_1268_td=2616 performance_1269_td=4002 performance_1270_td=5375 performance_1271_h3=Benchmark Results and Comments performance_1272_h4=H2 performance_1273_p=\ Version 1.1.114 (2009-06-01) was used for the test. For simpler operations, the performance of H2 is about the same as for HSQLDB. For more complex queries, the query optimizer is very important. However H2 is not very fast in every case, certain kind of queries may still be slow. One situation where is 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. The open/close time is almost fixed, because of the file locking protocol\: the engine waits some time after opening a database to ensure the database files are not opened by another process. performance_1274_h4=HSQLDB performance_1275_p=\ Version 1.8.0.10 was used for the test. Cached tables are used in this test (hsqldb.default_table_type\=cached), and the write delay is 1 second (<code>SET WRITE_DELAY 1</code>). HSQLDB is fast when using simple operations. HSQLDB is very slow in the last test (BenchC\: Transactions), probably because is has a bad query optimizer. One query where HSQLDB is slow is a two-table join\: performance_1276_p=\ The PolePosition benchmark also shows that the query optimizer does not do a very good job for some queries. Another disadvantage of HSQLDB is the slow startup / shutdown time (currently not listed) when using bigger databases. The reason is, a backup of the whole data is made whenever the database is opened or closed. performance_1277_h4=Derby performance_1278_p=\ Version 10.4.2.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 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_1279_h4=PostgreSQL performance_1280_p=\ Version 8.3.7 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. It looks like the base performance is slower than MySQL, the reason could be the network layer. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured. performance_1281_h4=MySQL performance_1282_p=\ Version 5.1.34-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</code> file) was set to 0. Otherwise (and by default), MySQL is really 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</code>, and then restart the service. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured. performance_1283_h4=Firebird performance_1284_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_1285_h4=Why Oracle / MS SQL Server / DB2 are Not Listed performance_1286_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_1287_h3=About this Benchmark performance_1288_h4=How to Run performance_1289_p=\ This test was executed as follows\: performance_1290_h4=Separate Process per Database performance_1291_p=\ For each database, a new process is started, to ensure the previous test does not impact the current test. performance_1292_h4=Number of Connections performance_1293_p=\ This is mostly a single-connection benchmark. BenchB uses multiple connections; the other tests use one connection. performance_1294_h4=Real-World Tests performance_1295_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_1296_h4=Comparing Embedded with Server Databases performance_1297_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_1298_h4=Test Platform performance_1299_p=\ This test is run on Windows XP with the virus scanner switched off. The VM used is Sun JDK 1.5. performance_1300_h4=Multiple Runs performance_1301_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_1302_h4=Memory Usage performance_1303_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_1304_h4=Delayed Operations performance_1305_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_1306_h4=Transaction Commit / Durability performance_1307_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_1308_h4=Using Prepared Statements performance_1309_p=\ Wherever possible, the test cases use prepared statements. performance_1310_h4=Currently Not Tested\: Startup Time performance_1311_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_1312_h2=PolePosition Benchmark performance_1313_p=\ The PolePosition is an open source benchmark. The algorithms are all quite simple. It was developed / sponsored by db4o. performance_1314_th=Test Case performance_1315_th=Unit performance_1316_th=H2 performance_1317_th=HSQLDB performance_1318_th=MySQL performance_1319_td=Melbourne write performance_1320_td=ms performance_1321_td=369 performance_1322_td=249 performance_1323_td=2022 performance_1324_td=Melbourne read performance_1325_td=ms performance_1326_td=47 performance_1327_td=49 performance_1328_td=93 performance_1329_td=Melbourne read_hot performance_1330_td=ms performance_1331_td=24 performance_1332_td=43 performance_1333_td=95 performance_1334_td=Melbourne delete performance_1335_td=ms performance_1336_td=147 performance_1337_td=133 performance_1338_td=176 performance_1339_td=Sepang write performance_1340_td=ms performance_1341_td=965 performance_1342_td=1201 performance_1343_td=3213 performance_1344_td=Sepang read performance_1345_td=ms performance_1346_td=765 performance_1347_td=948 performance_1348_td=3455 performance_1349_td=Sepang read_hot performance_1350_td=ms performance_1351_td=789 performance_1352_td=859 performance_1353_td=3563 performance_1354_td=Sepang delete performance_1355_td=ms performance_1356_td=1384 performance_1357_td=1596 performance_1358_td=6214 performance_1359_td=Bahrain write performance_1360_td=ms performance_1361_td=1186 performance_1362_td=1387 performance_1363_td=6904 performance_1364_td=Bahrain query_indexed_string performance_1365_td=ms performance_1366_td=336 performance_1367_td=170 performance_1368_td=693 performance_1369_td=Bahrain query_string performance_1370_td=ms performance_1371_td=18064 performance_1372_td=39703 performance_1373_td=41243 performance_1374_td=Bahrain query_indexed_int performance_1375_td=ms performance_1376_td=104 performance_1377_td=134 performance_1378_td=678 performance_1379_td=Bahrain update performance_1380_td=ms performance_1381_td=191 performance_1382_td=87 performance_1383_td=159 performance_1384_td=Bahrain delete performance_1385_td=ms performance_1386_td=1215 performance_1387_td=729 performance_1388_td=6812 performance_1389_td=Imola retrieve performance_1390_td=ms performance_1391_td=198 performance_1392_td=194 performance_1393_td=4036 performance_1394_td=Barcelona write performance_1395_td=ms performance_1396_td=413 performance_1397_td=832 performance_1398_td=3191 performance_1399_td=Barcelona read performance_1400_td=ms performance_1401_td=119 performance_1402_td=160 performance_1403_td=1177 performance_1404_td=Barcelona query performance_1405_td=ms performance_1406_td=20 performance_1407_td=5169 performance_1408_td=101 performance_1409_td=Barcelona delete performance_1410_td=ms performance_1411_td=388 performance_1412_td=319 performance_1413_td=3287 performance_1414_td=Total performance_1415_td=ms performance_1416_td=26724 performance_1417_td=53962 performance_1418_td=87112 performance_1419_p=\ There are a few problems with the PolePosition test\: performance_1420_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_1421_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_1422_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_1423_h2=Application Profiling performance_1424_h3=Analyze First performance_1425_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_1426_p=\ A simple way to profile an application is to use the built-in profiling tool of java. Example\: performance_1427_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 <pid></code> or <code>kill -QUIT <pid></code> (Linux) or press Ctrl+C (Windows). performance_1428_p=\ A simple profiling tool is included in H2. To use it, the application needs to be changed slightly. Example\: performance_1429_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_1430_h2=Database Profiling performance_1431_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>. As an example, execute the the following script using the H2 Console\: performance_1432_p=\ Now convert the <code>.trace.db</code> file using the <code>ConvertTraceFile</code> tool\: performance_1433_p=\ The generated file <code>test.sql</code> will contain the SQL statements as well as the following profiling data (results vary)\: performance_1434_h2=Database Performance Tuning performance_1435_h3=Keep Connections Open or Use a Connection Pool performance_1436_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_1437_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_1438_h3=Use a Modern JVM performance_1439_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_1440_h3=Virus Scanners performance_1441_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_1442_h3=Using the Trace Options performance_1443_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_1444_h3=Index Usage performance_1445_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_1446_h3=Optimizer performance_1447_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_1448_h3=Expression Optimization performance_1449_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_1450_h3=COUNT(*) Optimization performance_1451_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_1452_h3=Updating Optimizer Statistics / Column Selectivity performance_1453_p=\ When executing a query, at most one index per joined table can be used. If the same table is joined multiple times, for each join only one index is used. 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_1454_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_1455_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_1456_h3=In-Memory (Hash) Indexes performance_1457_p=\ Using in-memory indexes, specially in-memory hash indexes, can speed up queries and data manipulation. performance_1458_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_1459_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 < ?</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_1460_h3=Use Prepared Statements performance_1461_p=\ If possible, use prepared statements with parameters. Avoid generating SQL statements with a variable size IN(...) list. Instead, use arrays as in the following example\: performance_1462_h3=Optimization Examples performance_1463_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_1464_h3=Cache Size and Type performance_1465_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_1466_h3=Data Types performance_1467_p=\ Each data type has different storage and performance characteristics\: performance_1468_li=The <code>DECIMAL/NUMERIC</code> type is slower and requires more storage than the <code>REAL</code> and <code>DOUBLE</code> types. performance_1469_li=Text types are slower to read, write, and compare than numeric types and generally require more storage. performance_1470_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_1471_li=Parsing and formatting takes longer for the <code>TIME</code>, <code>DATE</code>, and <code>TIMESTAMP</code> types than the numeric types. performance_1472_code=SMALLINT/TINYINT/BOOLEAN performance_1473_li=\ are not significantly smaller or faster to work with than <code>INTEGER</code> in most modes. performance_1474_h3=Sorted Insert Optimization performance_1475_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_1476_h2=Using the Built-In Profiler performance_1477_p=\ A very simple Java profiler is built-in. To use it, use the following template\: performance_1478_h2=Fast Database Import performance_1479_p=\ To speed up large imports, consider using the following options temporarily\: performance_1480_code=SET CACHE_SIZE performance_1481_li=\ (a large cache is faster) performance_1482_code=SET LOCK_MODE 0 performance_1483_li=\ (disable locking) performance_1484_code=SET UNDO_LOG 0 performance_1485_li=\ (disable the session undo log) performance_1486_p=\ These options can be set in the database URL\: <code>jdbc\:h2\:~/test;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. quickstart_1000_b=Search\: quickstart_1001_td=Highlight keyword(s) quickstart_1002_a=Home quickstart_1003_a=Download quickstart_1004_a=Cheat Sheet quickstart_1005_b=Documentation quickstart_1006_a=Quickstart quickstart_1007_a=Installation quickstart_1008_a=Tutorial quickstart_1009_a=Features quickstart_1010_a=Performance quickstart_1011_a=Advanced quickstart_1012_b=Reference quickstart_1013_a=SQL Grammar quickstart_1014_a=Functions quickstart_1015_a=Data Types quickstart_1016_a=Javadoc quickstart_1017_a=PDF (1 MB) quickstart_1018_b=Support quickstart_1019_a=FAQ quickstart_1020_a=Error Analyzer quickstart_1021_a=Google Group (English) quickstart_1022_a=Google Group (Japanese) quickstart_1023_a=Google Group (Chinese) quickstart_1024_b=Appendix quickstart_1025_a=JaQu quickstart_1026_a=Build quickstart_1027_a=History & Roadmap quickstart_1028_a=Links quickstart_1029_a=License quickstart_1030_td= quickstart_1031_h1=Quickstart quickstart_1032_a=\ Embedding H2 in an Application quickstart_1033_a=\ The H2 Console Application quickstart_1034_h2=Embedding H2 in an Application quickstart_1035_p=\ This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to\: quickstart_1036_li=Add the <code>h2*.jar</code> to the classpath (H2 does not have any dependencies) quickstart_1037_li=Use the JDBC driver class\: <code>org.h2.Driver</code> quickstart_1038_li=The database URL <code>jdbc\:h2\:~/test</code> opens the database <code>test</code> in your user home directory quickstart_1039_li=A new database is automatically created quickstart_1040_h2=The H2 Console Application quickstart_1041_p=\ The Console lets you access a SQL database using a browser interface. quickstart_1042_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_1043_h3=Step-by-Step quickstart_1044_h4=Installation quickstart_1045_p=\ Install the software using the Windows Installer (if you did not yet do that). quickstart_1046_h4=Start the Console quickstart_1047_p=\ Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]\: quickstart_1048_p=\ A new console window appears\: quickstart_1049_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_1050_h4=Login quickstart_1051_p=\ Select [Generic H2] and click [Connect]\: quickstart_1052_p=\ You are now logged in. quickstart_1053_h4=Sample quickstart_1054_p=\ Click on the [Sample SQL Script]\: quickstart_1055_p=\ The SQL commands appear in the command area. quickstart_1056_h4=Execute quickstart_1057_p=\ Click [Run] quickstart_1058_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_1059_h4=Disconnect quickstart_1060_p=\ Click on [Disconnect]\: quickstart_1061_p=\ to close the connection. quickstart_1062_h4=End quickstart_1063_p=\ Close the console window. For more information, see the <a href\="tutorial.html">Tutorial</a>. roadmap_1000_b=Search\: roadmap_1001_td=Highlight keyword(s) roadmap_1002_a=Home roadmap_1003_a=Download roadmap_1004_a=Cheat Sheet roadmap_1005_b=Documentation roadmap_1006_a=Quickstart roadmap_1007_a=Installation roadmap_1008_a=Tutorial roadmap_1009_a=Features roadmap_1010_a=Performance roadmap_1011_a=Advanced roadmap_1012_b=Reference roadmap_1013_a=SQL Grammar roadmap_1014_a=Functions roadmap_1015_a=Data Types roadmap_1016_a=Javadoc roadmap_1017_a=PDF (1 MB) roadmap_1018_b=Support roadmap_1019_a=FAQ roadmap_1020_a=Error Analyzer roadmap_1021_a=Google Group (English) roadmap_1022_a=Google Group (Japanese) roadmap_1023_a=Google Group (Chinese) roadmap_1024_b=Appendix roadmap_1025_a=JaQu roadmap_1026_a=Build roadmap_1027_a=History & Roadmap roadmap_1028_a=Links roadmap_1029_a=License roadmap_1030_td= roadmap_1031_h1=Roadmap roadmap_1032_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_1033_h2=Version 1.2 roadmap_1034_li=Enable the system property h2.optimizeInList by default. roadmap_1035_li=Enable the system property h2.nullConcatIsNull by default. roadmap_1036_li=Enable the system property h2.pageStore by default. roadmap_1037_h2=Priority 1 roadmap_1038_li=Bugfixes roadmap_1039_li=Issues 161, 157\: Support large inserts and updates (use the transaction log for rollback). Problems\: Session.commit (rows), cache, undoLog. roadmap_1040_li=More tests with MULTI_THREADED\=1 roadmap_1041_li=Optimization\: result set caching (like MySQL); option to disable roadmap_1042_li=Server side cursors roadmap_1043_h2=Priority 2 roadmap_1044_li=Improve test code coverage roadmap_1045_li=Test multi-threaded in-memory db access roadmap_1046_li=MVCC\: select for update should only lock the selected rows. roadmap_1047_li=Option to shutdown all the running servers (on the same VM). roadmap_1048_li=Full outer joins roadmap_1049_li=Support mixed clustering mode (one embedded, others in server mode) roadmap_1050_li=PostgreSQL catalog\: use BEFORE SELECT triggers instead of views over metadata tables. roadmap_1051_li=Test very large databases and LOBs (up to 256 GB) roadmap_1052_li=Support hints for the optimizer (which index to use, enforce the join order). roadmap_1053_li=Change LOB mechanism (less files, keep index of lob files, point to files and row, delete unused files earlier, maybe bundle files into a tar file) roadmap_1054_li=Clustering\: recovery needs to becomes fully automatic. Global write lock feature. roadmap_1055_li=Clustering\: reads should be randomly distributed (optional) or to a designated database on RAM (parameter\: READ_FROM\=3) roadmap_1056_li=Sequence\: add features [NO] MINVALUE, MAXVALUE, CYCLE roadmap_1057_li=Deferred integrity checking (DEFERRABLE INITIALLY DEFERRED) roadmap_1058_li=Groovy Stored Procedures (http\://groovy.codehaus.org/Groovy+SQL) roadmap_1059_li=Add a migration guide (list differences between databases) roadmap_1060_li=Migrate database tool (also from other database engines) roadmap_1061_li=Automatic collection of statistics (auto ANALYZE; AUTOVACUUM). See http\://www.postgresql.org/docs/current/static/routine-vacuuming.html\#AUTOVACUUM roadmap_1062_li=Optimization\: automatic index creation suggestion using the trace file? roadmap_1063_li=Compression performance\: don't allocate buffers, compress / expand in to out buffer roadmap_1064_li=Rebuild index functionality to shrink index size and improve performance roadmap_1065_li=Don't use deleteOnExit (bug 4513817\: File.deleteOnExit consumes memory) roadmap_1066_li=Console\: add accesskey to most important commands (A, AREA, BUTTON, INPUT, LABEL, LEGEND, TEXTAREA) roadmap_1067_li=Support nested outer joins (see todo.txt). roadmap_1068_li=Test performance again with SQL Server, Oracle, DB2 roadmap_1069_li=Test with dbmonster (http\://dbmonster.kernelpanic.pl/) roadmap_1070_li=Test with dbcopy (http\://dbcopyplugin.sourceforge.net) roadmap_1071_li=Test with Spatial DB in a box / JTS\: http\://www.opengeospatial.org/standards/sfs - OpenGIS Implementation Specification roadmap_1072_li=Write more tests and documentation for MVCC (Multi Version Concurrency Control) roadmap_1073_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_1074_li=Implement, test, document XAConnection and so on roadmap_1075_li=Pluggable data type (for streaming, hashing, compression, validation, conversion, encryption) roadmap_1076_li=CHECK\: find out what makes CHECK\=TRUE slow, move to CHECK2 roadmap_1077_li=Index usage for (ID, NAME)\=(1, 'Hi'); document roadmap_1078_li=Make DDL (Data Definition) operations transactional roadmap_1079_li=RANK() and DENSE_RANK(), Partition using OVER() roadmap_1080_li=Set a connection read only (Connection.setReadOnly) or using a connection parameter roadmap_1081_li=Optimizer\: use an index for IS NULL and IS NOT NULL (including linked tables). ID IS NOT NULL could be converted to ID >\= Integer.MIN_VALUE. roadmap_1082_li=Access rights\: remember the owner of an object. COMMENT\: allow owner of object to change it. roadmap_1083_li=Access rights\: finer grained access control (grant access for specific functions) roadmap_1084_li=Suggestion\: include Jetty as Servlet Container (like LAMP) roadmap_1085_li=Trace shipping to server roadmap_1086_li=Version check\: docs / web console (using Javascript), and maybe in the library (using TCP/IP) roadmap_1087_li=Web server classloader\: override findResource / getResourceFrom roadmap_1088_li=Cost for embedded temporary view is calculated wrong, if result is constant roadmap_1089_li=Comparison\: pluggable sort order\: natural sort roadmap_1090_li=Count index range query (count(*) where id between 10 and 20) roadmap_1091_li=Performance\: update in-place roadmap_1092_li=Recursive Queries (see details) roadmap_1093_li=Eclipse plugin roadmap_1094_li=Asynchronous queries to support publish/subscribe\: SELECT ... FOR READ WAIT [maxMillisToWait] roadmap_1095_li=Fulltext search Lucene\: analyzer configuration. roadmap_1096_li=Fulltext search (native)\: reader / tokenizer / filter. roadmap_1097_li=Linked schema using CSV files\: one schema for a directory of files; support indexes for CSV files roadmap_1098_li=iReport to support H2 roadmap_1099_li=Implement missing JDBC API (CallableStatement,...) roadmap_1100_li=Compression of the cache roadmap_1101_li=Include SMPT (mail) server (at least client) (alert on cluster failure, low disk space,...) roadmap_1102_li=Drop with restrict (currently cascade is the default) roadmap_1103_li=JSON parser and functions roadmap_1104_li=Server\: client ping from time to time (to avoid timeout - is timeout a problem?) roadmap_1105_li=Copy database\: tool with config GUI and batch mode, extensible (example\: compare) roadmap_1106_li=Document, implement tool for long running transactions using user-defined compensation statements. roadmap_1107_li=Support SET TABLE DUAL READONLY roadmap_1108_li=GCJ\: what is the state now? roadmap_1109_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_1110_li=Optimization\: log compression roadmap_1111_li=ROW_NUMBER() OVER([ORDER BY columnName]) roadmap_1112_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_1113_li=Compatibility\: in MySQL, HSQLDB, /0.0 is NULL; in PostgreSQL, Derby\: division by zero roadmap_1114_li=Functional tables should accept parameters from other tables (see FunctionMultiReturn) SELECT * FROM TEST T, P2C(T.A, T.R) roadmap_1115_li=Custom class loader to reload functions on demand roadmap_1116_li=Test http\://mysql-je.sourceforge.net/ roadmap_1117_li=Close all files when closing the database (including LOB files that are open on the client side) roadmap_1118_li=EXE file\: maybe use http\://jsmooth.sourceforge.net roadmap_1119_li=Performance\: automatically build in-memory indexes if the whole table is in memory roadmap_1120_li=H2 Console\: the webclient could support more features like phpMyAdmin. roadmap_1121_li=Use Janino to convert Java to C++ roadmap_1122_li=The HELP information schema can be directly exposed in the Console roadmap_1123_li=Maybe use the 0x1234 notation for binary fields, see MS SQL Server roadmap_1124_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_1125_li=SQL Server 2005, Oracle\: support COUNT(*) OVER(). See http\://www.orafusion.com/art_anlytc.htm roadmap_1126_li=SQL 2003 (http\://www.wiscorp.com/sql_2003_standard.zip) roadmap_1127_li=Version column (number/sequence and timestamp based) roadmap_1128_li=Optimize getGeneratedKey\: send last identity after each execute (server). roadmap_1129_li=Test and document UPDATE TEST SET (ID, NAME) \= (SELECT ID*10, NAME || '\!' FROM TEST T WHERE T.ID\=TEST.ID); roadmap_1130_li=Max memory rows / max undo log size\: use block count / row size not row count roadmap_1131_li=Support 123L syntax as in Java; example\: SELECT (2000000000*2) roadmap_1132_li=Implement point-in-time recovery roadmap_1133_li=LIKE\: improved version for larger texts (currently using naive search) roadmap_1134_li=Automatically convert to the next 'higher' data type whenever there is an overflow. roadmap_1135_li=Throw an exception when the application calls getInt on a Long (optional) roadmap_1136_li=Default date format for input and output (local date constants) roadmap_1137_li=Support custom Collators roadmap_1138_li=Document ROWNUM usage for reports\: SELECT ROWNUM, * FROM (subquery) roadmap_1139_li=Clustering\: when a database is back alive, automatically synchronize with the master roadmap_1140_li=File system that writes to two file systems (replication, replicating file system) roadmap_1141_li=Standalone tool to get relevant system properties and add it to the trace output. roadmap_1142_li=Support 'call proc(1\=value)' (PostgreSQL, Oracle) roadmap_1143_li=JAMon (proxy jdbc driver) roadmap_1144_li=Console\: improve editing data (Tab, Shift-Tab, Enter, Up, Down, Shift+Del?) roadmap_1145_li=Console\: autocomplete Ctrl+Space inserts template roadmap_1146_li=Option to encrypt .trace.db file roadmap_1147_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_1148_li=Functions with unknown return or parameter data types\: serialize / deserialize roadmap_1149_li=Test if idle TCP connections are closed, and how to disable that roadmap_1150_li=Try using a factory for Row, Value[] (faster?), http\://javolution.org/, alternative ObjectArray / IntArray roadmap_1151_li=Auto-Update feature for database, .jar file roadmap_1152_li=ResultSet SimpleResultSet.readFromURL(String url)\: id varchar, state varchar, released timestamp roadmap_1153_li=Partial indexing (see PostgreSQL) roadmap_1154_li=Add GUI to build a custom version (embedded, fulltext,...) using build flags roadmap_1155_li=http\://rubyforge.org/projects/hypersonic/ roadmap_1156_li=Add comparator (x \=\=\= y) \: (x \= y or (x is null and y is null)) roadmap_1157_li=Try to create trace file even for read only databases roadmap_1158_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_1159_li=Count on a column that can not be null could be optimized to COUNT(*) roadmap_1160_li=Table order\: ALTER TABLE TEST ORDER BY NAME DESC (MySQL compatibility) roadmap_1161_li=Issue 159\: System property for the H2 Console and TCP configuration (which .h2.server.properties and .h2.keystore to use) roadmap_1162_li=Backup tool should work with other databases as well roadmap_1163_li=Console\: -ifExists doesn't work for the console. Add a flag to disable other dbs roadmap_1164_li=Check if 'FSUTIL behavior set disablelastaccess 1' improves the performance (fsutil behavior query disablelastaccess) roadmap_1165_li=Java static code analysis\: http\://pmd.sourceforge.net/ roadmap_1166_li=Java static code analysis\: http\://www.eclipse.org/tptp/ roadmap_1167_li=Compatibility for CREATE SCHEMA AUTHORIZATION roadmap_1168_li=Implement Clob / Blob truncate and the remaining functionality roadmap_1169_li=Maybe close LOBs after closing connection roadmap_1170_li=Tree join functionality roadmap_1171_li=Add multiple columns at the same time with ALTER TABLE .. ADD .. ADD .. roadmap_1172_li=Add H2 to Gem (Ruby install system) roadmap_1173_li=API for functions / user tables roadmap_1174_li=Order conditions inside AND / OR to optimize the performance roadmap_1175_li=Support Oracle functions\: TRUNC, NVL2, TO_CHAR, TO_DATE, TO_NUMBER roadmap_1176_li=Support linked JCR tables roadmap_1177_li=Make sure H2 is supported by Execute Query\: http\://executequery.org/ roadmap_1178_li=Read InputStream when executing, as late as possible (maybe only embedded mode). Problem with re-execute. roadmap_1179_li=Native fulltext search\: min word length; store word positions roadmap_1180_li=Add an option to the SCRIPT command to generate only portable / standard SQL roadmap_1181_li=Test Dezign for Databases (http\://www.datanamic.com) roadmap_1182_li=Fast library for parsing / formatting\: http\://javolution.org/ roadmap_1183_li=Updatable Views (simple cases first) roadmap_1184_li=Improve create index performance roadmap_1185_li=Implement more JDBC 4.0 features roadmap_1186_li=Support TRANSFORM / PIVOT as in MS Access roadmap_1187_li=SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...) roadmap_1188_li=Support updatable views with join on primary keys (to extend a table) roadmap_1189_li=Public interface for functions (not public static) roadmap_1190_li=Autocomplete\: if I type the name of a table that does not exist (should say\: syntax not supported) roadmap_1191_li=Eliminate undo log records if stored on disk (just one pointer per block, not per record) roadmap_1192_li=Feature matrix as in <a href\="http\://www.inetsoftware.de/products/jdbc/mssql/features/default.asp">i-net software</a>. roadmap_1193_li=Updatable result set on table without primary key or unique index roadmap_1194_li=Use LinkedList instead of ArrayList where applicable roadmap_1195_li=Allow execution time prepare for SELECT * FROM CSVREAD(?, 'columnNameString') roadmap_1196_li=Support % operator (modulo) roadmap_1197_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_1198_li=Support 1+'2'\=3, '1'+'2'\='12' (MS SQL Server compatibility) roadmap_1199_li=Support nested transactions roadmap_1200_li=Add a benchmark for big databases, and one for many users roadmap_1201_li=Compression in the result set (repeating values in the same column) over TCP/IP roadmap_1202_li=Support curtimestamp (like curtime, curdate) roadmap_1203_li=Support ANALYZE {TABLE|INDEX} tableName COMPUTE|ESTIMATE|DELETE STATISTICS ptnOption options roadmap_1204_li=Support Sequoia (Continuent.org) roadmap_1205_li=Dynamic length numbers / special methods for DataPage.writeByte / writeShort / Ronni Nielsen roadmap_1206_li=Pluggable ThreadPool, (AvalonDB / deebee / Paul Hammant) roadmap_1207_li=Release locks (shared or exclusive) on demand roadmap_1208_li=Support OUTER UNION roadmap_1209_li=Support parameterized views (similar to CSVREAD, but using just SQL for the definition) roadmap_1210_li=A way (JDBC driver) to map an URL (jdbc\:h2map\:c1) to a connection object roadmap_1211_li=Option for SCRIPT to only process one or a set of tables, and append to a file roadmap_1212_li=Support linked tables to the current database roadmap_1213_li=Support dynamic linked schema (automatically adding/updating/removing tables) roadmap_1214_li=Compatibility with Derby\: VALUES(1), (2); SELECT * FROM (VALUES (1), (2)) AS myTable(c1) roadmap_1215_li=Compatibility\: \# is the start of a single line comment (MySQL) but date quote (Access). Mode specific roadmap_1216_li=Run benchmarks with JDK 1.5, JDK 1.6, java -server roadmap_1217_li=Optimizations\: faster hash function for strings, byte arrays roadmap_1218_li=DatabaseEventListener\: callback for all operations (including expected time, RUNSCRIPT) and cancel functionality roadmap_1219_li=H2 Console / large result sets\: use 'streaming' instead of building the page in-memory roadmap_1220_li=Benchmark\: add a graph to show how databases scale (performance/database size) roadmap_1221_li=Implement a SQLData interface to map your data over to a custom object roadmap_1222_li=In the MySQL and PostgreSQL mode, use lower case identifiers by default (DatabaseMetaData.storesLowerCaseIdentifiers \= true) roadmap_1223_li=Support multiple directories (on different hard drives) for the same database roadmap_1224_li=Server protocol\: use challenge response authentication, but client sends hash(user+password) encrypted with response roadmap_1225_li=Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server) roadmap_1226_li=Support native XML data type roadmap_1227_li=Support triggers with a string property or option\: SpringTrigger, OSGITrigger roadmap_1228_li=Clustering\: adding a node should be very fast and without interrupting clients (very short lock) roadmap_1229_li=Ability to resize the cache array when resizing the cache roadmap_1230_li=Time based cache writing (one second after writing the log) roadmap_1231_li=Check state of H2 driver for DDLUtils\: https\://issues.apache.org/jira/browse/DDLUTILS-185 roadmap_1232_li=Index usage for REGEXP LIKE. roadmap_1233_li=Compatibility\: add a role DBA (like ADMIN). roadmap_1234_li=Better support multiple processors for in-memory databases. roadmap_1235_li=Support N'text' roadmap_1236_li=Pure SQL triggers (example\: update parent table if the child table is changed). roadmap_1237_li=In MySQL mode, for AUTO_INCREMENT columns, don't set the primary key roadmap_1238_li=Use JDK 1.4 file locking to create the lock file (but not yet by default); writing a system property to detect concurrent access from the same VM (different classloaders). roadmap_1239_li=Support compatibility for jdbc\:hsqldb\:res\: roadmap_1240_li=Provide an Java SQL builder with standard and H2 syntax roadmap_1241_li=Trace\: write OS, file system, JVM,... when opening the database roadmap_1242_li=Support indexes for views (probably requires materialized views) roadmap_1243_li=Document SET SEARCH_PATH, BEGIN, EXECUTE, parameters roadmap_1244_li=Browser\: use Desktop.isDesktopSupported and browse when using JDK 1.6 roadmap_1245_li=Server\: use one listener (detect if the request comes from an PG or TCP client) roadmap_1246_li=Support data type INTERVAL roadmap_1247_li=Optimize SELECT MIN(ID), MAX(ID), COUNT(*) FROM TEST WHERE ID BETWEEN 100 AND 200 roadmap_1248_li=Sequence\: PostgreSQL compatibility (rename, create) (http\://www.postgresql.org/docs/8.2/static/sql-altersequence.html) roadmap_1249_li=DISTINCT\: support large result sets by sorting on all columns (additionally) and then removing duplicates. roadmap_1250_li=File system with a background writer thread; test if this is faster roadmap_1251_li=Better document the source code roadmap_1252_li=Support select * from dual a left join dual b on b.x\=(select max(x) from dual) roadmap_1253_li=Optimization\: don't lock when the database is read-only roadmap_1254_li=Issue 146\: Support merge join. roadmap_1255_li=Integrate spatial functions from http\://geosysin.iict.ch/irstv-trac/wiki/H2spatial/Download roadmap_1256_li=Support COSH, SINH, and TANH functions roadmap_1257_li=Oracle\: support DECODE method (convert to CASE WHEN). roadmap_1258_li=Native search\: support "phrase search", wildcard search (* and ?), case-insensitive search, boolean operators, and grouping roadmap_1259_li=Improve documentation of access rights roadmap_1260_li=Support ENUM data type (see MySQL, PostgreSQL, MS SQL Server, maybe others) roadmap_1261_li=Support a schema name for Java functions roadmap_1262_li=Remember the user defined data type (domain) of a column roadmap_1263_li=Support Jackcess (MS Access databases) roadmap_1264_li=Built-in methods to write large objects (BLOB and CLOB)\: FILE_WRITE('test.txt', 'Hello World') roadmap_1265_li=MVCC\: support transactionally consistent backups using SCRIPT roadmap_1266_li=Improve time to open large databases (see mail 'init time for distributed setup') roadmap_1267_li=Move Maven 2 repository from hsql.sf.net to h2database.sf.net roadmap_1268_li=Java 1.5 tool\: JdbcUtils.closeSilently(s1, s2,...) roadmap_1269_li=Javadoc\: document design patterns used roadmap_1270_li=Write an article about SQLInjection (h2/src/docsrc/html/images/SQLInjection.txt) roadmap_1271_li=Convert SQL-injection-2.txt to html document, include SQLInjection.java sample roadmap_1272_li=Improve LOB in directories performance roadmap_1273_li=Web site design\: http\://www.igniterealtime.org/projects/openfire/index.jsp roadmap_1274_li=HSQLDB compatibility\: Openfire server uses\: CREATE SCHEMA PUBLIC AUTHORIZATION DBA; CREATE USER SA PASSWORD ""; GRANT DBA TO SA; SET SCHEMA PUBLIC roadmap_1275_li=Translation\: use ?? in help.csv roadmap_1276_li=Translated .pdf roadmap_1277_li=Cluster\: hot deploy (adding a node at runtime) roadmap_1278_li=MySQL compatibility\: update test1 t1, test2 t2 set t1.id \= t2.id where t1.id \= t2.id; roadmap_1279_li=Recovery tool\: bad blocks should be converted to INSERT INTO SYSTEM_ERRORS(...), and things should go into the .trace.db file roadmap_1280_li=RECOVER\=2 to backup the database, run recovery, open the database roadmap_1281_li=Recovery should work with encrypted databases roadmap_1282_li=Corruption\: new error code, add help roadmap_1283_li=Space reuse\: after init, scan all storages and free those that don't belong to a live database object roadmap_1284_li=Use FilterIn / FilterOut putStream? roadmap_1285_li=Access rights\: add missing features (users should be 'owner' of objects; missing rights for sequences; dropping objects) roadmap_1286_li=Support NOCACHE table option (Oracle). roadmap_1287_li=Support table partitioning. roadmap_1288_li=Index usage for UPDATE ... WHERE .. IN (SELECT...) roadmap_1289_li=Add regular javadocs (using the default doclet, but another css) to the homepage. roadmap_1290_li=The database should be kept open for a longer time when using the server mode. roadmap_1291_li=Javadocs\: for each tool, add a copy & paste sample in the class level. roadmap_1292_li=Javadocs\: add @author tags. roadmap_1293_li=Fluent API for tools\: Server.createTcpServer().setPort(9081).setPassword(password).start(); roadmap_1294_li=MySQL compatibility\: real SQL statement for DESCRIBE TEST roadmap_1295_li=Use a default delay of 1 second before closing a database. roadmap_1296_li=Write (log) to system table before adding to internal data structures. roadmap_1297_li=Support very large deletes and updates. roadmap_1298_li=Doclet (javadocs)\: constructors are not listed. roadmap_1299_li=Support direct lookup for MIN and MAX when using WHERE (see todo.txt / Direct Lookup). roadmap_1300_li=Support other array types (String[], double[]) in PreparedStatement.setObject(int, Object); roadmap_1301_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_1302_li=Oracle compatibility\: support NLS_DATE_FORMAT. roadmap_1303_li=H2 Console\: support CLOB/BLOB download using a link. roadmap_1304_li=Support flashback queries as in Oracle. roadmap_1305_li=Import / Export of fixed with text files. roadmap_1306_li=Support OUT parameters in user-defined procedures. roadmap_1307_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_1308_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_1309_li=Improve the optimizer to select the right index for special cases\: where id between 2 and 4 and booleanColumn roadmap_1310_li=Linked tables\: make hidden columns available (Oracle\: rowid and ora_rowscn columns). roadmap_1311_li=H2 Console\: in-place autocomplete. roadmap_1312_li=Support large databases\: split LOB (BLOB, CLOB) to multiple directories / disks (similar to tablespaces). roadmap_1313_li=Support to assign a primary key index a user defined name. roadmap_1314_li=Cluster\: add feature to make sure cluster nodes can not get out of sync (for example by stopping one process). roadmap_1315_li=H2 Console\: support configuration option for fixed width (monospace) font. roadmap_1316_li=Native fulltext search\: support analyzers (specially for Chinese, Japanese). roadmap_1317_li=Automatically compact databases from time to time (as a background process). roadmap_1318_li=Support GRANT SELECT, UPDATE ON *. roadmap_1319_li=Test Eclipse DTP. roadmap_1320_li=H2 Console\: autocomplete\: keep the previous setting roadmap_1321_li=MySQL, MS SQL Server compatibility\: support case sensitive (mixed case) identifiers without quotes. roadmap_1322_li=executeBatch\: option to stop at the first failed statement. roadmap_1323_li=Implement OLAP features as described here\: http\://www.devx.com/getHelpOn/10MinuteSolution/16573/0/page/5 roadmap_1324_li=Support Oracle ROWID (unique identifier for each row). roadmap_1325_li=Server mode\: improve performance for batch updates. roadmap_1326_li=Applets\: support read-only databases in a zip file (accessed as a resource). roadmap_1327_li=Long running queries / errors / trace system table. roadmap_1328_li=H2 Console should support JaQu directly. roadmap_1329_li=H2 Console\: support single file upload and directory download (optional). roadmap_1330_li=Document FTL_SEARCH, FTL_SEARCH_DATA. roadmap_1331_li=Sequences\: CURRVAL should be session specific. Compatibility with PostgreSQL. roadmap_1332_li=Support DatabaseMetaData.insertsAreDetected\: updatable result sets should detect inserts. roadmap_1333_li=Auto-server\: add option to define the IP address range or list. roadmap_1334_li=Index creation using deterministic functions. roadmap_1335_li=Use http\://recaptcha.net somehow to secure the Google Group. roadmap_1336_li=Support DELETE with TOP or LIMIT. See also\: http\://dev.mysql.com/doc/refman/5.1/de/delete.html roadmap_1337_li=ANALYZE\: use a bloom filter for each indexed column to estimate count of distinct values. roadmap_1338_li=ANALYZE\: for unique indexes that allow null, count the number of null. roadmap_1339_li=AUTO_SERVER\: support changing IP addresses (disable a network while the database is open). roadmap_1340_li=Avoid using java.util.Calendar internally because it's slow, complicated, and buggy. roadmap_1341_li=Support TRUNCATE .. CASCADE like PostgreSQL. roadmap_1342_li=Support opening a database that is in the classpath, maybe using a new file system. roadmap_1343_li=Fulltext search\: lazy result generation using SimpleRowSource. roadmap_1344_li=Support transformation to join for user defined functions, as for IN(SELECT...). roadmap_1345_li=Fulltext search\: support alternative syntax\: WHERE FTL_CONTAINS(name, 'hello'). roadmap_1346_li=MySQL compatibility\: support REPLACE, see http\://dev.mysql.com/doc/refman/5.1/de/replace.html roadmap_1347_li=MySQL compatibility\: support INSERT INTO table SET column1 \= value1, column2 \= value2 roadmap_1348_li=Docs\: add a one line description for each functions and SQL statements at the top (in the link section). roadmap_1349_li=Javadoc search\: weight for titles should be higher ('random' should list Functions as the best match). roadmap_1350_li=Replace information_schema tables with regular tables that are automatically re-built when needed. Use indexes. roadmap_1351_li=Support a special trigger on all tables. roadmap_1352_li=Delete temporary files or objects using finalize. roadmap_1353_li=Oracle compatibility\: support calling 0-parameters functions without parenthesis. Make constants obsolete. roadmap_1354_li=MySQL, HSQLDB compatibility\: support where 'a'\=1 (not supported by Derby, PostgreSQL) roadmap_1355_li=Allow calling function with no parameters without parenthesis. See http\://code.google.com/p/h2database/issues/detail?id\=50 roadmap_1356_li=CSV\: currently \# is a line comment and can start at any field. Make it optional. roadmap_1357_li=Finer granularity for SLF4J trace - See http\://code.google.com/p/h2database/issues/detail?id\=62 roadmap_1358_li=Add database creation date and time to the database. roadmap_1359_li=Support ASSERTIONS. roadmap_1360_li=Support multi-threaded kernel with multi-version concurrency. roadmap_1361_li=MySQL compatibility\: support comparing 1\='a' roadmap_1362_li=Support PostgreSQL lock modes\: http\://www.postgresql.org/docs/8.3/static/explicit-locking.html roadmap_1363_li=PostgreSQL compatibility\: test DbVisualizer and Squirrel SQL using a new PostgreSQL JDBC driver. roadmap_1364_li=RunScript should be able to read from system in (or quite mode for Shell). roadmap_1365_li=Natural join\: support select x from dual natural join dual. roadmap_1366_li=Natural join\: somehow support this\: select a.x, b.x, x from dual a natural join dual b roadmap_1367_li=MySQL compatibility\: for auto_increment columns, convert 0 to next value (as when inserting NULL). roadmap_1368_li=Optimization for multi-column IN\: use an index if possible. Example\: (A, B) IN((1, 2), (2, 3)). roadmap_1369_li=Optimization for EXISTS\: convert to inner join or IN(..) if possible. roadmap_1370_li=Functions\: support hashcode(value); cryptographic and fast roadmap_1371_li=Serialized file lock\: support long running queries. roadmap_1372_li=Network\: use 127.0.0.1 if other addresses don't work. roadmap_1373_li=Pluggable network protocol (currently Socket/ServerSocket over TCP/IP) - see also TransportServer with master slave replication. roadmap_1374_li=Select for update in mvcc mode\: only lock the selected records. roadmap_1375_li=Support reading JCR data\: one table per node type; query table; cache option roadmap_1376_li=OSGi\: create a sample application, test, document. roadmap_1377_li=help.csv\: use complete examples for functions; run as test case. roadmap_1378_li=Functions to calculate the memory and disk space usage of a table, a row, or a value. roadmap_1379_li=If the database URL ends with ";INIT\=<url>" then the SQL script from the given file or URL is executed (the user name must have admin rights). Example URL\: jdbc\:h2\:mem\:test;INIT\=~/init.sql roadmap_1380_li=Re-implement PooledConnection; use a lightweight connection object. roadmap_1381_li=Doclet\: convert tests in javadocs to a java class. roadmap_1382_li=Doclet\: format fields like methods, but support sorting by name and value. roadmap_1383_li=Doclet\: shrink the html files. roadmap_1384_li=MySQL compatibility\: support REPLACE - See http\://code.google.com/p/h2database/issues/detail?id\=73 roadmap_1385_li=MySQL compatibility\: support SET NAMES 'latin1' - See also http\://code.google.com/p/h2database/issues/detail?id\=56 roadmap_1386_li=MySQL compatibility\: DELETE .. FROM .. USING - See http\://dev.mysql.com/doc/refman/5.0/en/delete.html roadmap_1387_li=Allow to scan index backwards starting with a value (to better support ORDER BY DESC). roadmap_1388_li=Java Service Wrapper\: try http\://yajsw.sourceforge.net/ roadmap_1389_li=Batch parameter for INSERT, UPDATE, and DELETE, and commit after each batch. See also MySQL DELETE. roadmap_1390_li=MySQL compatibility\: support ALTER TABLE .. MODIFY COLUMN. roadmap_1391_li=Use a lazy and auto-close input stream (open resource when reading, close on eof). roadmap_1392_li=PostgreSQL compatibility\: generate_series. roadmap_1393_li=Connection pool\: 'reset session' command (delete temp tables, rollback, autocommit true). roadmap_1394_li=Improve SQL documentation, see http\://www.w3schools.com/sql/ roadmap_1395_li=MySQL compatibility\: DatabaseMetaData.stores*() methods should return the same values. Test with SquirrelSQL. roadmap_1396_li=MS SQL Server compatibility\: support DATEPART syntax. roadmap_1397_li=Oracle compatibility\: support CREATE OR REPLACE VIEW syntax. roadmap_1398_li=Sybase/DB2/Oracle compatibility\: support out parameters in stored procedures - See http\://code.google.com/p/h2database/issues/detail?id\=83 roadmap_1399_li=Support INTERVAL data type (see Oracle and others). roadmap_1400_li=Combine Server and Console tool (only keep Server). roadmap_1401_li=Store the Lucene index in the database itself. roadmap_1402_li=Support standard MERGE statement\: http\://en.wikipedia.org/wiki/Merge_%28SQL%29 roadmap_1403_li=Oracle compatibility\: support DECODE(x, ...). roadmap_1404_li=Console\: Start Browser\: if ip number changed, try localhost instead. roadmap_1405_li=MVCC\: compare concurrent update behavior with PostgreSQL and Oracle. roadmap_1406_li=HSQLDB compatibility\: CREATE FUNCTION (maybe using a Function interface). roadmap_1407_li=HSQLDB compatibility\: support CALL "java.lang.Math.sqrt"(2.0) roadmap_1408_li=Support comma as the decimal separator in the CSV tool. roadmap_1409_li=Compatibility\: Support jdbc\:default\:connection using ThreadLocal (part of SQLJ) roadmap_1410_li=Compatibility\: Java functions with SQLJ Part1 http\://www.acm.org/sigmod/record/issues/9912/standards.pdf.gz roadmap_1411_li=Compatibility\: Java functions with SQL/PSM (Persistent Stored Modules) - need to find the documentation. roadmap_1412_li=CACHE_SIZE\: automatically use a fraction of Runtime.maxMemory - maybe automatically the second level cache. roadmap_1413_li=Support date/time/timestamp as documented in http\://en.wikipedia.org/wiki/ISO_8601 roadmap_1414_li=PostgreSQL compatibility\: when in PG mode, treat BYTEA data like PG. roadmap_1415_li=MySQL compatibility\: REPLACE http\://dev.mysql.com/doc/refman/6.0/en/replace.html roadmap_1416_li=Support \=ANY(array) as in PostgreSQL. roadmap_1417_li=IBM DB2 compatibility\: support PREVIOUS VALUE FOR sequence. roadmap_1418_li=MySQL compatibility\: alter table add index i(c), add constraint c foreign key(c) references t(c); roadmap_1419_li=Compatibility\: use different LIKE ESCAPE characters depending on the mode (disable for Derby, HSQLDB, DB2, Oracle, MSSQLServer). roadmap_1420_li=Oracle compatibility\: support CREATE SYNONYM table FOR schema.table. roadmap_1421_li=Optimize A\=? OR B\=? to UNION if the cost is lower. roadmap_1422_li=FTP\: document the server, including -ftpTask option to execute / kill remote processes roadmap_1423_li=FTP\: problems with multithreading? roadmap_1424_li=FTP\: implement SFTP / FTPS roadmap_1425_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_1426_li=More secure default configuration if remote access is enabled. roadmap_1427_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_1428_li=Document internal features such as BELONGS_TO_TABLE, NULL_TO_DEFAULT, SEQUENCE. roadmap_1429_li=Issue 107\: Prefer using the ORDER BY index if LIMIT is used. roadmap_1430_li=An index on (id, name) should be used for a query\: select * from t where s\=? order by i roadmap_1431_li=Support reading sequences using DatabaseMetaData.getTables(null, null, null, new String[]{"SEQUENCE"}). See PostgreSQL. roadmap_1432_li=Add option to enable TCP_NODELAY using Socket.setTcpNoDelay(true). roadmap_1433_li=Maybe disallow \= within database names (jdbc\:h2\:mem\:MODE\=DB2 means database name MODE\=DB2). roadmap_1434_li=Fast alter table add column. roadmap_1435_li=Improve concurrency for in-memory database operations. roadmap_1436_li=Issue 122\: Support for connection aliases for remote tcp connections. roadmap_1437_li=Fast scrambling (strong encryption doesn't help if the password is included in the application). roadmap_1438_li=Faster startup if there is a large number of LOB files. roadmap_1439_li=Support using system properties in database URLs (may be a security problem). roadmap_1440_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_1441_li=Issue 127\: Support activation/deactivation of triggers roadmap_1442_li=Issue 130\: Custom log event listeners roadmap_1443_li=Issue 131\: IBM DB2 compatibility\: sysibm.sysdummy1 roadmap_1444_li=Issue 132\: Use Java enum trigger type. roadmap_1445_li=Issue 134\: IBM DB2 compatibility\: session global variables. roadmap_1446_li=FTL_SET_OPTION(keyString, valueString) with key stopWords at first. roadmap_1447_li=Pluggable access control mechanism. roadmap_1448_li=Fulltext search (Lucene)\: support streaming CLOB data. roadmap_1449_li=Document/example how to create and read an encrypted script file. roadmap_1450_li=Check state of https\://issues.apache.org/jira/browse/OPENJPA-1367 (H2 does support cross joins). roadmap_1451_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_1452_li=Support a way to create or read compressed encrypted script files using an API. roadmap_1453_li=Scripting language support (Javascript). roadmap_1454_li=The network client should better detect if the server is not an H2 server and fail early. roadmap_1455_li=H2 Console\: support CLOB/BLOB upload. roadmap_1456_li=Recover tool\: stream blob / clob data (problem\: currently using varchar data type). roadmap_1457_li=Move away from system properties where possible. roadmap_1458_li=Database file lock\: detect hibernate / standby / very slow threads (compare system time). roadmap_1459_li=Automatic detection of redundant indexes. roadmap_1460_li=Maybe reject join without "on" (except natural join). roadmap_1461_li=Cluster\: support load balance with values for each server / auto detect. roadmap_1462_li=Implement GiST (Generalized Search Tree for Secondary Storage). roadmap_1463_li=Function to read a number of bytes/characters from an BLOB or CLOB. roadmap_1464_li=Issue 156\: Support SELECT ? UNION SELECT ?. roadmap_1465_li=Automatic mixed mode\: support a port range list (to avoid firewall problems). roadmap_1466_li=Support the pseudo column rowid, oid, _rowid_. roadmap_1467_li=Support TRUNCATE for linked tables. roadmap_1468_li=UNION\: evaluate INTERSECT before UNION (like most other database except Oracle). roadmap_1469_li=Delay creating the information schema, and share metadata columns. roadmap_1470_li=TCP Server\: use a nonce (number used once) to protect unencrypted channels against replay attacks. roadmap_1471_li=Simplify running scripts and recovery\: CREATE FORCE USER (overwrites an existing user). roadmap_1472_li=Support CREATE DATABASE LINK (a custom JDBC driver is already supported). roadmap_1473_li=Issue 163\: Allow to create foreign keys on metadata types. roadmap_1474_li=Logback\: write a native DBAppender. roadmap_1475_li=Cache size\: don't use more cache than what is available. roadmap_1476_li=Use the Java service provider mechanism to register file systems and function libraries. roadmap_1477_h2=Not Planned roadmap_1478_li=HSQLDB (did) support this\: select id i from test where i<0 (other databases don't). Supporting it may break compatibility. roadmap_1479_li=String.intern (so that Strings can be compared with \=\=) will not be used because some VMs have problems when used extensively. roadmap_1480_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= <a href\="javascript\:select('details')" id \= "detailsTab">Details</a> <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_b=Search\: tutorial_1001_td=Highlight keyword(s) tutorial_1002_a=Home tutorial_1003_a=Download tutorial_1004_a=Cheat Sheet tutorial_1005_b=Documentation tutorial_1006_a=Quickstart tutorial_1007_a=Installation tutorial_1008_a=Tutorial tutorial_1009_a=Features tutorial_1010_a=Performance tutorial_1011_a=Advanced tutorial_1012_b=Reference tutorial_1013_a=SQL Grammar tutorial_1014_a=Functions tutorial_1015_a=Data Types tutorial_1016_a=Javadoc tutorial_1017_a=PDF (1 MB) tutorial_1018_b=Support tutorial_1019_a=FAQ tutorial_1020_a=Error Analyzer tutorial_1021_a=Google Group (English) tutorial_1022_a=Google Group (Japanese) tutorial_1023_a=Google Group (Chinese) tutorial_1024_b=Appendix tutorial_1025_a=JaQu tutorial_1026_a=Build tutorial_1027_a=History & Roadmap tutorial_1028_a=Links tutorial_1029_a=License tutorial_1030_td= tutorial_1031_h1=Tutorial tutorial_1032_a=\ Starting and Using the H2 Console tutorial_1033_a=\ Settings of the H2 Console tutorial_1034_a=\ Connecting to a Database using JDBC tutorial_1035_a=\ Creating New Databases tutorial_1036_a=\ Using the Server tutorial_1037_a=\ Using Hibernate tutorial_1038_a=\ Using TopLink and Glassfish tutorial_1039_a=\ Using EclipseLink tutorial_1040_a=\ Using Databases in Web Applications tutorial_1041_a=\ CSV (Comma Separated Values) Support tutorial_1042_a=\ Upgrade, Backup, and Restore tutorial_1043_a=\ Command Line Tools tutorial_1044_a=\ The Shell Tool tutorial_1045_a=\ Using OpenOffice Base tutorial_1046_a=\ Java Web Start / JNLP tutorial_1047_a=\ Using a Connection Pool tutorial_1048_a=\ Fulltext Search tutorial_1049_a=\ User-Defined Variables tutorial_1050_a=\ Date and Time tutorial_1051_a=\ Using Spring tutorial_1052_h2=Starting and Using the H2 Console tutorial_1053_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_1054_p=\ This is a client / server application, so both a server and a client (a browser) are required to run it. tutorial_1055_p=\ Depending on your platform and environment, there are multiple ways to start the application\: tutorial_1056_th=OS tutorial_1057_th=Start tutorial_1058_td=Windows tutorial_1059_td=\ Click [Start], [All Programs], [H2], and [H2 Console (Command Line)] tutorial_1060_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_1061_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_1062_td=Windows tutorial_1063_td=\ Open a file browser, navigate to <code>h2/bin</code>, and double click on <code>h2.bat</code>. tutorial_1064_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_1065_td=Any tutorial_1066_td=\ Double click on the <code>h2*.jar</code> file. This only works if the <code>.jar</code> suffix is associated with java. tutorial_1067_td=Any tutorial_1068_td=\ Open a console window, navigate to the directory <code>h2/bin</code> and type\: tutorial_1069_h3=Firewall tutorial_1070_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_1071_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_1072_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_1073_h3=Testing Java tutorial_1074_p=\ To find out which version of Java is installed, open a command prompt and type\: tutorial_1075_p=\ If you get an error message, you may need to add the Java binary directory to the path environment variable. tutorial_1076_h3=Error Message 'Port may be in use' tutorial_1077_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_1078_h3=Using another Port tutorial_1079_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/<username></code>). The relevant entry is webPort. tutorial_1080_h3=Connecting to the Server using a Browser tutorial_1081_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_1082_h3=Multiple Concurrent Sessions tutorial_1083_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_1084_h3=Login tutorial_1085_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_1086_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_1087_h3=Error Messages tutorial_1088_p=\ Error messages in are shown in red. You can show/hide the stack trace of the exception by clicking on the message. tutorial_1089_h3=Adding Database Drivers tutorial_1090_p=\ Additional database drivers 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_1091_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_1092_h3=Using the H2 Console tutorial_1093_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_1094_h3=Inserting Table Names or Column Names tutorial_1095_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_1096_h3=Disconnecting and Stopping the Application tutorial_1097_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_1098_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_1099_h2=Settings of the H2 Console tutorial_1100_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_1101_h2=Connecting to a Database using JDBC tutorial_1102_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_1103_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_1104_h2=Creating New Databases tutorial_1105_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_1106_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_1107_h2=Using the Server tutorial_1108_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). The servers can be started in different ways, one is using the <code>Server</code> tool. tutorial_1109_h3=Starting the Server Tool from Command Line tutorial_1110_p=\ To start the <code>Server</code> tool from the command line with the default settings, run\: tutorial_1111_p=\ This will start the tool with the default options. To get the list of options and default values, run\: tutorial_1112_p=\ There are options available to use other ports, and start or not start parts. tutorial_1113_h3=Connecting to the TCP Server tutorial_1114_p=\ To remotely connect to a database using the TCP server, use the following driver and database URL\: tutorial_1115_li=JDBC driver class\: <code>org.h2.Driver</code> tutorial_1116_li=Database URL\: <code>jdbc\:h2\:tcp\://localhost/~/test</code> tutorial_1117_p=\ For details about the database URL, see also in Features. tutorial_1118_h3=Starting the TCP Server within an Application tutorial_1119_p=\ Servers can also be started and stopped from within an application. Sample code\: tutorial_1120_h3=Stopping a TCP Server from Another Process tutorial_1121_p=\ The TCP server can be stopped from another process. To stop the server from the command line, run\: tutorial_1122_p=\ To stop the server from a user application, use the following code\: tutorial_1123_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_1124_h2=Using Hibernate tutorial_1125_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 Hibernate is buggy. A <a href\="http\://opensource.atlassian.com/projects/hibernate/browse/HHH-3401">patch for Hibernate</a> has been submitted. The dialect for the newest version of Hibernate is also available at <code>src/tools/org/hibernate/dialect/H2Dialect.java.txt</code>. You can rename it to <code>H2Dialect.java</code> and include this as a patch in your application. tutorial_1126_h2=Using TopLink and Glassfish tutorial_1127_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_1128_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_1129_p=\ In old versions of Glassfish, the property name is <code>toplink.platform.class.name</code>. tutorial_1130_h2=Using EclipseLink tutorial_1131_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_1132_h2=Using Databases in Web Applications tutorial_1133_p=\ There are multiple ways to access a database from within web applications. Here are some examples if you use Tomcat or JBoss. tutorial_1134_h3=Embedded Mode tutorial_1135_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_1136_h3=Server Mode tutorial_1137_p=\ The server mode is similar, but it allows you to run the server in another process. tutorial_1138_h3=Using a Servlet Listener to Start and Stop a Database tutorial_1139_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_1140_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_1141_code=DbStarter tutorial_1142_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_1143_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_1144_h3=Using the H2 Console Servlet tutorial_1145_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_1146_p=\ For details, see also <code>src/tools/WEB-INF/web.xml</code>. tutorial_1147_p=\ To create a web application with just the H2 Console, run the following command\: tutorial_1148_h2=CSV (Comma Separated Values) Support tutorial_1149_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_1150_h3=Writing a CSV File from Within a Database tutorial_1151_p=\ The built-in function <code>CSVWRITE</code> can be used to create a CSV file from a query. Example\: tutorial_1152_h3=Reading a CSV File from Within a Database tutorial_1153_p=\ A CSV file can be read using the function <code>CSVREAD</code>. Example\: tutorial_1154_h3=Writing a CSV File from a Java Application tutorial_1155_p=\ The <code>Csv</code> tool can be used in a Java application even when not using a database at all. Example\: tutorial_1156_h3=Reading a CSV File from a Java Application tutorial_1157_p=\ It is possible to read a CSV file without opening a database. Example\: tutorial_1158_h2=Upgrade, Backup, and Restore tutorial_1159_h3=Database Upgrade tutorial_1160_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_1161_h3=Backup using the Script Tool tutorial_1162_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_1163_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_1164_h3=Restore from a Script tutorial_1165_p=\ To restore a database from a SQL script file, you can use the <code>RunScript</code> tool\: tutorial_1166_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_1167_h3=Online Backup tutorial_1168_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. Other than the SCRIPT statement, the <code>BACKUP</code> statement does not lock the database objects, and therefore does not block other users. The resulting backup is transactionally consistent\: tutorial_1169_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_1170_p=\ Creating a backup 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_1171_h2=Command Line Tools tutorial_1172_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_1173_p=\ The command line tools are\: tutorial_1174_code=Backup tutorial_1175_li=\ creates a backup of a database. tutorial_1176_code=ChangeFileEncryption tutorial_1177_li=\ allows changing the file encryption password or algorithm of a database. tutorial_1178_code=Console tutorial_1179_li=\ starts the browser based H2 Console. tutorial_1180_code=ConvertTraceFile tutorial_1181_li=\ converts a .trace.db file to a Java application and SQL script. tutorial_1182_code=CreateCluster tutorial_1183_li=\ creates a cluster from a standalone database. tutorial_1184_code=DeleteDbFiles tutorial_1185_li=\ deletes all files belonging to a database. tutorial_1186_code=Recover tutorial_1187_li=\ helps recovering a corrupted database. tutorial_1188_code=Restore tutorial_1189_li=\ restores a backup of a database. tutorial_1190_code=RunScript tutorial_1191_li=\ runs a SQL script against a database. tutorial_1192_code=Script tutorial_1193_li=\ allows converting a database to a SQL script for backup or migration. tutorial_1194_code=Server tutorial_1195_li=\ is used in the server mode to start a H2 server. tutorial_1196_code=Shell tutorial_1197_li=\ is a command line database tool. tutorial_1198_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_1199_h2=The Shell Tool tutorial_1200_p=\ The Shell tool is a simple interactive command line tool. To start it, type\: tutorial_1201_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_1202_p=\ By default, results are printed as a table. For results with many column, consider using the list mode\: tutorial_1203_h2=Using OpenOffice Base tutorial_1204_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_1205_li=Start OpenOffice Writer, go to [Tools], [Options] tutorial_1206_li=Make sure you have selected a Java runtime environment in OpenOffice.org / Java tutorial_1207_li=Click [Class Path...], [Add Archive...] tutorial_1208_li=Select your h2 jar file (location is up to you, could be wherever you choose) tutorial_1209_li=Click [OK] (as much as needed), stop OpenOffice (including the Quickstarter) tutorial_1210_li=Start OpenOffice Base tutorial_1211_li=Connect to an existing database; select [JDBC]; [Next] tutorial_1212_li=Example datasource URL\: <code>jdbc\:h2\:~/test</code> tutorial_1213_li=JDBC driver class\: <code>org.h2.Driver</code> tutorial_1214_p=\ Now you can access the database stored in the current users home directory. tutorial_1215_p=\ To use H2 in NeoOffice (OpenOffice without X11)\: tutorial_1216_li=In NeoOffice, go to [NeoOffice], [Preferences] tutorial_1217_li=Look for the page under [NeoOffice], [Java] tutorial_1218_li=Click [Class Path], [Add Archive...] tutorial_1219_li=Select your h2 jar file (location is up to you, could be wherever you choose) tutorial_1220_li=Click [OK] (as much as needed), restart NeoOffice. tutorial_1221_p=\ Now, when creating a new database using the "Database Wizard" \: tutorial_1222_li=Click [File], [New], [Database]. tutorial_1223_li=Select [Connect to existing database] and the select [JDBC]. Click next. tutorial_1224_li=Example datasource URL\: <code>jdbc\:h2\:~/test</code> tutorial_1225_li=JDBC driver class\: <code>org.h2.Driver</code> tutorial_1226_p=\ Another solution to use H2 in NeoOffice is\: tutorial_1227_li=Package the h2 jar within an extension package tutorial_1228_li=Install it as a Java extension in NeoOffice tutorial_1229_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_1230_h2=Java Web Start / JNLP tutorial_1231_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_1232_h2=Using a Connection Pool tutorial_1233_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_1234_h2=Fulltext Search tutorial_1235_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_1236_h3=Using the Native Fulltext Search tutorial_1237_p=\ To initialize, call\: tutorial_1238_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_1239_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_1240_p=\ This will produce a result set that contains the query needed to retrieve the data\: tutorial_1241_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_1242_p=\ You can also call the index from within a Java application\: tutorial_1243_h3=Using the Lucene Fulltext Search tutorial_1244_p=\ To use the Lucene full text search, you need the Lucene library in the classpath. 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_1245_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_1246_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_1247_p=\ This will produce a result set that contains the query needed to retrieve the data\: tutorial_1248_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_1249_p=\ You can also call the index from within a Java application\: tutorial_1250_h2=User-Defined Variables tutorial_1251_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_1252_p=\ The value can also be changed using the SET() method. This is useful in queries\: tutorial_1253_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_1254_h2=Date and Time tutorial_1255_p=\ Date, time and timestamp values support ISO 8601 formatting, including time zone\: tutorial_1256_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 in GMT (Greenwich Mean Time). If the database is opened using another system time zone, the date and time will change accordingly. If you want to move a database from one time zone to the other and don't want this to happen, you need to create a SQL script file using the <code>SCRIPT</code> command or <code>Script</code> tool, and then load the database using the <code>RUNSCRIPT</code> command or the <code>RunScript</code> tool in the new time zone. tutorial_1257_h2=Using Spring tutorial_1258_p=\ Use the following configuration to start and stop the H2 TCP server using the Spring Framework\: tutorial_1259_p=\ The <code>destroy-method</code> will help prevent exceptions on hot-redeployment or when restarting the server.