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

Documentation.

上级 a6d7733e
...@@ -18,15 +18,16 @@ Change Log ...@@ -18,15 +18,16 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Creating a comment on a column didn't work if the schema name was equal the database name. <ul><li>JMX (the Java management extension) is now supported. Issue 253.
</li><li>When using multi-version concurrency, re-running a prepared statement with the same parameters </li><li>Creating a comment on a column didn't work if the schema name was equal the database name.
would sometimes give the same result even if another connection committed a change (the previous result was sometimes </li><li>When using multi-version concurrency, re-running a prepared statement with the same parameters
would sometimes give the same result even if another connection committed a change (the previous result was sometimes
re-used incorrectly). re-used incorrectly).
</li><li>When using SELECT_FOR_UPDATE_MVCC (lock only the selected rows when using MVCC), </li><li>When using SELECT_FOR_UPDATE_MVCC (lock only the selected rows when using MVCC),
the selected rows were sometimes not locked correctly. the selected rows were sometimes not locked correctly.
</li><li>When using Lucene 3, the index files were not always closed when the database was closed. </li><li>When using Lucene 3, the index files were not always closed when the database was closed.
</li><li>Concurrently preparing a statement and altering a table could throw a table not found exception. </li><li>Concurrently preparing a statement and altering a table could throw a table not found exception.
<li><li>When concurrently preparing many statements with a subquery, in some cases the query didn't run </li><li>When concurrently preparing many statements with a subquery, in some cases the query didn't run
(Column "..." must be in the GROUP BY list). (Column "..." must be in the GROUP BY list).
</li><li>CallableStatement: now the syntax "{? = CALL...}" is supported as well. </li><li>CallableStatement: now the syntax "{? = CALL...}" is supported as well.
</li><li>Lob in databases: two small BLOB or CLOB values were always considered equal. </li><li>Lob in databases: two small BLOB or CLOB values were always considered equal.
......
...@@ -11,22 +11,23 @@ H2 Database Engine ...@@ -11,22 +11,23 @@ H2 Database Engine
</title> </title>
<style type="text/css"> <style type="text/css">
td, input, select, textarea, body, td, th { td, input, select, textarea, body, td, th {
font: 9pt Tahoma, Arial, Helvetica, sans-serif; font: 10pt Tahoma, Arial, Helvetica, sans-serif;
font-weight: normal; font-weight: normal;
} }
h1, h2, h3, h4, h5 { h1, h2, h3, h4, h5 {
font: 9pt Tahoma, Arial, Helvetica, sans-serif; font: 10pt Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold; font-weight: bold;
} }
h1 { h1 {
background-color: #0000bb; background-color: #0000bb;
padding: 2px 4px 2px 4px; padding: 2px 4px 2px 4px;
margin-bottom: 0px;
color: #fff; color: #fff;
font-size: 15pt; font-size: 19pt;
line-height: normal; line-height: normal;
} }
h2 { h2 {
font-size: 10pt; font-size: 13pt;
} }
a.link { a.link {
text-decoration: underline; text-decoration: underline;
...@@ -45,16 +46,32 @@ a:hover { ...@@ -45,16 +46,32 @@ a:hover {
color: blue; color: blue;
} }
td, input, select, textarea, body, code, pre { td, input, select, textarea, body, code, pre {
font-size: 9pt; font-size: 10pt;
} }
pre { pre {
background-color: #ece9d8; background-color: #ece9d8;
border: 1px solid rgb(172, 168, 153); border: 1px solid #aca899;
padding: 4px; padding: 6px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: 2px 2px 2px #aca899;
-webkit-box-shadow: 2px 2px 2px #aca899;
-khtml-box-shadow: 2px 2px 2px #aca899;
-o-box-shadow: 2px 2px 2px #aca899;
box-shadow: 2px 2px 2px #aca899;
} }
code { code {
background-color: #ece9d8; background-color: #ece9d8;
padding: 0px 2px; padding: 0px 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;
} }
table { table {
background-color: #ffffff; background-color: #ffffff;
...@@ -84,10 +101,10 @@ li { ...@@ -84,10 +101,10 @@ li {
</style> </style>
</head><body> </head><body>
<div style="width:660px; margin:0 auto;"> <div style="width:780px; margin:0 auto;">
<h1>H2 Database Engine Cheat Sheet</h1> <h1>H2 Database Engine Cheat Sheet</h1>
<div style="float:left; margin:5px; width:320px;"> <div style="float:left; margin:5px; width:370px;">
<h2>Using H2</h2> <h2>Using H2</h2>
<ul><li><a href="http://h2database.com">H2</a> is <ul><li><a href="http://h2database.com">H2</a> is
...@@ -147,7 +164,7 @@ Reference: ...@@ -147,7 +164,7 @@ Reference:
</p> </p>
</div> </div>
<div style="float:right; padding:5px; width:320px;"> <div style="float:right; padding:5px; width:370px;">
<h2><a href="tutorial.html#connecting_using_jdbc">Using the JDBC API</a></h2> <h2><a href="tutorial.html#connecting_using_jdbc">Using the JDBC API</a></h2>
<pre> <pre>
......
...@@ -40,7 +40,7 @@ JaQu ...@@ -40,7 +40,7 @@ JaQu
<h2 id="what_is_jaqu">What is JaQu</h2> <h2 id="what_is_jaqu">What is JaQu</h2>
<p> <p>
JaQu stands for Java Query and allows to access databases using pure Java. 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 provides a fluent interface (or internal DSL).
JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a
Microsoft .NET technology). The following JaQu code: Microsoft .NET technology). The following JaQu code:
</p> </p>
...@@ -60,21 +60,21 @@ WHERE P.UNITS_IN_STOCK = 0 ...@@ -60,21 +60,21 @@ WHERE P.UNITS_IN_STOCK = 0
<h2 id="differences">Differences to Other Data Access Tools</h2> <h2 id="differences">Differences to Other Data Access Tools</h2>
<p> <p>
Unlike SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java, 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. auto-complete in the IDE is supported. Type checking is performed by the compiler.
JaQu fully protects against SQL injection. JaQu fully protects against SQL injection.
</p> </p>
<p> <p>
JaQu is more a replacement for JDBC than it is a replacement for tools like Hibernate. JaQu is meant as replacement for JDBC and SQL and not as much as a replacement for tools like Hibernate.
With JaQu, you don't write SQL statements as Strings. With JaQu, you don't write SQL statements as strings.
JaQu is much smaller and simpler than other persistence frameworks such as Hibernate, JaQu is much smaller and simpler than other persistence frameworks such as Hibernate,
but it also does not provide all the features of those. but it also does not provide all the features of those.
Unlike iBatis and Hibernate, no XML or annotation based configuration is required; 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. instead the configuration (if required at all) is done in pure Java, within the application.
</p> </p>
<p> <p>
JaQu does not require or contain any data caching mechanism. Like JDBC and iBatis, 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 provides full control over when and what SQL statements are executed
(but without having to write SQL statements as Strings). (but without having to write SQL statements as strings).
</p> </p>
<h3>Restrictions</h3> <h3>Restrictions</h3>
...@@ -85,8 +85,9 @@ Use <code>java.lang.Boolean, Integer, Long, Double</code> instead. ...@@ -85,8 +85,9 @@ Use <code>java.lang.Boolean, Integer, Long, Double</code> instead.
<h3>Why in Java?</h3> <h3>Why in Java?</h3>
<p> <p>
Most people use Java in their application. Mixing Java and another language (for example Scala or Groovy) Most applications are written in Java. Mixing Java and another language (for example Scala or Groovy)
in the same application is complicated: you would need to split the application and database code. in the same application is complicated: you would need to split the application and database code,
and write adapter / wrapper code.
</p> </p>
<h2 id="current_state">Current State</h2> <h2 id="current_state">Current State</h2>
...@@ -247,12 +248,14 @@ public class Test { ...@@ -247,12 +248,14 @@ public class Test {
<h2 id="configuration">Configuration</h2> <h2 id="configuration">Configuration</h2>
<p> <p>
JaQu does not require any configuration when using the default mapping. JaQu does not require any configuration when using the default field to column mapping.
To define table indices, or if you want to map a class to a table with a different name, 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. or a field to a column with another name, create a function called <code>define</code> in the data class.
Example: Example:
</p> </p>
<pre> <pre>
import static org.h2.jaqu.Define.*;
public class Product implements Table { public class Product implements Table {
public Integer productId; public Integer productId;
...@@ -274,15 +277,15 @@ The method <code>define()</code> contains the mapping definition. It is called o ...@@ -274,15 +277,15 @@ The method <code>define()</code> contains the mapping definition. It is called o
when the class is used for the first time. Like annotations, the mapping is defined in the class itself. 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 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). 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. Because the definition is written in Java, the configuration can be set at runtime,
This is not possible using annotations. which is not possible using annotations.
Unlike XML mapping configuration, the configuration is integrated in the class itself. Unlike XML mapping configuration, the configuration is integrated in the class itself.
</p> </p>
<h2 id="natural_syntax">Natural Syntax</h2> <h2 id="natural_syntax">Natural Syntax</h2>
<p>The plan is to support more natural (pure Java) syntax in conditions. <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. 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). A proof of concept decompiler is included (but it doesn't fully work yet; patches are welcome).
The planned syntax is: The planned syntax is:
</p> </p>
<pre> <pre>
...@@ -301,7 +304,7 @@ long count = db.from(co). ...@@ -301,7 +304,7 @@ long count = db.from(co).
<h2 id="other_ideas">Other Ideas</h2> <h2 id="other_ideas">Other Ideas</h2>
<p> <p>
This project has just been started, and nothing is fixed yet. This project has just been started, and nothing is fixed yet.
Some ideas for what to implement are: Some ideas are:
</p> </p>
<ul><li>Support queries on collections (instead of using a database). <ul><li>Support queries on collections (instead of using a database).
</li><li>Provide API level compatibility with JPA (so that JaQu can be used as an extension of JPA). </li><li>Provide API level compatibility with JPA (so that JaQu can be used as an extension of JPA).
......
...@@ -30,10 +30,10 @@ H2 is dual licensed and available under a modified version of the ...@@ -30,10 +30,10 @@ 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>) 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>). 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 <em class="u">underlined</em>. The changes to the MPL are <em class="u">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. There is a license FAQ for both the MPL and the EPL, most of that is applicable to the H2 license as well.
</p> </p>
<ul> <ul>
<li>You can use H2 for free. You can integrate it into your application (including commercial applications), <li>You can use H2 for free. You can integrate it into your applications (including in commercial applications),
and you can distribute it. and you can distribute it.
</li><li>Files containing only your code are not covered by this license (it is 'commercial friendly'). </li><li>Files containing only your code are not covered by this license (it is 'commercial friendly').
</li><li>Modifications to the H2 source code must be published. </li><li>Modifications to the H2 source code must be published.
......
...@@ -17,8 +17,8 @@ H2 In Use and Links ...@@ -17,8 +17,8 @@ H2 In Use and Links
<h1>H2 In Use and Links</h1> <h1>H2 In Use and Links</h1>
<p> <p>
Those are just a few links to products using or supporting H2. Listed below are just a few links to products using or supporting H2.
If you want to add a link, please send it to the support email address or post it in the group. If you want to add a link, please send it to the support email address or post it to the group.
</p> </p>
<a href="#books"> <a href="#books">
Books</a><br /> Books</a><br />
......
...@@ -6,17 +6,17 @@ ...@@ -6,17 +6,17 @@
*/ */
td, input, select, textarea, body, code, pre, td, th { td, input, select, textarea, body, code, pre, td, th {
font: 9pt/130% Tahoma, Arial, Helvetica, sans-serif; font: 10pt/130% Tahoma, Arial, Helvetica, sans-serif;
font-weight: normal; font-weight: normal;
} }
h1, h2, h3, h4, h5 { h1, h2, h3, h4, h5 {
font: 9pt Tahoma, Arial, Helvetica, sans-serif; font: 10pt Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold; font-weight: bold;
} }
td, input, select, textarea, body, code, pre { td, input, select, textarea, body, code, pre {
font-size: 9pt; font-size: 10pt;
} }
pre { pre {
...@@ -60,23 +60,24 @@ body { ...@@ -60,23 +60,24 @@ body {
h1 { h1 {
background-color: #0000bb; background-color: #0000bb;
padding: 2px 4px 2px 4px; padding: 2px 4px 2px 4px;
margin-top: 11px;
color: #fff; color: #fff;
font-size: 15pt; font-size: 19pt;
line-height: normal; line-height: normal;
} }
h2 { h2 {
font-size: 13pt; font-size: 16pt;
margin-top: 1.5em; margin-top: 1.5em;
} }
h3 { h3 {
font-size: 11pt; font-size: 13pt;
margin-top: 1.5em; margin-top: 1.5em;
} }
h4 { h4 {
font-size: 9pt; font-size: 10pt;
margin-top: 1.5em; margin-top: 1.5em;
} }
...@@ -110,7 +111,7 @@ th { ...@@ -110,7 +111,7 @@ th {
text-align: left; text-align: left;
background-color: #ece9d8; background-color: #ece9d8;
border: 1px solid #aca899; border: 1px solid #aca899;
padding: 2px; padding: 3px;
} }
td { td {
...@@ -118,7 +119,7 @@ td { ...@@ -118,7 +119,7 @@ td {
text-align: left; text-align: left;
vertical-align: top; vertical-align: top;
border: 1px solid #aca899; border: 1px solid #aca899;
padding: 2px; padding: 3px;
} }
form { form {
......
...@@ -64,6 +64,8 @@ Tutorial ...@@ -64,6 +64,8 @@ Tutorial
Date and Time</a><br /> Date and Time</a><br />
<a href="#spring"> <a href="#spring">
Using Spring</a><br /> Using Spring</a><br />
<a href="#jmx">
Java Management Extension (JMX)</a><br />
<h2 id="tutorial_starting_h2_console">Starting and Using the H2 Console</h2> <h2 id="tutorial_starting_h2_console">Starting and Using the H2 Console</h2>
<p> <p>
...@@ -1236,5 +1238,35 @@ Use the following configuration to start and stop the H2 TCP server using the Sp ...@@ -1236,5 +1238,35 @@ Use the following configuration to start and stop the H2 TCP server using the Sp
The <code>destroy-method</code> will help prevent exceptions on hot-redeployment or when restarting the server. The <code>destroy-method</code> will help prevent exceptions on hot-redeployment or when restarting the server.
</p> </p>
<h2 id="jmx">Java Management Extension (JMX)</h2>
<p>
Management over JMX is supported, but not enabled by default.
To enable JMX, append <code>;JMX=TRUE</code> to the database URL when opening the database.
Various tools support JMX, one such tool is the <code>jconsole</code>.
When opening the <code>jconsole</code>, connect to the process where the database is open
(when using the server mode, you need to connect to the server process). Then go to the <code>MBeans</code> section.
Under <code>org.h2</code> you will find one entry per database. The object name of the entry
is the database short name, plus the path (each colon is replaced with an underscore character).
</p>
<p>
The following attributes and operations are supported:
</p>
<ul><li><code>CacheSize</code>: the cache size currently in use in KB.
</li><li><code>CacheSizeMax</code> (read/write): the maximum cache size in KB.
</li><li><code>Exclusive</code>: whether this database is open in exclusive mode or not.
</li><li><code>FileReadCount</code>: the number of file read operations since the database was opened.
</li><li><code>FileSize</code>: the file size in KB.
</li><li><code>FileWriteCount</code>: the number of file write operations since the database was opened.
</li><li><code>FileWriteCountTotal</code>: the number of file write operations since the database was created.
</li><li><code>LogMode</code> (read/write): the current transaction log mode. See <code>SET LOG</code> for details.
</li><li><code>Mode</code>: the compatibility mode (<code>REGULAR</code> if no compatibility mode is used).
</li><li><code>MultiThreaded</code>: true if multi-threaded is enabled.
</li><li><code>Mvcc</code>: true if <code>MVCC</code> is enabled.
</li><li><code>ReadOnly</code>: true if the database is read-only.
</li><li><code>TraceLevel</code> (read/write): the file trace level.
</li><li><code>Version</code>: the database version in use.
</li><li><code>listSettings</code>: list the database settings.
</li><li><code>listSessions</code>: list the open sessions, including currently executing statement (if any) and locked tables (if any).
</li></ul>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html> <!-- [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.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论