提交 8ea55147 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 c5c20246
......@@ -858,6 +858,9 @@ need to wait.
<p>
The database uses table level locks to give each connection a consistent state of the data.
There are two kinds of locks: read locks (shared locks) and write locks (exclusive locks).
All locks are released when the transaction commits or rolls back.
When using the default transaction isolation level 'read committed', read locks are already released after each statement.
</p><p>
If a connection wants to reads from a table, and there is no write lock on the table,
then a read lock is added to the table. If there is a write lock, then this connection waits
for the other connection to release the lock. If a connection cannot get a lock for a specified time,
......
......@@ -197,6 +197,8 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Feature matrix like in <a href="http://www.inetsoftware.de/products/jdbc/mssql/features/default.asp">i-net software</a>.
</li><li>Updatable result set on table without primary key or unique index
</li><li>Use LinkedList instead of ArrayList where applicable
</li><li>Optimizer: use an index for IS NULL and IS NOT NULL (including linked tables).
ID IS NOT NULL could be converted to ID >= Integer.MIN_VALUE.
</li><li>Support % operator (modulo)
</li><li>Support 1+'2'=3, '1'+'2'='12' (MS SQL Server compatibility)
</li><li>Support nested transactions
......@@ -212,7 +214,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Support parameterized views (similar to CSVREAD, but using just SQL for the definition)
</li><li>A way (JDBC driver) to map an URL (jdbc:h2map:c1) to a connection object
</li><li>Option for SCRIPT to only process one or a set of tables, and append to a file
</li><li>Support using a unique index for IS NULL (including linked tables)
</li><li>Support linked tables to the current database
</li><li>Support dynamic linked schema (automatically adding/updating/removing tables)
</li><li>Compatibility with Derby: VALUES(1), (2); SELECT * FROM (VALUES (1), (2)) AS myTable(c1)
......@@ -415,6 +416,8 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Connection pool: 'reset session' command (delete temp tables, rollback, autocommit true).
</li><li>Improve SQL documentation, see http://www.w3schools.com/sql/
</li><li>MySQL compatibility: DatabaseMetaData.stores*() methods should return the same values. Test with SquirrelSQL.
</li><li>Support table partitioning.
</li><li>MS SQL Server compatibility: support DATEPART syntax.
</li></ul>
<h2>Not Planned</h2>
......
......@@ -10,7 +10,7 @@ Initial Developer: H2 Group
H2 Database Engine
</title>
<style type="text/css">
td, input, select, textarea, body, code, pre, td, th {
td, input, select, textarea, body, td, th {
font: 9pt/130% Tahoma, Arial, Helvetica, sans-serif;
font-weight: normal;
}
......@@ -20,21 +20,6 @@ h1, h2, h3, h4, h5 {
font-weight: bold;
}
td, input, select, textarea, body, code, pre {
font-size: 9pt;
}
pre {
background-color: #ece9d8;
border: 1px solid rgb(172, 168, 153);
padding: 4px;
}
code {
background-color: #ece9d8;
padding: 0px 2px;
}
h1 {
background-color: #0000bb;
padding: 2px 4px 2px 4px;
......@@ -44,21 +29,28 @@ h1 {
}
h2 {
font-size: 13pt;
}
h3 {
font-size: 10pt;
}
h4 {
td, input, select, textarea, body, code, pre {
font-size: 9pt;
}
pre {
background-color: #ece9d8;
border: 1px solid rgb(172, 168, 153);
padding: 4px;
}
code {
background-color: #ece9d8;
padding: 0px 2px;
}
table {
background-color: #ffffff;
border-collapse: collapse;
border: 1px solid #aca899;
border: 0px solid #aca899;
}
th {
......@@ -72,104 +64,123 @@ td {
background-color: #ffffff;
text-align: left;
vertical-align: top;
border: 1px solid #aca899;
border: 0px solid #aca899;
padding: 2px;
}
</style>
</head><body>
<h1>H2 Database Engine Cheat Sheet</h1>
<h2>Downloads</h2>
<a href="http://www.h2database.com/h2-setup-2009-04-10.exe">Windows Installer</a> -
<a href="http://www.h2database.com/h2-2009-04-10.zip">Zip</a> -
<a href="http://repo1.maven.org/maven2/com/h2database/h2/1.1.111/h2-1.1.111.jar">Jar</a>
<h2>Using H2</h2>
<ul><li>Add h2*.jar to the classpath (the only dependency is Java 1.4 or newer)
</li><li>JDBC driver class: <code>org.h2.Driver</code>
</li><li>Database URL: <code>jdbc:h2:~/test</code>
</li><li>A new database is automatically created if it does not exist
</li><li>Closing the last connection closes a database
</li><li>H2 is open source, free to use and distribute. See also license.
</li></ul>
<h2>Database URL Shortlist</h2>
<table>
<tr><td rowspan="3">Embedded</td>
<td>jdbc:h2:~/test</td><td>'test' in the current user home directory</td></tr>
<tr><td>jdbc:h2:/data/test</td><td>'test' in the directory /data/</td></tr>
<tr><td>jdbc:h2:test</td><td>'test' in the current working directory</td></tr>
<tr><td rowspan="2">In-Memory</td>
<td>jdbc:h2:mem:test</td><td>named; multiple connections within the same process</td></tr>
<tr><td>jdbc:h2:mem:</td><td>unnamed private database; only one connections</td></tr>
<tr><td rowspan="2">Server Mode</td>
<td>jdbc:h2:tcp://localhost/~/test</td><td>'test' in the current user home directory</td></tr>
<tr><td>jdbc:h2:tcp://localhost//data/test</td><td>'test' in the directory /data/</td></tr>
ul, ol {
list-style-position: outside;
padding-left: 20px;
}
<tr><td>Compatibility</td>
<td>jdbc:h2:...;MODE=MySQL</td><td>or DB2, Derby, HSQLDB, MSSQLServer, Oracle, PostgreSQL</td></tr>
li {
margin-top: 2px;
}
<tr><td>Debug</td>
<td>jdbc:...;TRACE_LEVEL_FILE=3</td><td>logs JDBC calls to test.trace.db</td></tr>
</table>
</style>
</head><body>
<h2>H2 Console Tool</h2>
Start: double click the h2*.jar file, or run <code>java -jar h2*.jar</code>, <code>h2.bat</code> or <code>h2.sh</code>.
<div style="width:660px; margin:0 auto;">
<h2>Maven</h2>
<pre>
&lt;dependency&gt;
&lt;groupId&gt;com.h2database&lt;/groupId&gt;
&lt;artifactId&gt;h2&lt;/artifactId&gt;
&lt;version&gt;${version}&lt;/version&gt;
&lt;/dependency&gt;
</pre>
<h2>Hibernate</h2>
Use the H2 or the HSQLDB dialect.
<h1>H2 Database Engine Cheat Sheet</h1>
<div style="float:left; margin:5px; width:320px;">
<h2>TopLink and Glassfish</h2>
Datasource Classname: org.h2.jdbcx.JdbcDataSource<br />
toplink.target-database: oracle.toplink.essentials.platform.database.H2Platform
<h2>Using H2</h2>
<ul><li>Download the
<a href="http://repo1.maven.org/maven2/com/h2database/h2/1.1.111/h2-1.1.111.jar">jar file</a>,
<a href="http://www.h2database.com/h2-setup-2009-04-10.exe">Windows installer</a>, or
<a href="http://www.h2database.com/h2-2009-04-10.zip">zip file</a>.
</li><li>To start the H2 Console tool, double click the jar file, or run <code>java -jar h2*.jar</code>, <code>h2.bat</code> or <code>h2.sh</code>.
</li><li>A new database is automatically created if it does not yet exist.
</li><li>Closing the last connection closes a database.
</li><li>H2 is open source, free to use and distribute.
</li></ul>
<h2>Connect using JDBC</h2>
<h2>Database URLs</h2>
<p>
<b>Embedded</b><br />
<code>jdbc:h2:~/test</code> 'test' in the user home directory<br />
<code>jdbc:h2:/data/test</code> 'test' in the directory /data/<br />
<code>jdbc:h2:test</code> in the current(!) working dir<br />
</p><p>
<b>In-Memory</b><br />
<code>jdbc:h2:mem:test</code> multiple connections in one process<br />
<code>jdbc:h2:mem:</code> unnamed private database; one connection<br />
</p><p>
<b>Server Mode</b><br />
<code>jdbc:h2:tcp://localhost/~/test</code> user home dir<br />
<code>jdbc:h2:tcp://localhost//data/test</code> absolute dir<br />
</p><p>
<b>Settings</b><br />
<code>jdbc:h2:..;MODE=MySQL</code> compatibility (or HSQLDB,...)<br />
<code>jdbc:h2:..;TRACE_LEVEL_FILE=3</code> log to .trace.db<br />
<p>
<h2>Documentation</h2>
Reference:
<a href="http://www.h2database.com/html/grammar.html">SQL grammar</a>,
<a href="http://www.h2database.com/html/functions.html">functions</a>,
<a href="http://www.h2database.com/html/datatypes.html">data types</a>,
<a href="http://www.h2database.com/html/datatypes.html">tools</a>.
<br />
Features:
<a href="http://www.h2database.com/html/grammar.html">fulltext search</a>,
<a href="http://www.h2database.com/html/functions.html">database encryption</a>,
<a href="http://www.h2database.com/html/datatypes.html">read-only databases</a>
<a href="http://www.h2database.com/html/datatypes.html">(in a zip or jar file)</a>,
<a href="http://www.h2database.com/html/datatypes.html">CSV files</a>,
<br />
</div>
<div style="float:right; padding:5px; width:320px;">
<h2>Using the JDBC API</h2>
<pre>
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
Connection conn = DriverManager.
getConnection("jdbc:h2:~/test");
conn.close();
</pre>
<h2>Connection Pool</h2>
<pre>
JdbcConnectionPool cp = JdbcConnectionPool.create("jdbc:h2:~/test", "sa", "");
Connection conn = cp.getConnection(); ... conn.close();
cp.dispose();
import org.h2.jdbcx.JdbcConnectionPool;
DataSource cp = JdbcConnectionPool.
create("jdbc:h2:~/test");
Connection conn = cp.getConnection();
conn.close(); cp.dispose();
</pre>
<h2>Start a Server</h2>
<pre>
java -cp h2*.jar org.h2.tools.Server
</pre>
<h2>Reference</h2>
<a href="http://www.h2database.com/html/grammar.html">SQL Grammar</a>
(or run 'HELP &lt;command&gt;' in the H2 Console) -
<a href="http://www.h2database.com/html/functions.html">Functions</a> -
<a href="http://www.h2database.com/html/datatypes.html">Data Types</a>
<h2>Hibernate</h2>
In the file hibernate.cfg.xml, set:
<pre>
&lt;property name="dialect"&gt;
org.hibernate.dialect.H2Dialect
&lt;/property&gt;
</pre>
As an alternative, use the HSQLDialect.
<h2>Maven</h2>
<pre>
&lt;dependency&gt;
&lt;groupId&gt;com.h2database&lt;/groupId&gt;
&lt;artifactId&gt;h2&lt;/artifactId&gt;
&lt;version&gt;${version}&lt;/version&gt;
&lt;/dependency&gt;
</pre>
<h2>Other Features</h2>
Fulltext search -
Database Files Encryption -
Read Only Databases -
Read Only Databases in Zip or Jar File
<h2>TopLink and Glassfish</h2>
Datasource Classname: org.h2.jdbcx.JdbcDataSource
toplink.target-database: oracle.toplink.essentials.platform.database.H2Platform
<h2>Command Line Tools</h2>
Backup - ChangeFileEncryption - Console - ConvertTraceFile - CreateCluster -
DeleteDbFiles - Recover - Restore - RunScript - Script - Server - Shell
</div>
<h2>Reading CSV files</h2>
SELECT * FROM CSVREAD('test.csv');
</div>
</body></html>
\ No newline at end of file
......@@ -26,7 +26,6 @@ function set(s) {
<h3>${text.helpImportantCommands}</h3>
<table>
<tr><th>${text.helpIcon}</th><th>${text.helpAction}</th></tr>
<tr>
<td style="padding:0px"><img src="icon_help.gif" alt="${text.a.help}"/></td>
<td style="vertical-align: middle;">
......@@ -52,8 +51,9 @@ function set(s) {
</td>
</tr>
</table>
<h3>${text.helpSampleSQL}</h3>
<table><tr><th>${text.helpOperations}</th><th>${text.helpStatements}</th></tr>
<table>
<tr><td><a href="javascript:set('DROP TABLE IF EXISTS TEST;\rCREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));\rINSERT INTO TEST VALUES(1, \'Hello\');\rINSERT INTO TEST VALUES(2, \'World\');\rSELECT * FROM TEST ORDER BY ID;\rUPDATE TEST SET NAME=\'Hi\' WHERE ID=1;\rDELETE FROM TEST WHERE ID=2;');">
${text.helpDropTable}<br />
${text.helpCreateTable}<br />
......@@ -73,7 +73,13 @@ function set(s) {
UPDATE TEST SET NAME='Hi' WHERE ID=1;<br />
DELETE FROM TEST WHERE ID=2;
</td></tr>
<tr><td><a href="javascript:set('HELP ');">
${text.a.help}
</a></td><td>
HELP ...
</td></tr>
</table>
<h3>${text.helpAddDrivers}</h3>
<p>
${text.helpAddDriversText}
......
......@@ -290,12 +290,12 @@ java org.h2.test.TestAll timer
/*
disable page store files, move multi dimension tool
integrate grammar help or move to docs (except syntax)
what do other databases do when calling prepareStatement(null)
and execute(null)?
test case for running out of disk space (using a special file system)
test shell tool on windows with special characters, try with
shell tool: document encoding problem. mac: use
java -Dfile.encoding=UTF-8
auto-build: prepare release
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论