提交 91e00175 authored 作者: Thomas Mueller's avatar Thomas Mueller

Documentation.

上级 8cd6f45c
......@@ -537,7 +537,7 @@ CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ] name
{ { ( { columnDefinition | constraint } [,...] ) [ AS select ] }
| { AS select } }
[ ENGINE tableEngineName ] [ NOT PERSISTENT ]
[ ENGINE tableEngineName ] [ TRANSACTIONAL ] [ NOT PERSISTENT ]
","
Creates a new table.
......@@ -560,7 +560,8 @@ The table engine class must implement the interface org.h2.api.TableEngine.
Tables with the NOT PERSISTENT modifier are kept fully in memory, and all
rows are lost when the database is closed.
This command commits an open transaction.
This command commits an open transaction, except when using
TRANSACTIONAL (only supported for temporary tables).
","
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))
"
......@@ -719,11 +720,12 @@ DROP SEQUENCE SEQ_ID
"
"Commands (DDL)","DROP TABLE","
DROP TABLE [ IF EXISTS ] tableName [,...]
DROP TABLE [ IF EXISTS ] tableName [,...] [ CASCADE | RESTRICT ]
","
Drops an existing table, or a list of existing tables.
Drops an existing table, or a list of tables.
All dependent views are dropped as well if the CASCADE clause is used (the default).
The command will fail if dependent views exist and the RESTRICT clause is used.
This command commits an open transaction.
This will also drop all views that depend on this table.
","
DROP TABLE TEST
"
......@@ -752,8 +754,9 @@ DROP USER TOM
"Commands (DDL)","DROP VIEW","
DROP VIEW [ IF EXISTS ] viewName [ RESTRICT | CASCADE ]
","
Drops a view, and all dependent views if the CASCADE clause is used.
The command will fail if dependent views exist and the RESTRICT clause is used. This is the default.
Drops an existing view.
All dependent views are dropped as well if the CASCADE clause is used (the default).
The command will fail if dependent views exist and the RESTRICT clause is used.
This command commits an open transaction.
","
DROP VIEW TEST_VIEW
......
......@@ -1203,9 +1203,11 @@ This database supports a pluggable file system API. The file system implementati
is selected using a file name prefix. The following file systems are included:
</p>
<ul><li><code>zip:</code> read-only zip-file based file system. Format: <code>zip:/zipFileName!/fileName</code>.
</li><li><code>split:</code> file system that splits files in 1 GB files (stackable with other file systems).
</li><li><code>nio:</code> file system that uses <code>FileChannel</code> instead of <code>RandomAccessFile</code> (faster in some operating systems).
</li><li><code>nioMapped:</code> file system that uses memory mapped files (faster in some operating systems).
</li><li><code>split:</code> file system that splits files in 1 GB files (stackable with other file systems).
Please note that there currently is a file size limitation of 2 GB when using this file system.
To work around this limitation, combine it with the split file system: <code>split:nioMapped:test</code>.
</li><li><code>memFS:</code> in-memory file system (slower than mem; experimental; mainly used for testing the database engine itself).
</li><li><code>memLZF:</code> compressing in-memory file system (slower than memFS but uses less memory; experimental; mainly used for testing the database engine itself).
</li></ul>
......
......@@ -18,7 +18,13 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>The wrong exception was thrown when trying to connect to a server if the server was not running.
<ul><li>Local temporary tables can now be created without having to commit a transaction
using CREATE LOCAL TEMPORARY TABLE TEMP(ID INT PRIMARY KEY) TRANSACTIONAL.
</li><li>New system property h2.dropRestrict (default false) to change the
default action for DROP TABLE and DROP VIEW (false for CASCADE, true for RESTRICT).
The plan is to enable this property by default in version 1.3.x.
</li><li>DROP TABLE now also supports CASCADE (still the default) and RESTRICT.
</li><li>The wrong exception was thrown when trying to connect to a server if the server was not running.
</li><li>UNION queries where the first query contains a nested query were parsed incorrectly.
Example: "select 1 from (select 2 from dual) union select 3 from dual" was parsed as
"select 1 from ((select 2 from dual) union select 3 from dual)". Fixed.
......
......@@ -20,12 +20,23 @@ H2 In Use and Links
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.
</p>
<h2>Books</h2>
<a href="#books">
Books</a><br />
<a href="#extensions">
Extensions</a><br />
<a href="#blog">
Blog Articles</a><br />
<a href="#tools">
Database Frontends / Tools</a><br />
<a href="#projects">
Products and Projects</a><br />
<h2 id="books">Books</h2>
<a href="http://code.google.com/p/seaminaction/wiki/GettingStarted">
Seam In Action</a>
<h2>Extensions</h2>
<h2 id="extensions">Extensions</h2>
<a href="http://grails.org/H2+Database+Plugin">
Grails H2 Database Plugin</a>
<br />
......@@ -38,7 +49,7 @@ H2Sharp: ADO.NET interface for the H2 database engine</a>
<a href="http://geosysin.iict.ch/irstv-trac/wiki/H2spatial/Download">
H2 Spatial: spatial functions to H2 database</a>
<h2>Blog Articles</h2>
<h2 id="blog">Blog Articles</h2>
<a href="http://blog.zvikico.com/2009/12/analyzing-csvs-with-h2.html">
Analyzing CSVs with H2 in under 10 minutes (2009-12-07)</a><br />
<a href="http://sbdevel.wordpress.com/2009/06/15/efficient-sorting-and-iteration-on-large-databases">
......@@ -80,14 +91,14 @@ Java Source Net</a><br />
<a href="http://packman.links2linux.org/package/h2">
Linux Package Manager</a><br />
<h2>Database Frontends / Tools</h2>
<h2 id="tools">Database Frontends / Tools</h2>
<p><a href="http://www.dbsolo.com">
DB Solo</a><br />
SQL query tool.
</p>
<p><a href="http://www.minq.se/products/dbvis">
<p><a href="http://www.dbvis.com">
DbVisualizer</a><br />
Database tool.
</p>
......@@ -107,6 +118,11 @@ HenPlus</a><br />
HenPlus is a SQL shell written in Java.
</p>
<p><a href="http://www.openoffice.org">
OpenOffice</a><br />
Base is OpenOffice.org's database application. It provides access to relational data sources.
</p>
<p><a href="http://www.razorsql.com">
RazorSQL</a><br />
An SQL query tool, database browser, SQL editor, and database administration tool.
......@@ -132,7 +148,7 @@ SQuirreL DB Copy Plugin</a><br />
Tool to copy data from one database to another.
</p>
<h2>Products and Projects</h2>
<h2 id="projects">Products and Projects</h2>
<p><a href="http://www.accuprocess.com">
AccuProcess</a><br />
......
......@@ -37,6 +37,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Enable h2.optimizeOr (convert OR conditions to IN(..) if possible).
</li><li>Disable h2.databaseToUpper (database short names are converted to uppercase).
</li><li>Enable h2.dropRestrict (default action for DROP is RESTRICT).
Change documentation.
</li></ul>
<h2>Priority 1</h2>
......@@ -49,11 +50,12 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
<h2>Priority 2</h2>
<ul><li>Improve test code coverage.
</li><li>Test multi-threaded in-memory db access.
</li><li>Access rights: remember the owner of an object. Create, alter and drop privileges. COMMENT: allow owner of object to change it. Issue 208
</li><li>Access rights: remember the owner of an object. Create, alter and drop privileges. COMMENT: allow owner of object to change it. Issue 208.
</li><li>Full outer joins.
</li><li>Clustering: support mixed clustering mode (one embedded, others in server mode).
</li><li>Clustering: reads should be randomly distributed (optional) or to a designated database on RAM (parameter: READ_FROM=3).
</li><li>PostgreSQL catalog: use BEFORE SELECT triggers instead of views over metadata tables.
</li><li>Compatibility: automatically load functions from a script depending on the mode - see FunctionsMySQL.java, issue 211.
</li><li>Test very large databases and LOBs (up to 256 GB).
</li><li>Support hints for the optimizer (which index to use, enforce the join order).
</li><li>Sequence: add features [NO] MINVALUE, MAXVALUE, CYCLE.
......@@ -75,7 +77,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Pluggable data type (for streaming, hashing, compression, validation, conversion, encryption).
</li><li>CHECK: find out what makes CHECK=TRUE slow, move to CHECK2.
</li><li>Drop with invalidate views (so that source code is not lost). Check what other databases do exactly.
</li><li>Drop with restrict (currently cascade is the default).
</li><li>Index usage for (ID, NAME)=(1, 'Hi'); document.
</li><li>Make DDL (Data Definition) operations transactional.
</li><li>RANK() and DENSE_RANK(), Partition using OVER().
......@@ -511,6 +512,8 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Optimizer: use a histogram of the data, specially for non-normal distributions.
</li><li>Trigger: allow declaring as source code (like functions).
</li><li>User defined aggregate: allow declaring as source code (like functions).
</li><li>The error "table not found" is sometimes caused by using the wrong database.
Add "(this database is empty)" to the exception message if applicable.
</li></ul>
<h2>Not Planned</h2>
......
......@@ -34,6 +34,8 @@ Tutorial
Using TopLink and Glassfish</a><br />
<a href="#using_eclipselink">
Using EclipseLink</a><br />
<a href="#using_activemq">
Using Apache ActiveMQ</a><br />
<a href="#web_applications">
Using Databases in Web Applications</a><br />
<a href="#csv">
......@@ -567,6 +569,19 @@ If this platform is not available in your version of EclipseLink, you can use th
See also <a href="http://wiki.eclipse.org/EclipseLink/Development/Incubator/Extensions/H2Platform">H2Platform</a>.
</p>
<h2 id="using_activemq">Using Apache ActiveMQ</h2>
<p>
When using H2 as the backend database for Apache ActiveMQ, please use the <code>TransactDatabaseLocker</code>
instead of the default locking mechanism. Otherwise the database file will grow without bounds. The problem is that the
default locking mechanism uses an uncommitted <code>UPDATE</code> transaction, which keeps the transaction log
from shrinking (causes the database file to grow). Instead of using an <code>UPDATE</code> statement, the <code>TransactDatabaseLocker</code> uses
<code>SELECT ... FOR UPDATE</code> which is not problematic.
To use it, change the ApacheMQ configuration element <code>&lt;jdbcPersistenceAdapter&gt;</code> element, property
<code>databaseLocker="org.apache.activemq.store.jdbc.adapter.TransactDatabaseLocker"</code>.
However, using the MVCC mode will again result in the same problem. Therefore, please do not use the MVCC mode in this case.
Another (more dangerous) solution is to set <code>useDatabaseLock</code> to false.
</p>
<h2 id="web_applications">Using Databases in Web Applications</h2>
<p>
There are multiple ways to access a database from within web
......
......@@ -48,25 +48,39 @@ Please provide any additional information below.
-----------------
Hi,
This looks like a corrupt database. A workarounds is: use the tool org.h2.tools.Recover to create the SQL script file, and then re-create the database using this script. Does it work when you do this?
This looks like a corrupt database. To recover the data, use the tool org.h2.tools.Recover to create the SQL script file, and then re-create the database using this script. Does it work when you do this?
An important corruption problem was fixed in version 1.2.135 (see the change log). Known causes for corrupt databases are:
An important corruption problem was fixed in version 1.2.135 (see the change log). Known causes for corrupt databases are: if the database was created or used with a version older than 1.2.135, and the process was killed while the database was closing or writing a checkpoint. Using the transaction isolation level READ_UNCOMMITTED (LOCK_MODE 0) while at the same time using multiple connections. Disabling database file protection using (setting FILE_LOCK to NO in the database URL). Some other areas that are not fully tested are: Platforms other than Windows XP, Linux, Mac OS X, or JVMs other than Sun 1.5 or 1.6; the feature MULTI_THREADED; the features AUTO_SERVER and AUTO_RECONNECT; the file locking method 'Serialized'.
- If the database was created or used with a version older than 1.2.135, and the process was killed while the database was closing or writing a checkpoint.
I am very interested in analyzing and solving this problem. Corruption problems have top priority for me. I have a few questions:
- Using the transaction isolation level READ_UNCOMMITTED (LOCK_MODE 0) while at the same time using multiple connections.
- Disabling database file protection using (setting FILE_LOCK to NO in the database URL).
Some other areas that are not fully tested are:
- Platforms other than Windows XP, Linux, Mac OS X, or JVMs other than Sun 1.5 or 1.6
- The feature MULTI_THREADED
- The features AUTO_SERVER and AUTO_RECONNECT
- The file locking method 'Serialized'
- Could you send the full stack trace of the exception including message text?
- What is your database URL?
- How many connections does your application use concurrently?
- Do you use temporary tables?
- With which version of H2 was this database created?
You can find it out using:
select * from information_schema.settings where name='CREATE_BUILD'
or have a look in the SQL script created by the recover tool.
- Did the application run out of memory (once, or multiple times)?
- Do you use any settings or special features (for example cache settings,
two phase commit, linked tables)?
- Do you use any H2-specific system properties?
- Is the application multi-threaded?
- What operating system, file system, and virtual machine
(java -version) do you use?
- How did you start the Java process (java -Xmx... and so on)?
- Is it (or was it at some point) a networked file system?
- How big is the database (file sizes)?
- How much heap memory does the Java process have?
- Is the database usually closed normally, or is process terminated
forcefully or the computer switched off?
- Is it possible to reproduce this problem using a fresh database
(sometimes, or always)?
- Are there any other exceptions (maybe in the .trace.db file)?
Could you send them please?
- Do you still have any .trace.db files, and if yes could you send them?
- Could you send the .h2.db file where this exception occurs?
Regards,
Thomas
......
......@@ -647,4 +647,4 @@ recorder grajciar recording slovensky uninitialized arriving lubomir unchanged
erik dick calculations lutin cite bom evaluating telegard excel bbs deprecation
importing cumulative fired convenient sums judged anybody vacuum encountered
corresponds cnf informatique ilm boundaries shao crossed retroweaver usr pico
pengxiang china timestampadd picked histogram
pengxiang china timestampadd picked histogram transact locker activemq
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论