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

Documentation: add 'notranslate' tags

上级 78fbd315
......@@ -137,8 +137,8 @@ CREATE LINKED TABLE LINK('org.postgresql.Driver', 'jdbc:postgresql:test', 'sa',
<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>.
Using the example above, if you issue the query <code class="notranslate">SELECT * FROM LINK WHERE ID=1</code>,
then the following query is run against the PostgreSQL database: <code class="notranslate">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.
</p>
......@@ -169,16 +169,16 @@ This database supports the following transaction isolation levels:
This is the default level.
Read locks are released immediately.
Higher concurrency is possible when using this level.<br />
To enable, execute the SQL statement 'SET LOCK_MODE 3'<br />
or append ;LOCK_MODE=3 to the database URL: jdbc:h2:~/test;LOCK_MODE=3
To enable, execute the SQL statement <code class="notranslate">SET LOCK_MODE 3</code><br />
or append <code class="notranslate">;LOCK_MODE=3</code> to the database URL: <code class="notranslate">jdbc:h2:~/test;LOCK_MODE=3</code>
</li><li>
<b>Serializable</b><br />
To enable, execute the SQL statement 'SET LOCK_MODE 1'<br />
or append ;LOCK_MODE=1 to the database URL: jdbc:h2:~/test;LOCK_MODE=1
To enable, execute the SQL statement <code class="notranslate">SET LOCK_MODE 1</code><br />
or append <code class="notranslate">;LOCK_MODE=1</code> to the database URL: <code class="notranslate">jdbc:h2:~/test;LOCK_MODE=1</code>
</li><li><b>Read Uncommitted</b><br />
This level means that transaction isolation is disabled.<br />
To enable, execute the SQL statement 'SET LOCK_MODE 0'<br />
or append ;LOCK_MODE=0 to the database URL: jdbc:h2:~/test;LOCK_MODE=0
To enable, execute the SQL statement <code class="notranslate">SET LOCK_MODE 0</code><br />
or append <code class="notranslate">;LOCK_MODE=0</code> to the database URL: <code class="notranslate">jdbc:h2:~/test;LOCK_MODE=0</code>
</li>
</ul>
<p>
......@@ -304,7 +304,7 @@ java org.h2.tools.Server
</li><li>Use the CreateCluster tool to initialize clustering.
This will automatically create a new, empty database if it does not exist.
Run the tool on the command line:
<pre>
<pre class="notranslate">
java org.h2.tools.CreateCluster
-urlSource jdbc:h2:tcp://localhost:9101/~/test
-urlTarget jdbc:h2:tcp://localhost:9102/~/test
......@@ -342,15 +342,15 @@ The two phase commit protocol is supported. 2-phase-commit works as follows:
<li>Autocommit needs to be switched off
</li><li>A transaction is started, for example by inserting a row
</li><li>The transaction is marked 'prepared' by executing the SQL statement
<code>PREPARE COMMIT transactionName</code>
<code class="notranslate">PREPARE COMMIT transactionName</code>
</li><li>The transaction can now be committed or rolled back
</li><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'
</li><li>When re-connecting to the database, the in-doubt transactions can be listed
with <code>SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT</code>
with <code class="notranslate">SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT</code>
</li><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>
<code class="notranslate">COMMIT TRANSACTION transactionName</code> or
<code class="notranslate">ROLLBACK TRANSACTION transactionName</code>
</li><li>The database needs to be closed and re-opened to apply the changes
</li></ul>
......@@ -445,7 +445,7 @@ as experimental. It should not be used for production applications.
</p>
<p>
To use the PostgreSQL ODBC driver on 64 bit versions of Windows,
first run <code>c:/windows/syswow64/odbcad32.exe</code>.
first run <code class="notranslate">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>
......@@ -485,13 +485,13 @@ server.stop();
</pre>
<p>
By default, only connections from localhost are allowed. To allow remote connections, use
<code>-pgAllowOthers</code> when starting the server.
<code class="notranslate">-pgAllowOthers</code> when starting the server.
</p>
<h3>ODBC Configuration</h3>
<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...'
run <code class="notranslate">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:
</p>
......@@ -560,12 +560,12 @@ An implementation of the ADO.NET interface is available in the open source proje
</li><li>Install <a href="http://www.ikvm.net">IKVM.NET</a>.
</li><li>Copy the h2*.jar file to ikvm/bin
</li><li>Run the H2 Console using:
<code>ikvm -jar h2*.jar</code>
<code class="notranslate">ikvm -jar h2*.jar</code>
</li><li>Convert the H2 Console to an .exe file using:
<code>ikvmc -target:winexe h2*.jar</code>.
<code class="notranslate">ikvmc -target:winexe h2*.jar</code>.
You may ignore the warnings.
</li><li>Create a .dll file using (change the version accordingly):
<code>ikvmc.exe -target:library -version:1.0.69.0 h2*.jar</code>
<code class="notranslate">ikvmc.exe -target:library -version:1.0.69.0 h2*.jar</code>
</li></ul>
<p>
If you want your C# application use H2, you need to add the h2.dll and the
......@@ -726,7 +726,7 @@ java -cp h2*.jar org.h2.tools.Recover
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 RunScript tool or a
<code>RUNSCRIPT FROM</code> SQL statement. The script includes at least one
<code class="notranslate">RUNSCRIPT FROM</code> SQL statement. The script includes at least one
CREATE USER 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.
......@@ -796,7 +796,7 @@ to the user if it cannot open a database, and not try again in a (fast) loop.
<h3>File Locking Method 'Socket'</h3>
<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.
To use it, append <code class="notranslate">;FILE_LOCK=SOCKET</code> to the database URL.
The algorithm is:
</p>
<ul>
......@@ -1055,17 +1055,17 @@ custom certificates are supported as well.
<p>
Remote SSL/TLS connections are supported using the Java Secure Socket Extension
(SSLServerSocket / SSLSocket). By default, anonymous SSL is enabled.
The default cipher suite is <code>SSL_DH_anon_WITH_RC4_128_MD5</code>.
The default cipher suite is <code class="notranslate">SSL_DH_anon_WITH_RC4_128_MD5</code>.
</p>
<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.
To use your own keystore, set the system properties <code class="notranslate">javax.net.ssl.keyStore</code> and
<code class="notranslate">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.
</p>
<p>
To disable anonymous SSL, set the system property <code>h2.enableAnonymousSSL</code> to false.
To disable anonymous SSL, set the system property <code class="notranslate">h2.enableAnonymousSSL</code> to false.
</p>
<br />
......@@ -1154,7 +1154,7 @@ is selected using a file name prefix. The following file systems are included:
</li></ul>
<p>
As an example, to use the the <b>nio</b> file system, use the following database URL:
<code>jdbc:h2:nio:~/test</code>.
<code class="notranslate">jdbc:h2:nio:~/test</code>.
</p>
<p>
To register a new file system, extend the classes org.h2.store.fs.FileSystem and FileObject,
......@@ -1175,7 +1175,7 @@ This database has the following known limitations:
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 'split:'. In that case files are split into
files of 1 GB by default. An example database URL is:
<code>jdbc:h2:split:~/test</code>.
<code class="notranslate">jdbc:h2:split:~/test</code>.
</li><li>The maximum number of rows per table is 2'147'483'648.
</li><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.
......
......@@ -71,16 +71,16 @@ Ensure that Java binary directory is included in the PATH environment variable,
the environment variable JAVA_HOME points to your Java installation.
On the command line, go to the directory h2 and execute the following command:
</p>
<pre>
<pre class="notranslate">
build -?
</pre>
<p>
For Linux and OS X, use <code>./build.sh</code> instead of <code>build</code>.
For Linux and OS X, use <code class="notranslate">./build.sh</code> instead of <code class="notranslate">build</code>.
</p>
<p>
You will get a list of targets. If you want to build the jar file, execute (Windows):
</p>
<pre>
<pre class="notranslate">
build jar
</pre>
......@@ -89,7 +89,7 @@ build jar
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 install version of Java, run:
</p>
<pre>
<pre class="notranslate">
build switchSource
</pre>
......@@ -106,7 +106,7 @@ The build system can generate smaller jar files as well. The following targets a
<p>
To create the h2client.jar file, go to the directory h2 and execute the following command:
</p>
<pre>
<pre class="notranslate">
build jarClient
</pre>
......@@ -117,7 +117,7 @@ build jarClient
You can include the database in your Maven 2 project as a dependency.
Example:
</p>
<pre>
<pre class="notranslate">
&lt;dependency&gt;
&lt;groupId&gt;com.h2database&lt;/groupId&gt;
&lt;artifactId&gt;h2&lt;/artifactId&gt;
......@@ -134,13 +134,13 @@ they are available there.
<p>
To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command:
</p>
<pre>
<pre class="notranslate">
build mavenInstallLocal
</pre>
<p>
Afterwards, you can include the database in your Maven 2 project as a dependency:
</p>
<pre>
<pre class="notranslate">
&lt;dependency&gt;
&lt;groupId&gt;com.h2database&lt;/groupId&gt;
&lt;artifactId&gt;h2&lt;/artifactId&gt;
......@@ -162,7 +162,7 @@ The translation of this software is split into the following parts:
To translate the H2 Console, start it and select Preferences / Translate.
The conversion between UTF-8 and Java encoding (using the \u syntax), as well as the HTML entities (&amp;#..;)
is automated by running the tool PropertiesToUTF8. The web site translation is automated as well,
using <code>build docs</code>.
using <code class="notranslate">build docs</code>.
</p>
<br />
......@@ -173,20 +173,20 @@ If you like to provide patches, please consider the following guidelines to simp
<ul><li>Only use Java 1.5 features (do not use Java 1.6) (see Environment).
</li><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>.
The checkstyle configuration is in <code class="notranslate">src/installer/checkstyle.xml</code>.
</li><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>.
For Java level tests, see <code class="notranslate">src/test/org/h2/test/TestAll.java</code>.
For SQL level tests, see <code class="notranslate">src/test/org/h2/test/test.in.txt</code> or <code class="notranslate">testSimple.in.txt</code>.
</li><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 'coverage'.
</li><li>Verify that you did not break other features: run the test cases by executing <code>build test</code>.
</li><li>Provide end user documentation if required (<code>src/docsrc/html/*</code>).
</li><li>Document grammar changes in <code>src/main/org/h2/res/help.csv</code>
</li><li>Provide a change log entry (<code>src/docsrc/html/changelog.html</code>).
</li><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>.
</li><li>Verify that you did not break other features: run the test cases by executing <code class="notranslate">build test</code>.
</li><li>Provide end user documentation if required (<code class="notranslate">src/docsrc/html/*</code>).
</li><li>Document grammar changes in <code class="notranslate">src/main/org/h2/res/help.csv</code>
</li><li>Provide a change log entry (<code class="notranslate">src/docsrc/html/changelog.html</code>).
</li><li>Verify the spelling using <code class="notranslate">build spellcheck</code>. If required
add the new words to <code class="notranslate">src/tools/org/h2/build/doc/dictionary.txt</code>.
</li><li>Run the src/installer/buildRelease to find and fix formatting errors.
</li><li>Verify the formatting using <code>build docs</code> and <code>build javadoc</code>.
</li><li>Verify the formatting using <code class="notranslate">build docs</code> and <code class="notranslate">build javadoc</code>.
</li><li>Submit patches as .patch files (compressed if big). To create a patch using Eclipse, use Team / Create Patch.
</li></ul>
<p>
......@@ -195,18 +195,18 @@ For legal reasons, patches need to be public in the form of an email to the
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:
</p>
<pre>
<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)."
</pre>
</p>
<br />
<h2 id="automated">Automated Build</h2>
<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>.
<code class="notranslate">./build.sh clean jar coverage -Dh2.ftpPassword=... uploadBuild</code>.
The last results are available here:
</p>
<ul><li><a href="http://h2database.com/html/testOutput.html">Test Output</a>
......
......@@ -21,7 +21,7 @@ Change Log
<ul><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.
</li><li>Issue 125: Renaming primary keys was not persistent. Fixed.
</li><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.
</li><li>PostgreSQL compatibility: function LASTVAL() as an alias for IDENTITY().
</li><li>Linked tables now support default values when inserting, updating or merging.
......
......@@ -16,22 +16,21 @@ Data Types
<!-- } -->
<h1>Data Types</h1>
<p class="notranslate">
<c:forEach var="item" items="dataTypes">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<c:forEach var="item" items="dataTypes">
<br />
<h3 id="${item.link}">${item.topic}</h3>
<pre>
<h3 id="${item.link}" class="notranslate">${item.topic}</h3>
<pre class="notranslate">
${item.syntax}
</pre>
<p>
${item.text}
</p>
<b>Example:</b><br />
${item.example}
<br />
<p>${item.text}</p>
<b>Example:</b>
<p class="notranslate">${item.example}</p>
</c:forEach>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
......
......@@ -52,7 +52,7 @@ Here is the list of known and confirmed issues:
run into this issue. In Tomcat >= 6.0 this behavior can be disabled by setting the
system property org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES
to false, however Tomcat may then run out of memory. A known workaround is to
put the h2.jar file in a shared <code>lib</code> directory (common/lib).
put the h2.jar file in a shared <code class="notranslate">lib</code> directory (common/lib).
</li><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.
......@@ -92,11 +92,11 @@ By default, a new database is automatically created if it does not yet exist.
<br />
<h3 id="connect">How to Connect to a Database?</h3>
<p>
The database driver is <code>org.h2.Driver</code>,
and the database URL starts with <code>jdbc:h2:</code>.
The database driver is <code class="notranslate">org.h2.Driver</code>,
and the database URL starts with <code class="notranslate">jdbc:h2:</code>.
To connect to a database using JDBC, use the following code:
</p>
<pre>
<pre class="notranslate">
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
</pre>
......@@ -104,14 +104,14 @@ Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
<br />
<h3 id="database_files">Where are the Database Files Stored?</h3>
<p>
When using database URLs like jdbc:h2:~/test, the database is stored in the user directory.
For Windows, this is usually "C:\Documents and Settings\&lt;userName&gt;".
If the base directory is not set (as in jdbc:h2:test), the database files are stored in the directory where the application is started
When using database URLs like <code class="notranslate">jdbc:h2:~/test</code>, the database is stored in the user directory.
For Windows, this is usually C:\Documents and Settings\&lt;userName&gt;".
If the base directory is not set (as in <code class="notranslate">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 "&lt;Installation Directory&gt;/bin".
The base directory can be set in the database URL. A fixed or relative path can be used. When using the URL
jdbc:h2:file:data/sample, the database is stored in the directory "data" (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: jdbc:h2:file:C:/data/test
Example: <code class="notranslate">jdbc:h2:file:C:/data/test</code>
</p>
<br />
......
......@@ -454,7 +454,7 @@ This is achieved using different database URLs. Settings in the URLs are not cas
<table><tr><th>Topic</th><th>URL Format and Examples</th></tr>
<tr>
<td><a href="#embedded_databases">Embedded (local) connection</a></td>
<td>
<td class="notranslate">
jdbc:h2:[file:][&lt;path&gt;]&lt;databaseName&gt;<br />
jdbc:h2:~/test<br />
jdbc:h2:file:/data/sample<br />
......@@ -463,18 +463,18 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</tr>
<tr>
<td><a href="#memory_only_databases">In-memory (private)</a></td>
<td>jdbc:h2:mem:</td>
<td class="notranslate">jdbc:h2:mem:</td>
</tr>
<tr>
<td><a href="#memory_only_databases">In-memory (named)</a></td>
<td>
<td class="notranslate">
jdbc:h2:mem:&lt;databaseName&gt;<br />
jdbc:h2:mem:test_mem
</td>
</tr>
<tr>
<td><a href="tutorial.html#using_server">Server mode (remote connections)<br /> using TCP/IP</a></td>
<td>
<td class="notranslate">
jdbc:h2:tcp://&lt;server&gt;[:&lt;port&gt;]/[&lt;path&gt;]&lt;databaseName&gt;<br />
jdbc:h2:tcp://localhost/~/test<br />
jdbc:h2:tcp://dbserv:8084/~/sample
......@@ -482,14 +482,14 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</tr>
<tr>
<td><a href="advanced.html#ssl_tls_connections">Server mode (remote connections)<br /> using SSL/TLS</a></td>
<td>
<td class="notranslate">
jdbc:h2:ssl://&lt;server&gt;[:&lt;port&gt;]/&lt;databaseName&gt;<br />
jdbc:h2:ssl://secureserv:8085/~/sample;
</td>
</tr>
<tr>
<td><a href="#file_encryption">Using encrypted files</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;CIPHER=[AES|XTEA]<br />
jdbc:h2:ssl://secureserv/~/testdb;CIPHER=AES<br />
jdbc:h2:file:~/secure;CIPHER=XTEA<br />
......@@ -497,7 +497,7 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</tr>
<tr>
<td><a href="#database_file_locking">File locking methods</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;FILE_LOCK={NO|FILE|SOCKET}<br />
jdbc:h2:file:~/quickAndDirty;FILE_LOCK=NO<br />
jdbc:h2:file:~/private;CIPHER=XTEA;FILE_LOCK=SOCKET<br />
......@@ -505,81 +505,81 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</tr>
<tr>
<td><a href="#database_only_if_exists">Only open if it already exists</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;IFEXISTS=TRUE<br />
jdbc:h2:file:~/sample;IFEXISTS=TRUE<br />
</td>
</tr>
<tr>
<td><a href="#do_not_close_on_exit">Don't close the database when the VM exits</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;DB_CLOSE_ON_EXIT=FALSE
</td>
</tr>
<tr>
<td><a href="#passwords">User name and/or password</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;[;USER=&lt;username&gt;][;PASSWORD=&lt;value&gt;]<br />
jdbc:h2:file:~/sample;USER=sa;PASSWORD=123<br />
</td>
</tr>
<tr>
<td><a href="#log_index_changes">Log index changes</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;LOG=2<br />
jdbc:h2:file:~/sample;LOG=2<br />
</td>
</tr>
<tr>
<td><a href="#trace_options">Debug trace settings</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;TRACE_LEVEL_FILE=&lt;level 0..3&gt;<br />
jdbc:h2:file:~/sample;TRACE_LEVEL_FILE=3<br />
</td>
</tr>
<tr>
<td><a href="#ignore_unknown_settings">Ignore unknown settings</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;IGNORE_UNKNOWN_SETTINGS=TRUE<br />
</td>
</tr>
<tr>
<td><a href="#custom_access_mode">Custom file access mode</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws<br />
</td>
</tr>
<tr>
<td><a href="#database_in_zip">Database in a zip file</a></td>
<td>
<td class="notranslate">
jdbc:h2:zip:&lt;zipFileName&gt;!/&lt;databaseName&gt;<br />
jdbc:h2:zip:~/db.zip!/test
</td>
</tr>
<tr>
<td><a href="#compatibility">Compatibility mode</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;MODE=&lt;databaseType&gt;<br />
jdbc:h2:~/test;MODE=MYSQL
</td>
</tr>
<tr>
<td><a href="#auto_reconnect">Auto-reconnect</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;AUTO_RECONNECT=TRUE<br />
jdbc:h2:tcp://localhost/~/test;AUTO_RECONNECT=TRUE
</td>
</tr>
<tr>
<td><a href="#auto_mixed_mode">Automatic mixed mode</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;AUTO_SERVER=TRUE<br />
jdbc:h2:~/test;AUTO_SERVER=TRUE
</td>
</tr>
<tr>
<td><a href="#other_settings">Changing other settings</a></td>
<td>
<td class="notranslate">
jdbc:h2:&lt;url&gt;;&lt;setting&gt;=&lt;value&gt;[;&lt;setting&gt;=&lt;value&gt;...]<br />
jdbc:h2:file:~/sample;TRACE_LEVEL_SYSTEM_OUT=3<br />
</td>
......@@ -589,12 +589,12 @@ This is achieved using different database URLs. Settings in the URLs are not cas
<br />
<h2 id="embedded_databases">Connecting to an Embedded (Local) Database</h2>
<p>
The database URL for connecting to a local database is <code>jdbc:h2:[file:][&lt;path&gt;]&lt;databaseName&gt;</code>.
The prefix <code>file:</code> is optional. If no or only a relative path is used, then the current working
The database URL for connecting to a local database is <code class="notranslate">jdbc:h2:[file:][&lt;path&gt;]&lt;databaseName&gt;</code>.
The prefix <code class="notranslate">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 File.createTempFile).
To point to the user home directory, use ~/, as in: jdbc:h2:~/test.
To point to the user home directory, use <code class="notranslate">~/</code>, as in: <code class="notranslate">jdbc:h2:~/test</code>.
</p>
<br />
......@@ -606,23 +606,23 @@ This database supports the memory-only mode, where the data is not persisted.
</p><p>
In some cases, only one connection to a memory-only database is required.
This means the database to be opened is private. In this case, the database URL is
<code>jdbc:h2:mem:</code> Opening two connections within the same virtual machine
<code class="notranslate">jdbc:h2:mem:</code> Opening two connections within the same virtual machine
means opening two different (private) databases.
</p><p>
Sometimes multiple connections to the same memory-only database are required.
In this case, the database URL must include a name. Example: <code>jdbc:h2:mem:db1</code>.
In this case, the database URL must include a name. Example: <code class="notranslate">jdbc:h2:mem:db1</code>.
Accessing the same database in this way only works within the same virtual machine and
class loader environment.
</p><p>
It is also possible to access a memory-only database remotely
(or from multiple processes in the same machine) using TCP/IP or SSL/TLS.
An example database URL is: <code>jdbc:h2:tcp://localhost/mem:db1</code>.
An example database URL is: <code class="notranslate">jdbc:h2:tcp://localhost/mem:db1</code>.
</p><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 ;DB_CLOSE_DELAY=-1 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>.
<code class="notranslate">jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</code>.
</p>
<br />
......@@ -647,7 +647,7 @@ and the user password; the file password itself may not contain spaces. File pas
and user passwords are case sensitive. Here is an example to connect to a
password-encrypted database:
</p>
<pre>
<pre class="notranslate">
Class.forName("org.h2.Driver");
String url = "jdbc:h2:~/test;CIPHER=AES";
String user = "sa";
......@@ -664,7 +664,7 @@ The tool is available from within the H2 Console in the Tools section, or you ca
The following command line will encrypt the database 'test' in the user home directory
with the file password 'filepwd' and the encryption algorithm AES:
</p>
<pre>
<pre class="notranslate">
java -cp h2*.jar org.h2.tools.ChangeFileEncryption -dir ~ -db test -cipher AES -encrypt filepwd
</pre>
......@@ -690,7 +690,7 @@ in this case it is up to the application to protect the database files.
To open the database with a different file locking method, use the parameter 'FILE_LOCK'.
The following code opens the database with the 'socket' locking method:
</p>
<pre>
<pre class="notranslate">
String url = "jdbc:h2:~/test;FILE_LOCK=SOCKET";
</pre>
<p>
......@@ -698,7 +698,7 @@ The following code forces the database to not create a lock file at all. Please
this is unsafe as another process is able to open the same database, possibly leading to
data corruption:
</p>
<pre>
<pre class="notranslate">
String url = "jdbc:h2:~/test;FILE_LOCK=NO";
</pre>
<p>
......@@ -709,15 +709,15 @@ For more information about the algorithms, see
<br />
<h2 id="database_only_if_exists">Opening a Database Only if it Already Exists</h2>
<p>
By default, when an application calls <code>DriverManager.getConnection(url, ...)</code>
By default, when an application calls <code class="notranslate">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>
existing databases. To do this, add <code class="notranslate">;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:
</p>
<pre>
<pre class="notranslate">
String url = "jdbc:h2:/data/sample;IFEXISTS=TRUE";
</pre>
......@@ -733,14 +733,14 @@ SET DB_CLOSE_DELAY &lt;seconds&gt;. The parameter &lt;seconds&gt; specifies the
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:
</p>
<pre>
<pre class="notranslate">
SET DB_CLOSE_DELAY 10
</pre>
<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>.
It is possible to set the value in the database URL: <code class="notranslate">jdbc:h2:~/test;DB_CLOSE_DELAY=10</code>.
</p>
<br />
......@@ -755,7 +755,7 @@ 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:
</p>
<pre>
<pre class="notranslate">
String url = "jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE";
</pre>
......@@ -770,7 +770,7 @@ In some situations, for example when using very large databases (over a few hund
re-creating the index file takes very long.
In these situations it may be better to log changes to the index file,
so that recovery from a corrupted index file is fast.
To enable log index changes, add LOG=2 to the URL, as in <code>jdbc:h2:~/test;LOG=2</code>.
To enable log index changes, add LOG=2 to the URL, as in <code class="notranslate">jdbc:h2:~/test;LOG=2</code>.
This setting should be specified when connecting.
The update performance of the database will be reduced when using this option.
</p>
......@@ -792,8 +792,8 @@ saying the parameter is not supported. It is possible to ignored such parameters
<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
Adding <code class="notranslate">;setting=value</code> at the end of a database URL is the
same as executing the statement <code class="notranslate">SET setting value</code> just after
connecting. For a list of supported settings, see <a href="grammar.html">SQL Grammar</a>.
</p>
......@@ -809,7 +809,7 @@ The access mode used for log files is set via ACCESS_MODE_LOG; for
data and index files use ACCESS_MODE_DATA.
These settings must be specified in the database URL:
</p>
<pre>
<pre class="notranslate">
String url = "jdbc:h2:~/test;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws";
</pre>
<p>
......@@ -1018,7 +1018,7 @@ If the database file is corrupted, because the checksum of a record does not mat
file was edited with another application), the database can be opened in recovery mode. In this case,
errors in the database are logged but not thrown. The database should be backed up to a script
and re-built as soon as possible. To open the database in the recovery mode, use a database URL
must contain RECOVER=1, as in jdbc:h2:~/test;RECOVER=1. Indexes are rebuilt in this case, and
must contain <code class="notranslate">;RECOVER=1</code>, as in <code class="notranslate">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.
</p>
......@@ -1031,7 +1031,7 @@ and tries to be compatible to other databases. There are still a few differences
<p>
In MySQL text columns are case insensitive by default, while in H2 they are case sensitive. However
H2 supports case insensitive columns as well. To create the tables with case insensitive texts, append
IGNORECASE=TRUE to the database URL (example: <code>jdbc:h2:~/test;IGNORECASE=TRUE</code>).
IGNORECASE=TRUE to the database URL (example: <code class="notranslate">jdbc:h2:~/test;IGNORECASE=TRUE</code>).
</p>
<h3>Compatibility Modes</h3>
......@@ -1043,8 +1043,8 @@ Here is the list of currently supported modes and the differences to the regular
<h3>DB2 Compatibility Mode</h3>
<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>.
To use the IBM DB2 mode, use the database URL <code class="notranslate">jdbc:h2:~/test;MODE=DB2</code>
or the SQL statement <code class="notranslate">SET MODE DB2</code>.
</p>
<ul><li>For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
......@@ -1054,8 +1054,8 @@ or the SQL statement <code>SET MODE DB2</code>.
<h3>Derby Compatibility Mode</h3>
<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>.
To use the Apache Derby mode, use the database URL <code class="notranslate">jdbc:h2:~/test;MODE=Derby</code>
or the SQL statement <code class="notranslate">SET MODE Derby</code>.
</p>
<ul><li>For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
......@@ -1065,8 +1065,8 @@ or the SQL statement <code>SET MODE Derby</code>.
<h3>HSQLDB Compatibility Mode</h3>
<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>.
To use the HSQLDB mode, use the database URL <code class="notranslate">jdbc:h2:~/test;MODE=HSQLDB</code>
or the SQL statement <code class="notranslate">SET MODE HSQLDB</code>.
</p>
<ul><li>For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
......@@ -1080,8 +1080,8 @@ or the SQL statement <code>SET MODE HSQLDB</code>.
<h3>MS SQL Server Compatibility Mode</h3>
<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>.
To use the MS SQL Server mode, use the database URL <code class="notranslate">jdbc:h2:~/test;MODE=MSSQLServer</code>
or the SQL statement <code class="notranslate">SET MODE MSSQLServer</code>.
</p>
<ul><li>For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
......@@ -1092,8 +1092,8 @@ or the SQL statement <code>SET MODE MSSQLServer</code>.
<h3>MySQL Compatibility Mode</h3>
<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>.
To use the MySQL mode, use the database URL <code class="notranslate">jdbc:h2:~/test;MODE=MySQL</code>
or the SQL statement <code class="notranslate">SET MODE MySQL</code>.
</p>
<ul><li>When inserting data, if a column is defined to be NOT NULL and NULL is inserted,
then a 0 (or empty string, or the current timestamp for timestamp columns) value is used.
......@@ -1106,8 +1106,8 @@ or the SQL statement <code>SET MODE MySQL</code>.
<h3>Oracle Compatibility Mode</h3>
<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>.
To use the Oracle mode, use the database URL <code class="notranslate">jdbc:h2:~/test;MODE=Oracle</code>
or the SQL statement <code class="notranslate">SET MODE Oracle</code>.
</p>
<ul><li>For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
......@@ -1118,8 +1118,8 @@ or the SQL statement <code>SET MODE Oracle</code>.
<h3>PostgreSQL Compatibility Mode</h3>
<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>.
To use the PostgreSQL mode, use the database URL <code class="notranslate">jdbc:h2:~/test;MODE=PostgreSQL</code>
or the SQL statement <code class="notranslate">SET MODE PostgreSQL</code>.
</p>
<ul><li>For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
......@@ -1148,7 +1148,7 @@ contains all client side state that is re-created.
<h2 id="auto_mixed_mode">Automatic Mixed Mode</h2>
<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.
To do that, append <code class="notranslate">;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.
</p>
<p>
......@@ -1168,7 +1168,7 @@ open, one of them will then start a server (auto-reconnect is enabled automatica
<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.
Explicit client/server connections (using jdbc:h2:tcp:// or ssl://) are not supported.
Explicit client/server connections (using <code class="notranslate">jdbc:h2:tcp://</code> or <code class="notranslate">ssl://</code>) are not supported.
This mode is not supported for in-memory databases.
</p>
<p>
......@@ -1176,7 +1176,7 @@ Here is an example how to use this mode. Application 1 and 2 are not necessarily
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).
</p>
<pre>
<pre class="notranslate">
// Application 1:
DriverManager.getConnection("jdbc:h2:/data/test;AUTO_SERVER=TRUE");
......@@ -1206,16 +1206,16 @@ and one for file tracing (TRACE_LEVEL_FILE).
The trace levels are 0 for OFF, 1 for ERROR (the default), 2 for INFO and 3 for DEBUG.
A database URL with both levels set to DEBUG is:
</p>
<pre>
<pre class="notranslate">
jdbc:h2:~/test;TRACE_LEVEL_FILE=3;TRACE_LEVEL_SYSTEM_OUT=3
</pre>
<p>
The trace level can be changed at runtime by executing the SQL command
<code>SET TRACE_LEVEL_SYSTEM_OUT level</code> (for System.out tracing)
or <code>SET TRACE_LEVEL_FILE level</code> (for file tracing).
<code class="notranslate">SET TRACE_LEVEL_SYSTEM_OUT level</code> (for System.out tracing)
or <code class="notranslate">SET TRACE_LEVEL_FILE level</code> (for file tracing).
Example:
</p>
<pre>
<pre class="notranslate">
SET TRACE_LEVEL_SYSTEM_OUT 3
</pre>
......@@ -1225,10 +1225,10 @@ 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 .old and a new file is created.
If another .old file exists, it is deleted.
The size limit can be changed using the SQL statement
<code>SET TRACE_MAX_FILE_SIZE maximumFileSizeInMB</code>.
<code class="notranslate">SET TRACE_MAX_FILE_SIZE maximumFileSizeInMB</code>.
Example:
</p>
<pre>
<pre class="notranslate">
SET TRACE_MAX_FILE_SIZE 1
</pre>
......@@ -1237,7 +1237,7 @@ SET TRACE_MAX_FILE_SIZE 1
When setting the trace level to INFO or DEBUG, Java source code is generated as well.
This allows to reproduce problems more easily. The trace file looks like this:
</p>
<pre>
<pre class="notranslate">
...
12-20 20:58:09 jdbc[0]:
/**/dbMeta3.getURL();
......@@ -1248,12 +1248,12 @@ This allows to reproduce problems more easily. The trace file looks like this:
<p>
To filter the Java source code, use the ConvertTraceFile tool as follows:
</p>
<pre>
<pre class="notranslate">
java -cp h2*.jar org.h2.tools.ConvertTraceFile
-traceFile "~/test.trace.db" -javaClass "Test"
</pre>
<p>
The generated file <code>Test.java</code> will contain the Java source code.
The generated file <code class="notranslate">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.
......@@ -1277,7 +1277,7 @@ Java logging, x4juli, and Simple Log.
<p>
To enable SLF4J, set the file trace level to 4 in the database URL:
</p>
<pre>
<pre class="notranslate">
jdbc:h2:~/test;TRACE_LEVEL_FILE=4
</pre>
<p>
......@@ -1306,7 +1306,7 @@ by calling Connection.isReadOnly() or by executing the SQL statement CALL READON
To create a read-only database in a zip file, first create a regular persistent database, and then create a backup.
If you are using a database named 'test', an easy way to do that is using the Backup tool or the BACKUP SQL statement:
</p>
<pre>
<pre class="notranslate">
BACKUP TO 'data.zip'
</pre>
<p>
......@@ -1314,7 +1314,7 @@ The database must not have pending changes, that means you need to close all con
database, open one single connection, and then execute the statement. Afterwards, you can log out,
and directly open the database in the zip file using the following database URL:
</p>
<pre>
<pre class="notranslate">
jdbc:h2:zip:~/data.zip!/test
</pre>
<p>
......@@ -1352,7 +1352,7 @@ 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:
</p>
<pre>
<pre class="notranslate">
CREATE TABLE ADDRESS(
ID INT PRIMARY KEY,
NAME VARCHAR,
......@@ -1365,7 +1365,7 @@ When inserting data, it is not required (and not allowed) to specify a value for
version of the column, because the value is generated. But you can use the
column when querying the table:
</p>
<pre>
<pre class="notranslate">
INSERT INTO ADDRESS(ID, NAME) VALUES(1, 'Miller');
SELECT * FROM ADDRESS WHERE UPPER_NAME='MILLER';
</pre>
......@@ -1424,7 +1424,7 @@ password will not be stored in the swap file.
This database supports using char arrays instead of String to pass user and file passwords.
The following code can be used to do that:
</p>
<pre>
<pre class="notranslate">
import java.sql.*;
import java.util.*;
public class Test {
......@@ -1454,12 +1454,12 @@ When using Swing, use javax.swing.JPasswordField.
<h3>Passing the User Name and/or Password in the URL</h3>
<p>
Instead of passing the user name as a separate parameter as in
<code>
<code class="notranslate">
Connection conn = DriverManager.
getConnection("jdbc:h2:~/test", "sa", "123");
</code>
the user name (and/or password) can be supplied in the URL itself:
<code>
<code class="notranslate">
Connection conn = DriverManager.
getConnection("jdbc:h2:~/test;USER=sa;PASSWORD=123");
</code>
......@@ -1475,7 +1475,7 @@ A function must be declared (registered) before it can be used.
Only static Java methods are supported; both the class and the method must be public.
Example Java method:
</p>
<pre>
<pre class="notranslate">
package acme;
import java.math.*;
public class Function {
......@@ -1487,7 +1487,7 @@ public class Function {
<p>
The Java function must be registered in the database by calling CREATE ALIAS:
</p>
<pre>
<pre class="notranslate">
CREATE ALIAS IS_PRIME FOR "acme.Function.isPrime"
</pre>
<p>
......@@ -1524,7 +1524,7 @@ and the exception is thrown to the application.
<p>
Functions may returns a result set. Such a function can be called with the CALL statement:
</p>
<pre>
<pre class="notranslate">
public static ResultSet query(Connection conn, String sql) throws SQLException {
return conn.createStatement().executeQuery(sql);
}
......@@ -1537,7 +1537,7 @@ CALL QUERY('SELECT * FROM TEST');
<p>
A function can create a result set using the SimpleResultSet tool:
</p>
<pre>
<pre class="notranslate">
import org.h2.tools.SimpleResultSet;
...
public static ResultSet simpleResultSet() throws SQLException {
......@@ -1561,10 +1561,10 @@ first while parsing the statement to collect the column names
(with parameters set to null where not known at compile time).
And then, while executing the statement to get the data (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>.
<code class="notranslate">jdbc:columnlist:connection</code>. Otherwise, the URL of the connection is
<code class="notranslate">jdbc:default:connection</code>.
</p>
<pre>
<pre class="notranslate">
public static ResultSet getMatrix(Connection conn, Integer size)
throws SQLException {
SimpleResultSet rs = new SimpleResultSet();
......@@ -1597,7 +1597,7 @@ A Java trigger must implement the interface org.h2.api.Trigger. The trigger clas
in the classpath of the database engine (when using the server mode, it must be in the classpath
of the server).
</p>
<pre>
<pre class="notranslate">
import org.h2.api.Trigger;
...
public class TriggerSample implements Trigger {
......@@ -1613,7 +1613,7 @@ public class TriggerSample implements Trigger {
The connection can be used to query or update data in other tables.
The trigger then needs to be defined in the database:
</p>
<pre>
<pre class="notranslate">
CREATE TRIGGER INV_INS AFTER INSERT ON INVOICE
FOR EACH ROW CALL "org.h2.samples.TriggerSample"
</pre>
......@@ -1630,7 +1630,7 @@ while the database is closed. However in some situations (for example after dele
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:
</p>
<pre>
<pre class="notranslate">
public static void compact(String dir, String dbName,
String user, String password) throws Exception {
String url = "jdbc:h2:" + dir + "/" + dbName;
......@@ -1651,24 +1651,16 @@ of a database and re-build the database from the script.
<p>
The database keeps most frequently used data and index pages in the main memory.
The amount of memory used for caching can be changed using the setting
CACHE_SIZE. This setting can be set in the database connection URL
(jdbc:h2:~/test;CACHE_SIZE=131072), or it can be changed at runtime using
SET CACHE_SIZE size.
</p><p>
This database supports two cache page replacement algorithms: LRU (the default) and
TQ. For LRU, the pages that were least frequently used are removed from the
cache if it becomes full. The TQ (Two Queue, also called 2Q) algorithm is a bit more complicated: basically two
queues are used. It is more resistant to table scans, however the overhead
is a bit higher compared to the LRU. To use the cache algorithm TQ, use a database URL
of the form jdbc:h2:~/test;CACHE_TYPE=TQ. The cache algorithm cannot be changed
once the database is open.
<code class="notranslate">CACHE_SIZE</code>. This setting can be set in the database connection URL
(<code class="notranslate">jdbc:h2:~/test;CACHE_SIZE=131072</code>), or it can be changed at runtime using
<code class="notranslate">SET CACHE_SIZE size</code>.
</p><p>
Also supported is a 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 SOFT_. Example: jdbc:h2:~/test;CACHE_TYPE=SOFT_LRU .
use the prefix <code class="notranslate">SOFT_</code>. Example: <code class="notranslate">jdbc:h2:~/test;CACHE_TYPE=SOFT_LRU</code>.
</p><p>
To get information about page reads and writes, and the current caching algorithm in use,
call SELECT * FROM INFORMATION_SCHEMA.SETTINGS. The number of pages read / written
call <code class="notranslate">SELECT * FROM INFORMATION_SCHEMA.SETTINGS</code>. The number of pages read / written
is listed for the data and index file.
</p>
......
......@@ -75,6 +75,15 @@ Initial Developer: H2 Group
<a href="faq.html"> FAQ </a><br />
<a href="license.html"> License </a><br />
<br />
<div id = "google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</div>
</div>
</td>
......
......@@ -18,42 +18,49 @@ Functions
<h1>Functions</h1>
<h2>Aggregate Functions</h2>
<p class="notranslate">
<c:forEach var="item" items="functionsAggregate">
<a href="#${item.link}">${item.topic}</a><br />
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</p>
<h2>Numeric Functions</h2>
<p class="notranslate">
<c:forEach var="item" items="functionsNumeric">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<h2>String Functions</h2>
<p class="notranslate">
<c:forEach var="item" items="functionsString">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<h2>Time and Date Functions</h2>
<p class="notranslate">
<c:forEach var="item" items="functionsTimeDate">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<h2>System Functions</h2>
<p class="notranslate">
<c:forEach var="item" items="functionsSystem">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<c:forEach var="item" items="functionsAll">
<br />
<h3 id="${item.link}">${item.topic}</h3>
<pre>
<h3 id="${item.link}" class="notranslate">${item.topic}</h3>
<pre class="notranslate">
${item.syntax}
</pre>
<p>
${item.text}
</p>
<b>Example:</b><br />
${item.example}
<br />
<p>${item.text}</p>
<b>Example:</b>
<p class="notranslate">${item.example}</p>
</c:forEach>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
......
......@@ -17,73 +17,84 @@ SQL Grammar
<h1>SQL Grammar</h1>
<h2>Commands (Data Manipulation)</h2>
<p class="notranslate">
<c:forEach var="item" items="commandsDML">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<h2>Commands (Data Definition)</h2>
<p class="notranslate">
<c:forEach var="item" items="commandsDDL">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<h2>Commands (Other)</h2>
<p class="notranslate">
<c:forEach var="item" items="commandsOther">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</p>
<h2>Other Grammar</h2>
<p class="notranslate">
<c:forEach var="item" items="otherGrammar">
<a href="#${item.link}">${item.topic}</a><br />
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</p>
<h2>System Tables</h2>
<p class="notranslate">
<a href="#information_schema">Information Schema</a><br />
<a href="#range_table">Range Table</a><br />
</p>
<c:forEach var="item" items="commands">
<br />
<h3 id="${item.link}">${item.topic}</h3>
<pre>
<h3 id="${item.link}" class="notranslate">${item.topic}</h3>
<pre class="notranslate">
${item.syntax}
</pre>
<p>
${item.text}
</p>
<b>Example:</b><br />
${item.example}
<br />
<p>${item.text}</p>
<b>Example:</b>
<p class="notranslate">${item.example}</p>
</c:forEach>
<c:forEach var="item" items="otherGrammar">
<br />
<h3 id="${item.link}">${item.topic}</h3>
<pre>
<h3 id="${item.link}" class="notranslate">${item.topic}</h3>
<pre class="notranslate">
${item.syntax}
</pre>
<p>
${item.text}
</p>
<b>Example:</b><br />
${item.example}
<br />
<p>${item.text}</p>
<b>Example:</b>
<p class="notranslate">${item.example}</p>
</c:forEach>
<br />
<h3 id="information_schema">Information Schema</h3>
<h3 id="information_schema" class="notranslate">Information Schema</h3>
<p>
The system tables in the schema 'INFORMATION_SCHEMA' contain the meta data
of all tables in the database as well as the current settings.
</p>
<table><tr><th>Table</th><th>Columns</th></tr>
<c:forEach var="item" items="informationSchema">
<tr><td>${item.topic}</td><td>${item.syntax}</td></tr>
<tr class="notranslate">
<td>${item.topic}</td>
<td>${item.syntax}</td>
</tr>
</c:forEach>
</table>
<br />
<h3 id="range_table">Range Table</h3>
<h3 id="range_table" class="notranslate">Range Table</h3>
<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:
</p>
<pre>
<pre class="notranslate">
SELECT X FROM SYSTEM_RANGE(1, 10);
</pre>
......
......@@ -25,7 +25,7 @@ JaQu replaces SQL, JDBC, and persistence frameworks such as Hibernate.
JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a
Microsoft .NET technology). The following JaQu code:
</p>
<pre>
<pre class="notranslate">
Product p = new Product();
List&lt;Product&gt; soldOutProducts =
db.from(p).where(p.unitsInStock).is(0).select();
......@@ -33,7 +33,7 @@ List&lt;Product&gt; soldOutProducts =
<p>
stands for the SQL statement:
</p>
<pre>
<pre class="notranslate">
SELECT * FROM PRODUCTS P
WHERE P.UNITS_IN_STOCK = 0
</pre>
......@@ -77,7 +77,7 @@ JaQu is not part of the h2 jar file, however the source code is included in H2,
<h2>Building the JaQu library</h2>
<p>
To create the JaQu jar file, run: <code>build jarJaqu</code>. This will create the file <code>bin/h2jaqu.jar</code>.
To create the JaQu jar file, run: <code class="notranslate">build jarJaqu</code>. This will create the file <code class="notranslate">bin/h2jaqu.jar</code>.
</p>
<h2>Requirements</h2>
......@@ -88,7 +88,7 @@ work with any database that supports the JDBC API.
</p>
<h2>Example Code</h2>
<pre>
<pre class="notranslate">
package org.h2.test.jaqu;
import java.math.BigDecimal;
import java.util.List;
......@@ -229,7 +229,7 @@ To define table indices, or if you want to map a class to a table with a differe
or a field to a column with another name, create a function called 'define' in the data class.
Example:
</p>
<pre>
<pre class="notranslate">
public class Product implements Table {
public Integer productId;
......@@ -262,7 +262,7 @@ 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:
</p>
<pre>
<pre class="notranslate">
long count = db.from(co).
where(new Filter() { public boolean where() {
return co.id == x
......@@ -287,7 +287,7 @@ Some ideas for what to implement are:
</li></ul>
<h2>Related Projects</h2>
<p>
<p class="notranslate">
<a href="http://code.google.com/p/dreamsource-orm">Dreamsource ORM</a><br />
<a href="http://incubator.apache.org/empire-db/empiredb/empiredb.htm">Empire-db</a><br />
<a href="http://www.jequel.de">JEQUEL: Java Embedded QUEry Language</a><br />
......
......@@ -79,7 +79,7 @@ Welcome to H2, the Java SQL database. The main features of H2 are:
<tr><td colspan="3" style="border: 0px; padding: 5px 0px 15px 0px;">
<h3>Features</h3>
<table style="width: 425px;"><tr>
<table style="width: 425px;"><tr class="notranslate">
<th></th>
<th>H2</th>
<th><a href="http://db.apache.org/derby">Derby</a></th>
......
......@@ -107,7 +107,7 @@ 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:
</p>
<pre>
<pre class="notranslate">
SELECT COUNT(DISTINCT S_I_ID) FROM ORDER_LINE, STOCK
WHERE OL_W_ID=? AND OL_D_ID=? AND OL_O_ID&lt;? AND OL_O_ID&gt;=?
AND S_W_ID=? AND S_I_ID=OL_I_ID AND S_QUANTITY&lt;?
......@@ -178,7 +178,7 @@ SQLite was not tested because the JDBC driver doesn't support transactions.
<p>
This test was executed as follows:
</p>
<pre>
<pre class="notranslate">
build benchmark
</pre>
......@@ -310,7 +310,7 @@ poleposition-0.20/lib/hsqldb.jar with a newer version (for example hsqldb-1.8.0.
and then use the setting
hsqldb.connecturl=jdbc:hsqldb:file:data/hsqldb/dbbench2;hsqldb.default_table_type=cached;sql.enforce_size=true in Jdbc.properties.
</li><li>HSQLDB keeps the database open between tests, while H2 closes the database (losing all the cache).
To change that, use the database URL jdbc:h2:file:data/h2/dbbench;DB_CLOSE_DELAY=-1
To change that, use the database URL <code class="notranslate">jdbc:h2:file:data/h2/dbbench;DB_CLOSE_DELAY=-1</code>
</li><li>The amount of cache memory is quite important, specially for the PolePosition test.
Unfortunately, the PolePosition test does not take this into account.
</li></ul>
......@@ -332,13 +332,13 @@ A good tool to measure both memory usage and performance is the
<p>
A simple way to profile an application is to use the built-in profiling tool of java. Example:
</p>
<pre>
<pre class="notranslate">
java -Xrunhprof:cpu=samples,depth=16 com.acme.Test
</pre>
<p>
Unfortunately, it is only possible to profile the application from start to end. Another solution is to create
a number of full thread dumps. To do that, first run <code>jps -l</code> to get the process id, and then
run <code>jstack &lt;pid&gt;</code> or <code>kill -QUIT &lt;pid&gt;</code> (Linux) or press
a number of full thread dumps. To do that, first run <code class="notranslate">jps -l</code> to get the process id, and then
run <code class="notranslate">jstack &lt;pid&gt;</code> or <code class="notranslate">kill -QUIT &lt;pid&gt;</code> (Linux) or press
Ctrl+C (Windows).
</p>
......@@ -349,7 +349,7 @@ The ConvertTraceFile tool generates SQL statement statistics at the end of the S
The format used is similar to the profiling data generated when using java -Xrunhprof.
As an example, execute the the following script using the H2 Console:
</p>
<pre>
<pre class="notranslate">
SET TRACE_LEVEL_FILE 3;
DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
......@@ -359,15 +359,15 @@ SET TRACE_LEVEL_FILE 0;
<p>
Now convert the .trace.db file using the ConvertTraceFile tool:
</p>
<pre>
<pre class="notranslate">
java -cp h2*.jar org.h2.tools.ConvertTraceFile
-traceFile "~/test.trace.db" -script "~/test.sql"
</pre>
<p>
The generated file <code>test.sql</code> will contain the SQL statements as well as the
The generated file <code class="notranslate">test.sql</code> will contain the SQL statements as well as the
following profiling data (results vary):
</p>
<pre>
<pre class="notranslate">
-----------------------------------------
-- SQL Statement Statistics
-- time: total time in milliseconds (accumulated)
......@@ -387,7 +387,7 @@ following profiling data (results vary):
<h3>Use a Modern JVM</h3>
<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
Switching from the default Client JVM to the Server JVM using the <code class="notranslate">-server</code> command-line
option improves performance at the cost of a slight increase in start-up time.
</p>
......@@ -475,7 +475,7 @@ queries and data manipulation.
</p>
<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,
using <code class="notranslate">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.
</p>
......@@ -483,13 +483,13 @@ problems for large tables.
In-memory hash indexes are backed by a hash table and are usually faster than
regular indexes. However, hash indexes only supports direct lookup (WHERE ID = ?)
but not range scan (WHERE ID &lt; ?). To use hash indexes, use HASH as in:
<code>CREATE UNIQUE HASH INDEX</code> and
<code>CREATE TABLE ...(ID INT PRIMARY KEY HASH,...)</code>.
<code class="notranslate">CREATE UNIQUE HASH INDEX</code> and
<code class="notranslate">CREATE TABLE ...(ID INT PRIMARY KEY HASH,...)</code>.
</p>
<h3>Optimization Examples</h3>
<p>
See <code>src/test/org/h2/samples/optimizations.sql</code> for a few examples of queries
See <code class="notranslate">src/test/org/h2/samples/optimizations.sql</code> for a few examples of queries
that benefit from special optimizations built into the database.
</p>
......@@ -522,7 +522,7 @@ To speed up large imports, consider using the following options temporarily:
</li></ul>
<p>
These options can be set in the database URL:
<code>jdbc:h2:~/test;CACHE_SIZE=65536;LOCK_MODE=0;LOG=0;UNDO_LOG=0</code>.
<code class="notranslate">jdbc:h2:~/test;CACHE_SIZE=65536;LOCK_MODE=0;LOG=0;UNDO_LOG=0</code>.
Most of those options are not recommended for regular use, that means you need to reset them after use.
</p>
......
......@@ -27,9 +27,9 @@ Quickstart
This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to:
</p>
<ul>
<li>Add the <code>h2*.jar</code> to the classpath (H2 does not have any dependencies)
</li><li>Use the JDBC driver class: <code>org.h2.Driver</code>
</li><li>The database URL <code>jdbc:h2:~/test</code> opens the database 'test' in your user home directory
<li>Add the <code class="notranslate">h2*.jar</code> to the classpath (H2 does not have any dependencies)
</li><li>Use the JDBC driver class: <code class="notranslate">org.h2.Driver</code>
</li><li>The database URL <code class="notranslate">jdbc:h2:~/test</code> opens the database 'test' in your user home directory
</li><li>A new database is automatically created
</li></ul>
......
......@@ -99,7 +99,7 @@ Depending on your platform and environment, there are multiple ways to start the
<td>Any</td>
<td>
Open a console window, navigate to the directory 'h2/bin' and type:
<pre>java -cp h2*.jar org.h2.tools.Server</pre>
<pre class="notranslate">java -cp h2*.jar org.h2.tools.Server</pre>
</td>
</tr>
</table>
......@@ -126,7 +126,7 @@ To change this, go to 'Preferences' and select 'Allow connections from other com
<p>
To find out which version of Java is installed, open a command prompt and type:
</p>
<pre>
<pre class="notranslate">
java -version
</pre>
<p>
......@@ -224,8 +224,8 @@ or close the console window.
<h2 id="console_settings">Settings of the H2 Console</h2>
<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>.
called <code class="notranslate">.h2.server.properties</code> in you user home directory.
For Windows installations, the user home directory is usually <code class="notranslate">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.
</p>
......@@ -235,7 +235,7 @@ The configuration file contains the settings of the application and is automatic
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:
</p>
<pre>
<pre class="notranslate">
import java.sql.*;
public class Test {
public static void main(String[] a)
......@@ -249,11 +249,11 @@ public class Test {
}
</pre>
<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
This code first loads the driver (<code class="notranslate">Class.forName(...)</code>)
and then opens a connection (using <code class="notranslate">DriverManager.getConnection()</code>).
The driver name is <code class="notranslate">"org.h2.Driver"</code>.
The database URL always needs to start with <code class="notranslate">jdbc:h2:</code>
to be recognized by this database. The second parameter in the <code class="notranslate">getConnection()</code> call
is the user name ('sa' for System Administrator in this example). The third parameter is the password.
In this database, user names are not case sensitive, but passwords are.
</p>
......@@ -278,13 +278,13 @@ The servers can be started in different ways, one is using the server tool.
<p>
To start the server tool from the command line with the default settings, run:
</p>
<pre>
<pre class="notranslate">
java -cp h2*.jar org.h2.tools.Server
</pre>
<p>
This will start the server tool with the default options. To get the list of options and default values, run:
</p>
<pre>
<pre class="notranslate">
java -cp h2*.jar org.h2.tools.Server -?
</pre>
<p>
......@@ -297,8 +297,8 @@ parts. For details, see the API documentation of the server tool.
To remotely connect to a database using the TCP server, use the following driver and database URL:
</p>
<ul>
<li>JDBC driver class: org.h2.Driver
</li><li>Database URL: jdbc:h2:tcp://localhost/~/test
<li>JDBC driver class: <code class="notranslate">org.h2.Driver</code>
</li><li>Database URL: <code class="notranslate">jdbc:h2:tcp://localhost/~/test</code>
</li></ul>
<p>
For details about the database URL, see also in Features.
......@@ -308,7 +308,7 @@ For details about the database URL, see also in Features.
<p>
Servers can also be started and stopped from within an application. Sample code:
</p>
<pre>
<pre class="notranslate">
import org.h2.tools.Server;
...
// start the TCP Server
......@@ -323,13 +323,13 @@ server.stop();
The TCP server can be stopped from another process.
To stop the server from the command line, run:
</p>
<pre>
<pre class="notranslate">
java org.h2.tools.Server -tcpShutdown tcp://localhost:9092
</pre>
<p>
To stop the server from a user application, use the following code:
</p>
<pre>
<pre class="notranslate">
org.h2.tools.Server.shutdownTcpServer("tcp://localhost:9094");
</pre>
<p>
......@@ -357,27 +357,27 @@ You can rename it to H2Dialect.java and include this as a patch in your applicat
<h2 id="using_toplink">Using TopLink and Glassfish</h2>
<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
<code class="notranslate">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>.
or by editing the file <code class="notranslate">sun-resources.xml</code>: at element
<code class="notranslate">jdbc-connection-pool</code>, set the attribute
<code class="notranslate">datasource-classname</code> to <code class="notranslate">org.h2.jdbcx.JdbcDataSource</code>.
</p>
<p>
The H2 database is compatible with HSQLDB and PostgreSQL.
To take advantage of H2 specific features, use the <code>H2Platform</code>.
To take advantage of H2 specific features, use the <code class="notranslate">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>.
<code class="notranslate">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:
</p>
<pre>
<pre class="notranslate">
&lt;property
name="toplink.target-database"
value="oracle.toplink.essentials.platform.database.H2Platform"/>
</pre>
<p>
In old versions of Glassfish, the property name is <code>toplink.platform.class.name</code>.
In old versions of Glassfish, the property name is <code class="notranslate">toplink.platform.class.name</code>.
</p>
<br />
......@@ -418,7 +418,7 @@ The server mode is similar, but it allows you to run the server in another proce
Add the h2*.jar file to your web application, and
add the following snippet to your web.xml file (between the 'context-param' and the 'filter' section):
</p>
<pre>
<pre class="notranslate">
&lt;listener>
&lt;listener-class>org.h2.server.web.DbStarter&lt;/listener-class>
&lt;/listener>
......@@ -429,7 +429,7 @@ By default the DbStarter listener opens an embedded connection
using the database URL 'jdbc:h2:~/test', user name 'sa', and password 'sa'.
If you want to use this connection within your servlet, you can access as follows:
</p>
<pre>
<pre class="notranslate">
Connection conn = getServletContext().getAttribute("connection");
</pre>
<p>
......@@ -437,7 +437,7 @@ The DbStarter can also start the TCP server, however this is disabled by default
To enable it, use the parameter db.tcpServer in the file web.xml. Here is the complete list of options.
These options need to be placed between the 'description' tag and the 'listener' / 'filter' tags:
</p>
<pre>
<pre class="notranslate">
&lt;context-param>
&lt;param-name>db.url&lt;/param-name>
&lt;param-value>jdbc:h2:~/test&lt;/param-value>
......@@ -466,7 +466,7 @@ The H2 Console is a standalone application and includes its own web server, but
used as a servlet as well. To do that, include the the h2 jar file in your application, and
add the following configuration to your web.xml:
</p>
<pre>
<pre class="notranslate">
&lt;servlet&gt;
&lt;servlet-name&gt;H2Console&lt;/servlet-name&gt;
&lt;servlet-class&gt;org.h2.server.web.WebServlet&lt;/servlet-class&gt;
......@@ -478,12 +478,12 @@ add the following configuration to your web.xml:
&lt;/servlet-mapping&gt;
</pre>
<p>
For details, see also <code>src/tools/WEB-INF/web.xml</code>.
For details, see also <code class="notranslate">src/tools/WEB-INF/web.xml</code>.
</p>
<p>
To create a web application with just the H2 Console, run the following command:
</p>
<pre>
<pre class="notranslate">
build warConsole
</pre>
......@@ -499,7 +499,7 @@ or it can be used outside the database as a standalone tool.
The built-in function CSVWRITE can be used to create a CSV file from a query.
Example:
</p>
<pre>
<pre class="notranslate">
CREATE TABLE TEST(ID INT, NAME VARCHAR);
INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World');
CALL CSVWRITE('test.csv', 'SELECT * FROM TEST');
......@@ -509,7 +509,7 @@ CALL CSVWRITE('test.csv', 'SELECT * FROM TEST');
<p>
A CSV file can be read using the function CSVREAD. Example:
</p>
<pre>
<pre class="notranslate">
SELECT * FROM CSVREAD('test.csv');
</pre>
......@@ -518,7 +518,7 @@ SELECT * FROM CSVREAD('test.csv');
The CSV tool can be used in a Java application even when not using a database at all.
Example:
</p>
<pre>
<pre class="notranslate">
import java.sql.*;
import org.h2.tools.Csv;
import org.h2.tools.SimpleResultSet;
......@@ -539,7 +539,7 @@ public class TestCsv {
It is possible to read a CSV file without opening a database.
Example:
</p>
<pre>
<pre class="notranslate">
import java.sql.*;
import org.h2.tools.Csv;
public class TestCsv {
......@@ -577,7 +577,7 @@ However, this is not recommended while the database is in use. Also, the databas
and quite large. The recommended way to backup a database is to create a compressed SQL script file.
This can be done using the Script tool:
</p>
<pre>
<pre class="notranslate">
java org.h2.tools.Script -url jdbc:h2:~/test -user sa -script test.zip -options compression zip
</pre>
<p>
......@@ -591,7 +591,7 @@ The built in FTP server could be used to retrieve the file from the server.
<p>
To restore a database from a SQL script file, you can use the RunScript tool:
</p>
<pre>
<pre class="notranslate">
java org.h2.tools.RunScript -url jdbc:h2:~/test -user sa -script test.zip -options compression zip
</pre>
<p>
......@@ -612,7 +612,7 @@ Other than the SCRIPT statement, the BACKUP statement does not lock the
database objects, and therefore does not block other users. The resulting
backup is transactionally consistent:
</p>
<pre>
<pre class="notranslate">
BACKUP TO 'backup.zip'
</pre>
<p>
......@@ -631,7 +631,7 @@ be guaranteed that the data is copied in the right order.
This database comes with a number of command line tools. To get more information about a tool,
start it with the parameter '-?', for example:
</p>
<pre>
<pre class="notranslate">
java -cp h2*.jar org.h2.tools.Backup -?
</pre>
<p>
......@@ -669,8 +669,8 @@ The steps to connect to a H2 database are:
</li><li>Click [OK] (as much as needed), stop OpenOffice (including the Quickstarter)
</li><li>Start OpenOffice Base
</li><li>Connect to an existing database; select [JDBC]; [Next]
</li><li>Example datasource URL: jdbc:h2:~/test
</li><li>JDBC driver class: org.h2.Driver
</li><li>Example datasource URL: <code class="notranslate">jdbc:h2:~/test</code>
</li><li>JDBC driver class: <code class="notranslate">org.h2.Driver</code>
</li></ul>
<p>
Now you can access the database stored in the current users home directory.
......@@ -689,8 +689,8 @@ Now, when creating a new database using the "Database Wizard" :
</p>
<ul><li>Click [File], [New], [Database].
</li><li>Select [Connect to existing database] and the select [JDBC]. Click next.
</li><li>Example datasource URL: jdbc:h2:~/test
</li><li>JDBC driver class: org.h2.Driver
</li><li>Example datasource URL: <code class="notranslate">jdbc:h2:~/test</code>
</li><li>JDBC driver class: <code class="notranslate">org.h2.Driver</code>
</li></ul>
<p>
Another solution to use H2 in NeoOffice is:
......@@ -711,7 +711,7 @@ and the application .jar file must be signed. Otherwise, when trying to write to
exception will occur: java.security.AccessControlException: access denied (java.io.FilePermission ... read).
Example permission tags:
</p>
<pre>
<pre class="notranslate">
&lt;security>
&lt;all-permissions/>
&lt;/security>
......@@ -729,7 +729,7 @@ for example the <a href="http://jakarta.apache.org/commons/dbcp/">Apache Commons
For H2, it is about twice as faster to get a connection from the built-in connection pool than to get
one using DriverManager.getConnection(). The build-in connection pool is used as follows:
</p>
<pre>
<pre class="notranslate">
import java.sql.*;
import org.h2.jdbcx.JdbcConnectionPool;
public class Test {
......@@ -758,7 +758,7 @@ tables in the database.
<p>
To initialize, call:
</p>
<pre>
<pre class="notranslate">
CREATE ALIAS IF NOT EXISTS FT_INIT FOR "org.h2.fulltext.FullText.init";
CALL FT_INIT();
</pre>
......@@ -766,7 +766,7 @@ CALL FT_INIT();
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:
</p>
<pre>
<pre class="notranslate">
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
INSERT INTO TEST VALUES(1, 'Hello World');
CALL FT_CREATE_INDEX('PUBLIC', 'TEST', NULL);
......@@ -776,7 +776,7 @@ PUBLIC is the schema, TEST is the table name. The list of column names (column s
in this case all columns are indexed. The index is updated in realtime.
To search the index, use the following query:
</p>
<pre>
<pre class="notranslate">
SELECT * FROM FT_SEARCH('Hello', 0, 0);
</pre>
<p>
......@@ -786,17 +786,17 @@ This will produce a result set that contains the query needed to retrieve the da
QUERY: "PUBLIC"."TEST" WHERE "ID"=1
</p>
<p>
To get the raw data, use <code>FT_SEARCH_DATA('Hello', 0, 0);</code>.
To get the raw data, use <code class="notranslate">FT_SEARCH_DATA('Hello', 0, 0);</code>.
The result contains the columns SCHEMA (the schema name),
TABLE (the table name), COLUMNS (an array of column names), and KEYS
(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
<code class="notranslate">SELECT T.* FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T
WHERE FT.TABLE='TEST' AND T.ID=FT.KEYS[0];</code>
</p>
<p>
You can also call the index from within a Java application:
</p>
<pre>
<pre class="notranslate">
org.h2.fulltext.FullText.search(conn, text, limit, offset);
org.h2.fulltext.FullText.searchData(conn, text, limit, offset);
</pre>
......@@ -808,7 +808,7 @@ How to do that depends on the application; if you use the H2 Console, you can ad
jar file to the environment variables H2DRIVERS or CLASSPATH.
To initialize the Lucene fulltext search in a database, call:
</p>
<pre>
<pre class="notranslate">
CREATE ALIAS IF NOT EXISTS FTL_INIT FOR "org.h2.fulltext.FullTextLucene.init";
CALL FTL_INIT();
</pre>
......@@ -816,7 +816,7 @@ CALL FTL_INIT();
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:
</p>
<pre>
<pre class="notranslate">
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
INSERT INTO TEST VALUES(1, 'Hello World');
CALL FTL_CREATE_INDEX('PUBLIC', 'TEST', NULL);
......@@ -826,7 +826,7 @@ PUBLIC is the schema, TEST is the table name. The list of column names (column s
in this case all columns are indexed. The index is updated in realtime. To search the index,
use the following query:
</p>
<pre>
<pre class="notranslate">
SELECT * FROM FTL_SEARCH('Hello', 0, 0);
</pre>
<p>
......@@ -836,17 +836,17 @@ This will produce a result set that contains the query needed to retrieve the da
QUERY: "PUBLIC"."TEST" WHERE "ID"=1
</p>
<p>
To get the raw data, use <code>FTL_SEARCH_DATA('Hello', 0, 0);</code>.
To get the raw data, use <code class="notranslate">FTL_SEARCH_DATA('Hello', 0, 0);</code>.
The result contains the columns SCHEMA (the schema name),
TABLE (the table name), COLUMNS (an array of column names), and KEYS
(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
<code class="notranslate">SELECT T.* FROM FTL_SEARCH_DATA('Hello', 0, 0) FT, TEST T
WHERE FT.TABLE='TEST' AND T.ID=FT.KEYS[0];</code>
</p>
<p>
You can also call the index from within a Java application:
</p>
<pre>
<pre class="notranslate">
org.h2.fulltext.FullTextLucene.search(conn, text, limit, offset);
org.h2.fulltext.FullTextLucene.searchData(conn, text, limit, offset);
</pre>
......@@ -858,13 +858,13 @@ This database supports user-defined variables. Variables start with @ and can be
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:
</p>
<pre>
<pre class="notranslate">
SET @USER = 'Joe';
</pre>
<p>
The value can also be changed using the SET() method. This is useful in queries:
</p>
<pre>
<pre class="notranslate">
SET @TOTAL = NULL;
SELECT X, SET(@TOTAL, IFNULL(@TOTAL, 1.) * X) F FROM SYSTEM_RANGE(1, 50);
</pre>
......@@ -879,7 +879,7 @@ There are no restrictions on the assigned values; large objects (LOBs) are suppo
<p>
Date, time and timestamp values support ISO 8601 formatting, including time zone:
</p>
<pre>
<pre class="notranslate">
CALL TIMESTAMP '2008-01-01 12:00:00+01:00';
</pre>
<p>
......@@ -896,7 +896,7 @@ the database using the RUNSCRIPT command or the RunScript tool in the new time z
<p>
Use the following configuration to start and stop the H2 TCP server using the Spring Framework:
</p>
<pre>
<pre class="notranslate">
&lt;bean id = "org.h2.tools.Server"
class="org.h2.tools.Server"
factory-method="createTcpServer"
......@@ -906,7 +906,7 @@ Use the following configuration to start and stop the H2 TCP server using the Sp
&lt;/bean&gt;
</pre>
<p>
The "destroy-method" will help prevent exceptions on hot-redeployment or when restarting the server.
The <code class="notranslate">"destroy-method"</code> will help prevent exceptions on hot-redeployment or when restarting the server.
</p>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -297,6 +297,9 @@ java org.h2.test.TestAll timer
/*
disable translation in download
<span class="notranslate"></span>
mvcc merge problem
System.setProperty("h2.optimizeInList", "true");
......
......@@ -128,10 +128,11 @@ public class GenerateDoc {
for (int i = 0; i < meta.getColumnCount(); i++) {
String k = StringUtils.toLowerEnglish(meta.getColumnLabel(i + 1));
String value = rs.getString(i + 1);
value = value.trim();
map.put(k, PageParser.escapeHtml(value));
}
String topic = rs.getString("TOPIC");
String syntax = rs.getString("SYNTAX");
String syntax = rs.getString("SYNTAX").trim();
syntax = PageParser.escapeHtml(syntax);
// if enabled, HTML docs get very wide
// syntax = StringUtils.replaceAll(syntax, "<br />", " ");
......@@ -141,7 +142,6 @@ public class GenerateDoc {
// remove newlines in the regular text
String text = map.get("text");
if (text != null) {
text = text.trim();
// text is enclosed in <p> .. </p> so this works.
text = StringUtils.replaceAll(text, "<br /><br />", "</p><p>");
text = StringUtils.replaceAll(text, "<br />", " ");
......@@ -153,6 +153,7 @@ public class GenerateDoc {
// link = StringUtils.replaceAll(link, "_", "");
link = StringUtils.replaceAll(link, "@", "_");
map.put("link", StringUtils.urlEncode(link));
list.add(map);
}
session.put(key, list);
......
......@@ -613,4 +613,5 @@ modern slight boost characteristics significantly gae vfs centrally ten
approach risky getters suxxess gmb delegate delegating delegates collisions
linkage superfluous disallow scoop moebius inputs copilot dmoebius leod jenkov
jakob poker docware peter unstable measurable scramble reissued recreation
scrambling distinguish official unofficial distinguishable overwrites lastval
\ No newline at end of file
scrambling distinguish official unofficial distinguishable overwrites lastval
notranslate
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论