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

Documentation.

上级 000b9ab7
......@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>An ArrayIndexOutOfBoundsException was thrown when querying the table
<ul><li>Documentation for using H2 on Android devices has been added under Tutorial - Android.
</li><li>An ArrayIndexOutOfBoundsException was thrown when querying the table
information_schema.function_aliases while there are any user defined aggregate functions.
</li><li>The jar files are now about 50 KB smaller.
In the last few versions they contained superfluous classes.
......
......@@ -40,6 +40,8 @@ Tutorial
Using H2 within NetBeans</a><br />
<a href="#web_applications">
Using Databases in Web Applications</a><br />
<a href="#android">
Android</a><br />
<a href="#csv">
CSV (Comma Separated Values) Support</a><br />
<a href="#upgrade_backup_restore">
......@@ -721,6 +723,52 @@ To create a web application with just the H2 Console, run the following command:
build warConsole
</pre>
<h2 id="android">Android</h2>
<p>
You can use this database on an Android device (using the Dalvik VM) instead of or in addition to SQLite.
So far, only very few tests and benchmarks were run, but it seems that performance is very similar to SQLite,
except for opening and closing a database, which is not yet optimized in H2
(H2 takes about 0.2 seconds, and SQLite about 0.02 seconds).
So far, only very few tests have been run, and everything seems to work as expected.
Fulltext search was not yet tested, however the native fulltext search should work.
</p>
<p>
Reasons to use H2 instead of SQLite are:
</p>
<ul><li>Full Unicode support including UPPER() and LOWER() (unlike SQLite).
</li><li>Fulltext search.
</li><li>Multiple connections.
</li><li>User defined functions, triggers.
</li><li>Database file encryption.
</li><li>Reading and writing CSV files (this feature can be used out side the database as well).
</li><li>Referential integrity and check constraints.
</li><li>Better data type and SQL support.
</li><li>In-memory databases, read-only databases, linked tables.
</li><li>Better compatibility with other databases which simplifies porting applications.
</li><li>Possibly better performance.
</li></ul>
<p>
Currently only the JDBC API is supported (it is planned to support the Android database API in future releases).
Both the regular H2 jar file and the smaller <code>h2small-*.jar</code> can be used.
To create the smaller jar file, run the command <code>./build.sh jarSmall</code> (Linux / Mac OS)
or <code>build.bat jarSmall</code> (Windows).
</p>
<p>
The database files needs to be stored in a place that is accessible for the application.
Example:
</p>
<pre>
String url = "jdbc:h2:/data/data/" +
"com.example.hello" +
"/data/hello" +
";FILE_LOCK=FS" +
";PAGE_SIZE=1024" +
";CACHE_SIZE=8192";
Class.forName("org.h2.Driver");
conn = DriverManager.getConnection(url);
...
</pre>
<h2 id="csv">CSV (Comma Separated Values) Support</h2>
<p>
The CSV file support can be used inside the database using the functions
......
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.
......@@ -126,7 +126,6 @@ public class PageBtreeNode extends PageBtree {
}
int startData;
if (onlyPosition) {
// need to be pessimistic:
// if we only store the position, we may at most store as many
// entries as there is space for keys, because the current data area
// might get larger when _removing_ a child (if the new key needs
......
......@@ -17,7 +17,7 @@ Initial Developer: H2 Group
<frameset cols="200,*" rows="*" frameborder="1" framespacing="4" border="${frameset-border}" bordercolor="white">
<frame frameborder="0" marginheight="0" marginwidth="0" src="tables.do?jsessionid=${sessionId}" name="h2menu" />
<frameset rows="180,*" frameborder="1" framespacing="4" border="${frameset-border}" bordercolor="white">
<frame frameborder="0" marginheight="0" marginwidth="0" src="query.jsp?jsessionid=${sessionId}" name="h2query" scrolling="no" >
<frame frameborder="0" marginheight="0" marginwidth="0" src="query.jsp?jsessionid=${sessionId}" name="h2query" scrolling="no" />
<frame frameborder="${frame-border}" marginheight="0" marginwidth="0" src="help.jsp?jsessionid=${sessionId}" name="h2result" />
</frameset>
</frameset>
......
......@@ -1082,7 +1082,8 @@ public class PageStore implements CacheWriter {
}
/**
* Add a page to the free list. The page is not used, therefore doesn't need to be overwritten.
* Add a page to the free list. The page is not used, therefore doesn't need
* to be overwritten.
*
* @param pageId the page id
*/
......
......@@ -1106,7 +1106,7 @@ public class MetaTable extends Table {
replaceNullWithEmpty(agg.getComment()),
// ID
"" + agg.getId(),
// SOUCE
// SOURCE
""
// when adding more columns, see also below
);
......
......@@ -75,7 +75,8 @@ public class TestTools extends TestBase {
testRemove();
testConvertTraceFile();
testManagementDb();
testChangeFileEncryption();
testChangeFileEncryption(false);
testChangeFileEncryption(true);
testServer();
testScriptRunscript();
testBackupRestore();
......@@ -620,32 +621,32 @@ public class TestTools extends TestBase {
DeleteDbFiles.main("-dir", getBaseDir(), "-db", "utils", "-quiet");
}
private void testChangeFileEncryption() throws SQLException {
private void testChangeFileEncryption(boolean split) throws SQLException {
org.h2.Driver.load();
DeleteDbFiles.execute(getBaseDir(), "utils", true);
Connection conn = DriverManager.getConnection("jdbc:h2:" +
getBaseDir() + "/utils;CIPHER=XTEA", "sa", "abc 123");
String dir = (split ? "split:19:" : "") + getBaseDir();
String url = "jdbc:h2:" + dir;
DeleteDbFiles.execute(dir, "utils", true);
Connection conn = DriverManager.getConnection(url + "/utils;CIPHER=XTEA", "sa", "abc 123");
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, DATA CLOB) " +
"AS SELECT X, SPACE(3000) FROM SYSTEM_RANGE(1, 300)");
conn.close();
String[] args = { "-dir", getBaseDir(), "-db", "utils", "-cipher", "XTEA", "-decrypt", "abc", "-quiet" };
String[] args = { "-dir", dir, "-db", "utils", "-cipher", "XTEA", "-decrypt", "abc", "-quiet" };
ChangeFileEncryption.main(args);
args = new String[] { "-dir", getBaseDir(), "-db", "utils", "-cipher", "AES", "-encrypt", "def", "-quiet" };
args = new String[] { "-dir", dir, "-db", "utils", "-cipher", "AES", "-encrypt", "def", "-quiet" };
ChangeFileEncryption.main(args);
conn = DriverManager.getConnection("jdbc:h2:" +
getBaseDir() + "/utils;CIPHER=AES", "sa", "def 123");
conn = DriverManager.getConnection(url + "/utils;CIPHER=AES", "sa", "def 123");
stat = conn.createStatement();
stat.execute("SELECT * FROM TEST");
try {
args = new String[] { "-dir", getBaseDir(), "-db", "utils", "-cipher", "AES", "-decrypt", "def", "-quiet" };
args = new String[] { "-dir", dir, "-db", "utils", "-cipher", "AES", "-decrypt", "def", "-quiet" };
ChangeFileEncryption.main(args);
fail();
} catch (SQLException e) {
assertKnownException(e);
}
conn.close();
args = new String[] { "-dir", getBaseDir(), "-db", "utils", "-quiet" };
args = new String[] { "-dir", dir, "-db", "utils", "-quiet" };
DeleteDbFiles.main(args);
}
......
......@@ -32,6 +32,8 @@ public class DebugFileSystem extends FileSystem {
/**
* Register the file system.
*
* @return the instance
*/
public static DebugFileSystem register() {
FileSystem.register(INSTANCE);
......
......@@ -655,4 +655,5 @@ licensing appreciate textbook diligence undergraduate afaik mathematics chris
arrangements bugfix premain longs majority crashing behaving inst inventor
javaagent park accurately adopt consists night equally enhance enhanced
skiing honor marketing sleeping dlucene timezones shifted analyzed insists
train joining bilingual existed extremely fog
train joining bilingual existed extremely fog bordercolor overlapping
unlocking webkit dalvik
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论