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

Documentation.

上级 a6d7733e
......@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1>
<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>Creating a comment on a column didn't work if the schema name was equal the database name.
</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).
......@@ -26,7 +27,7 @@ Change Log
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>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).
</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.
......
......@@ -11,22 +11,23 @@ H2 Database Engine
</title>
<style type="text/css">
td, input, select, textarea, body, td, th {
font: 9pt Tahoma, Arial, Helvetica, sans-serif;
font: 10pt Tahoma, Arial, Helvetica, sans-serif;
font-weight: normal;
}
h1, h2, h3, h4, h5 {
font: 9pt Tahoma, Arial, Helvetica, sans-serif;
font: 10pt Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold;
}
h1 {
background-color: #0000bb;
padding: 2px 4px 2px 4px;
margin-bottom: 0px;
color: #fff;
font-size: 15pt;
font-size: 19pt;
line-height: normal;
}
h2 {
font-size: 10pt;
font-size: 13pt;
}
a.link {
text-decoration: underline;
......@@ -45,16 +46,32 @@ a:hover {
color: blue;
}
td, input, select, textarea, body, code, pre {
font-size: 9pt;
font-size: 10pt;
}
pre {
background-color: #ece9d8;
border: 1px solid rgb(172, 168, 153);
padding: 4px;
border: 1px solid #aca899;
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 {
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 {
background-color: #ffffff;
......@@ -84,10 +101,10 @@ li {
</style>
</head><body>
<div style="width:660px; margin:0 auto;">
<div style="width:780px; margin:0 auto;">
<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>
<ul><li><a href="http://h2database.com">H2</a> is
......@@ -147,7 +164,7 @@ Reference:
</p>
</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>
<pre>
......
......@@ -40,7 +40,7 @@ JaQu
<h2 id="what_is_jaqu">What is JaQu</h2>
<p>
JaQu stands for Java Query and allows to access databases using pure Java.
JaQu provides a fluent interface (or internal DSL) to access a database.
JaQu provides a fluent interface (or internal DSL).
JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a
Microsoft .NET technology). The following JaQu code:
</p>
......@@ -60,21 +60,21 @@ WHERE P.UNITS_IN_STOCK = 0
<h2 id="differences">Differences to Other Data Access Tools</h2>
<p>
Unlike SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java,
auto-complete in the IDE and Javadoc and are supported. Type checking is performed by the compiler.
auto-complete in the IDE is supported. Type checking is performed by the compiler.
JaQu fully protects against SQL injection.
</p>
<p>
JaQu is more a replacement for JDBC than it is a replacement for tools like Hibernate.
With JaQu, you don't write SQL statements as Strings.
JaQu is meant as replacement for JDBC and SQL and not as much as a replacement for tools like Hibernate.
With JaQu, you don't write SQL statements as strings.
JaQu is much smaller and simpler than other persistence frameworks such as Hibernate,
but it also does not provide all the features of those.
Unlike iBatis and Hibernate, no XML or annotation based configuration is required;
instead the configuration (if required at all) is done in pure Java, in the application itself.
instead the configuration (if required at all) is done in pure Java, within the application.
</p>
<p>
JaQu does not require or contain any data caching mechanism. Like JDBC and iBatis,
JaQu provides full control over when and what SQL statements are executed
(but without having to write SQL statements as Strings).
(but without having to write SQL statements as strings).
</p>
<h3>Restrictions</h3>
......@@ -85,8 +85,9 @@ Use <code>java.lang.Boolean, Integer, Long, Double</code> instead.
<h3>Why in Java?</h3>
<p>
Most people use Java in their application. Mixing Java and another language (for example Scala or Groovy)
in the same application is complicated: you would need to split the application and database code.
Most applications are written in Java. Mixing Java and another language (for example Scala or Groovy)
in the same application is complicated: you would need to split the application and database code,
and write adapter / wrapper code.
</p>
<h2 id="current_state">Current State</h2>
......@@ -247,12 +248,14 @@ public class Test {
<h2 id="configuration">Configuration</h2>
<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,
or a field to a column with another name, create a function called <code>define</code> in the data class.
Example:
</p>
<pre>
import static org.h2.jaqu.Define.*;
public class Product implements Table {
public Integer productId;
......@@ -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.
Unlike when using annotations, the compiler can check the syntax even for multi-column
objects (multi-column indexes, multi-column primary keys and so on).
Because the definition is written in regular Java, the configuration can depend on the environment.
This is not possible using annotations.
Because the definition is written in Java, the configuration can be set at runtime,
which is not possible using annotations.
Unlike XML mapping configuration, the configuration is integrated in the class itself.
</p>
<h2 id="natural_syntax">Natural Syntax</h2>
<p>The plan is to support more natural (pure Java) syntax in conditions.
To do that, the condition class is de-compiled to a SQL condition.
A proof of concept decompiler is included (but it doesn't work yet).
A proof of concept decompiler is included (but it doesn't fully work yet; patches are welcome).
The planned syntax is:
</p>
<pre>
......@@ -301,7 +304,7 @@ long count = db.from(co).
<h2 id="other_ideas">Other Ideas</h2>
<p>
This project has just been started, and nothing is fixed yet.
Some ideas for what to implement are:
Some ideas are:
</p>
<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).
......
......@@ -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>)
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>.
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>
<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.
</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.
......
......@@ -17,8 +17,8 @@ H2 In Use and Links
<h1>H2 In Use and Links</h1>
<p>
Those are just a few links to products using or supporting H2.
If you want to add a link, please send it to the support email address or post it in the group.
Listed below are just a few links to products using or supporting H2.
If you want to add a link, please send it to the support email address or post it to the group.
</p>
<a href="#books">
Books</a><br />
......
......@@ -6,17 +6,17 @@
*/
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;
}
h1, h2, h3, h4, h5 {
font: 9pt Tahoma, Arial, Helvetica, sans-serif;
font: 10pt Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold;
}
td, input, select, textarea, body, code, pre {
font-size: 9pt;
font-size: 10pt;
}
pre {
......@@ -60,23 +60,24 @@ body {
h1 {
background-color: #0000bb;
padding: 2px 4px 2px 4px;
margin-top: 11px;
color: #fff;
font-size: 15pt;
font-size: 19pt;
line-height: normal;
}
h2 {
font-size: 13pt;
font-size: 16pt;
margin-top: 1.5em;
}
h3 {
font-size: 11pt;
font-size: 13pt;
margin-top: 1.5em;
}
h4 {
font-size: 9pt;
font-size: 10pt;
margin-top: 1.5em;
}
......@@ -110,7 +111,7 @@ th {
text-align: left;
background-color: #ece9d8;
border: 1px solid #aca899;
padding: 2px;
padding: 3px;
}
td {
......@@ -118,7 +119,7 @@ td {
text-align: left;
vertical-align: top;
border: 1px solid #aca899;
padding: 2px;
padding: 3px;
}
form {
......
......@@ -64,6 +64,8 @@ Tutorial
Date and Time</a><br />
<a href="#spring">
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>
<p>
......@@ -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.
</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>
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论