Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d059ca51
提交
d059ca51
authored
10月 10, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Documentation: improved website translation
上级
20294dfb
全部展开
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
1704 行增加
和
1691 行删除
+1704
-1691
advanced.html
h2/src/docsrc/html/advanced.html
+24
-24
build.html
h2/src/docsrc/html/build.html
+7
-7
faq.html
h2/src/docsrc/html/faq.html
+15
-16
features.html
h2/src/docsrc/html/features.html
+10
-10
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+551
-545
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+558
-552
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+538
-536
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+1
-1
没有找到文件。
h2/src/docsrc/html/advanced.html
浏览文件 @
d059ca51
...
...
@@ -102,9 +102,9 @@ when reading the data, the blocks are merged together.
If it is possible that the objects don't fit into memory, then the data type
CLOB (for textual data) or BLOB (for binary data) should be used.
For these data types, the objects are not fully read into memory, by using streams.
To store a BLOB, use
PreparedStatement.setBinaryStream
. To store a CLOB, use
PreparedStatement.setCharacterStream. To read a BLOB, use ResultSet.getBinaryStream
,
and to read a CLOB, use
ResultSet.getCharacterStream
.
To store a BLOB, use
<code>
PreparedStatement.setBinaryStream
</code>
. To store a CLOB, use
<code>
PreparedStatement.setCharacterStream
</code>
. To read a BLOB, use
<code>
ResultSet.getBinaryStream
</code>
,
and to read a CLOB, use
<code>
ResultSet.getCharacterStream
</code>
.
When using the client/server mode, large BLOB and CLOB data is stored in a temporary file
on the client side.
</p>
...
...
@@ -156,8 +156,8 @@ If multiple linked tables point to the same database (using the same database UR
is shared. To disable this, set the system property
<code>
h2.shareLinkedConnections=false
</code>
.
</p>
<p>
The
<code>
CREATE LINKED TABLE
</code>
statement supports an optional schema name parameter.
See the grammar for details
.
The
statement
<a
href=
"grammar.html#create_linked_table"
class=
"notranslate"
>
CREATE LINKED TABLE
</a>
supports an optional schema name parameter
.
</p>
<br
/>
...
...
@@ -165,7 +165,7 @@ See the grammar for details.
<p>
Transaction isolation is provided for all data manipulation language (DML) statements.
Most data definition language (DDL) statements commit the current transaction.
See the
<a
href=
"grammar.html"
>
g
rammar
</a>
for details.
See the
<a
href=
"grammar.html"
>
G
rammar
</a>
for details.
</p>
<p>
This database supports the following transaction isolation levels:
...
...
@@ -465,7 +465,7 @@ See also:
<h3>
ODBC Installation
</h3>
<p>
First, the ODBC driver must be installed.
Any recent PostgreSQL ODBC driver should work, however version 8.2 (
psqlodbc-08_02*
) or newer is recommended.
Any recent PostgreSQL ODBC driver should work, however version 8.2 (
<code>
psqlodbc-08_02*
</code>
) or newer is recommended.
The Windows version of the PostgreSQL ODBC driver is available at
<a
href=
"http://www.postgresql.org/ftp/odbc/versions/msi"
>
http://www.postgresql.org/ftp/odbc/versions/msi
</a>
.
</p>
...
...
@@ -480,7 +480,7 @@ java -cp h2*.jar org.h2.tools.Server
<p>
The PG Server (PG for PostgreSQL protocol) is started as well.
By default, databases are stored in the current working directory where the server is started.
Use
-baseDir
to save databases in another directory, for example the user home directory:
Use
<code>
-baseDir
</code>
to save databases in another directory, for example the user home directory:
</p>
<pre>
java -cp h2*.jar org.h2.tools.Server -baseDir ~
...
...
@@ -569,18 +569,18 @@ An implementation of the ADO.NET interface is available in the open source proje
<ul><li>
Install the .NET Framework from
<a
href=
"http://www.microsoft.com"
>
Microsoft
</a>
.
Mono has not yet been tested.
</li><li>
Install
<a
href=
"http://www.ikvm.net"
>
IKVM.NET
</a>
.
</li><li>
Copy the
h2*.jar file to ikvm/bin
</li><li>
Copy the
<code>
h2*.jar
</code>
file to
<code>
ikvm/bin
</code>
</li><li>
Run the H2 Console using:
<code>
ikvm -jar h2*.jar
</code>
</li><li>
Convert the H2 Console to an
.exe
file using:
</li><li>
Convert the H2 Console to an
<code>
.exe
</code>
file using:
<code>
ikvmc -target:winexe h2*.jar
</code>
.
You may ignore the warnings.
</li><li>
Create a
.dll
file using (change the version accordingly):
</li><li>
Create a
<code>
.dll
</code>
file using (change the version accordingly):
<code>
ikvmc.exe -target:library -version:1.0.69.0 h2*.jar
</code>
</li></ul>
<p>
If you want your C# application use H2, you need to add the
h2.dll
and the
IKVM.OpenJDK.ClassLibrary.dll
to your C# solution. Here some sample code:
If you want your C# application use H2, you need to add the
<code>
h2.dll
</code>
and the
<code>
IKVM.OpenJDK.ClassLibrary.dll
</code>
to your C# solution. Here some sample code:
</p>
<pre>
using System;
...
...
@@ -658,7 +658,7 @@ Making sure that committed transactions are not lost is more complicated than it
To guarantee complete durability, a database must ensure that the log record is on the hard drive
before the commit call returns. To do that, databases use different methods. One
is to use the 'synchronous write' file access mode. In Java,
<code>
RandomAccessFile
</code>
supports the modes
<code>
"rws"
</code>
and
<code>
"rwd"
</code>
:
supports the modes
<code>
rws
</code>
and
<code>
rwd
</code>
:
</p>
<ul>
<li><code>
rwd
</code>
: every update to the file's content is written synchronously to the underlying storage device.
...
...
@@ -675,25 +675,25 @@ then the disk would need to make at least 50 thousand revolutions per second, or
or about 120 revolutions per second. There is an overhead, so the maximum write rate must be lower than that.
</p>
<p>
Calling
fsync
flushes the buffers. There are two ways to do that in Java:
Calling
<code>
fsync
</code>
flushes the buffers. There are two ways to do that in Java:
</p>
<ul>
<li><code>
FileDescriptor.sync()
</code>
. The documentation says that this forces all system
buffers to synchronize with the underlying device.
Sync is supposed to return after all in-memory modified copies of buffers associated with this FileD
escriptor
This method is supposed to return after all in-memory modified copies of buffers associated with this file d
escriptor
have been written to the physical medium.
</li><li><code>
FileChannel.force()
</code>
(since JDK 1.4). This method is supposed
to force any updates to this channel's file to be written to the storage device that contains it.
</li></ul>
<p>
By default, MySQL calls
fsync
for each commit. When using one of those methods, only around 60 write operations
By default, MySQL calls
<code>
fsync
</code>
for each commit. When using one of those methods, only around 60 write operations
per second can be achieved, which is consistent with the RPM rate of the hard drive used.
Unfortunately, even when calling
<code>
FileDescriptor.sync()
</code>
or
<code>
FileChannel.force()
</code>
,
data is not always persisted to the hard drive, because most hard drives do not obey
fsync()
: see
<code>
fsync()
</code>
: see
<a
href=
"http://hardware.slashdot.org/article.pl?sid=05/05/13/0529252"
>
Your Hard Drive Lies to You
</a>
.
In Mac OS X,
fsync
does not flush hard drive buffers. See
In Mac OS X,
<code>
fsync
</code>
does not flush hard drive buffers. See
<a
href=
"http://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html"
>
Bad fsync?
</a>
.
So the situation is confusing, and tests prove there is a problem.
</p>
...
...
@@ -777,7 +777,7 @@ The default method for database file locking is the 'File Method'. The algorithm
<ul>
<li>
If the lock file does not exist, it is created (using the atomic operation
<code>
File.createNewFile
</code>
).
Then, the process waits a little bit (20ms) and checks the file again. If the file was changed
Then, the process waits a little bit (20
ms) and checks the file again. If the file was changed
during this time, the operation is aborted. This protects against a race condition
when one process deletes the lock file just after another one create it, and a third process creates
the file again. It does not occur if there are only two writers.
...
...
@@ -859,7 +859,7 @@ SELECT * FROM USERS WHERE PASSWORD='' OR ''='';
</pre>
<p>
Which is always true no matter what the password stored in the database is.
For more information about SQL Injection, see
Glossary and Links
.
For more information about SQL Injection, see
<a
href=
"#glossary_links"
>
Glossary and Links
</a>
.
</p>
<h3>
Disabling Literals
</h3>
...
...
@@ -951,7 +951,7 @@ CALL GET_PROPERTY('abc');
To restrict users (including admins) from loading classes and executing code,
the list of allowed classes can be set in the system property
<code>
h2.allowedClasses
</code>
in the form of a comma separated list of classes or patterns (items ending with
'*'
).
in the form of a comma separated list of classes or patterns (items ending with
<code>
*
</code>
).
By default all classes are allowed. Example:
</p>
<pre>
...
...
@@ -1011,8 +1011,8 @@ XTEA (using 32 rounds). The reasons for supporting XTEA is performance
(XTEA is about twice as fast as AES) and to have an alternative algorithm if
AES is suddenly broken.
</p><p>
When a user tries to connect to an encrypted database, the combination of
the word
'file', @,
and the file password is hashed using SHA-256. This hash value is
When a user tries to connect to an encrypted database, the combination of
<code>
file@
</code>
and the file password is hashed using SHA-256. This hash value is
transmitted to the server.
</p><p>
When a new database file is created, a new cryptographically secure
...
...
h2/src/docsrc/html/build.html
浏览文件 @
d059ca51
...
...
@@ -78,7 +78,7 @@ build -?
For Linux and OS X, use
<code>
./build.sh
</code>
instead of
<code>
build
</code>
.
</p>
<p>
You will get a list of targets. If you want to build the
jar
file, execute (Windows):
You will get a list of targets. If you want to build the
<code>
jar
</code>
file, execute (Windows):
</p>
<pre>
build jar
...
...
@@ -87,7 +87,7 @@ build jar
<h3>
Switching the Source Code
</h3>
<p>
By default the source code uses Java 1.5 features, however Java 1.6 is supported as well.
To switch the source code to the install version of Java, run:
To switch the source code to the install
ed
version of Java, run:
</p>
<pre>
build switchSource
...
...
@@ -131,13 +131,13 @@ Example:
</pre>
<p>
New versions of this database are first uploaded to http://hsql.sourceforge.net/m2-repo/ and then automatically
synchronized with the main
m
aven repository; however after a new release it may take a few hours before
synchronized with the main
M
aven repository; however after a new release it may take a few hours before
they are available there.
</p>
<h3>
Using Snapshot Version
</h3>
<p>
To build a
'snapshot' H2 jar
file and upload it the to the local Maven 2 repository, execute the following command:
To build a
<code>
h2-*-SNAPSHOT.jar
</code>
file and upload it the to the local Maven 2 repository, execute the following command:
</p>
<pre>
build mavenInstallLocal
...
...
@@ -177,7 +177,7 @@ using <code>build docs</code>.
<p>
If you like to provide patches, please consider the following guidelines to simplify merging them:
</p>
<ul><li>
Only use Java 1.5 features (do not use Java 1.6) (see
Environment
).
<ul><li>
Only use Java 1.5 features (do not use Java 1.6) (see
<a
href=
"#environment"
>
Environment
</a>
).
</li><li>
Follow the coding style used in the project, and use Checkstyle (see above) to verify.
For example, do not use tabs (use spaces instead).
The checkstyle configuration is in
<code>
src/installer/checkstyle.xml
</code>
.
...
...
@@ -191,11 +191,11 @@ If you like to provide patches, please consider the following guidelines to simp
</li><li>
Verify that you did not break other features: run the test cases by executing
<code>
build test
</code>
.
</li><li>
Provide end user documentation if required (
<code>
src/docsrc/html/*
</code>
).
</li><li>
Document grammar changes in
<code>
src/
main/org/h2/res
/help.csv
</code>
</li><li>
Document grammar changes in
<code>
src/
docsrc/help
/help.csv
</code>
</li><li>
Provide a change log entry (
<code>
src/docsrc/html/changelog.html
</code>
).
</li><li>
Verify the spelling using
<code>
build spellcheck
</code>
. If required
add the new words to
<code>
src/tools/org/h2/build/doc/dictionary.txt
</code>
.
</li><li>
Run
the
<code>
src/installer/buildRelease
</code>
to find and fix formatting errors.
</li><li>
Run
<code>
src/installer/buildRelease
</code>
to find and fix formatting errors.
</li><li>
Verify the formatting using
<code>
build docs
</code>
and
<code>
build javadoc
</code>
.
</li><li>
Submit patches as
<code>
.patch
</code>
files (compressed if big).
...
...
h2/src/docsrc/html/faq.html
浏览文件 @
d059ca51
...
...
@@ -50,9 +50,9 @@ Here is the list of known and confirmed issues:
unloading a web application. This can cause a
<code>
NullPointerException
</code>
in H2 versions
1.1.107 and older, and may still not work in newer versions. Please report it if you
run into this issue. In Tomcat >= 6.0 this behavior can be disabled by setting the
system property
<code>
org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES
</code>
to false,
however Tomcat may then run out of memory. A known workaround is to
put the
h2.jar
file in a shared
<code>
lib
</code>
directory
system property
<code>
org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES
=false
</code>
,
however Tomcat may then run out of memory. A known workaround is to
put the
<code>
h2*.jar
</code>
file in a shared
<code>
lib
</code>
directory
(
<code>
common/lib
</code>
).
</li><li>
Some problems have been found with right outer join. Internally, it is converted
to left outer join, which does not always produce the same results as other databases
...
...
@@ -110,11 +110,11 @@ Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
<p>
When using database URLs like
<code>
jdbc:h2:~/test
</code>
,
the database is stored in the user directory.
For Windows, this is usually
C:\Documents and Settings\
<
userName
>
.
For Windows, this is usually
<code>
C:\Documents and Settings\
<
userName
>
</code>
.
If the base directory is not set (as in
<code>
jdbc:h2:test
</code>
),
the database files are stored in the directory where the application is started
(the current working directory). When using the H2 Console application from the start menu,
this is
"
<
Installation Directory
>
/bin"
.
this is
<code>
<
Installation Directory
>
/bin
</code>
.
The base directory can be set in the database URL. A fixed or relative path can be used. When using the URL
<code>
jdbc:h2:file:data/sample
</code>
, the database is stored in the directory
<code>
data
</code>
(relative to the current working directory).
...
...
@@ -132,14 +132,6 @@ See <a href="advanced.html#limits_limitations">Limits and Limitations</a>.
<br
/>
<h3
id=
"reliable"
>
Is it Reliable?
</h3>
<p>
Some users have reported that after a power failure, the database can sometimes not be
opened because the index file is corrupt. In that case, the index file can be deleted
(it is automatically re-created). To avoid this, append
<code>
;LOG=2
</code>
to the database URL.
See also:
<a
href=
"grammar.html#set_log"
class=
"notranslate"
>
SET LOG
</a>
. This problem will be solved
using the new 'page store' mechanism (currently beta).
</p>
<p>
That is not easy to say. It is still a quite new product. A lot of tests have been written,
and the code coverage of these tests is very high. Randomized stress tests
are run regularly. But there are probably still
...
...
@@ -175,7 +167,6 @@ Areas that are not fully tested:
</li><li>
Fulltext search
</li><li>
Operations on LOBs over 2 GB
</li></ul>
<p>
Areas considered experimental are:
</p>
...
...
@@ -184,6 +175,14 @@ Areas considered experimental are:
</li><li>
Multi-threading within the engine using
<code>
SET MULTI_THREADED=1
</code>
</li><li>
Compatibility modes for other databases (only some features are implemented)
</li></ul>
<p>
Some users have reported that after a power failure, the database can sometimes not be
opened because the index file is corrupt. In that case, the index file can be deleted
(it is automatically re-created). To avoid this, append
<code>
;LOG=2
</code>
to the database URL.
See also:
<a
href=
"grammar.html#set_log"
class=
"notranslate"
>
SET LOG
</a>
. This problem will be solved
using the new 'page store' mechanism (currently beta).
</p>
<br
/>
<h3
id=
"slow_open"
>
Why is Opening my Database Slow?
</h3>
...
...
@@ -193,10 +192,10 @@ This is specially a problem for larger databases.
To close a database, close all connections to it before the application ends, or execute
the command
<code>
SHUTDOWN
</code>
.
The database is also closed when the virtual machine exits normally
by using a shutdown hook. However killing a Java process or calling
Runtime.halt
will prevent this.
by using a shutdown hook. However killing a Java process or calling
<code>
Runtime.halt
</code>
will prevent this.
The reason why opening is slow in this situations is that indexes are re-created.
If you can not guarantee the database is closed, consider using
<
code>
SET LOG 2
</code>
(see SQL Grammar)
.
<
a
href=
"grammar.html#set_log"
class=
"notranslate"
>
SET LOG 2
</a>
.
</p>
<p>
To find out what the problem is, open the database in embedded mode using the H2 Console.
...
...
h2/src/docsrc/html/features.html
浏览文件 @
d059ca51
...
...
@@ -118,7 +118,7 @@ Features
</li><li>
Many built-in functions, including XML and lossless data compression
</li><li>
Wide range of data types including large objects (BLOB/CLOB) and arrays
</li><li>
Sequence and autoincrement columns, computed columns (can be used for function based indexes)
</li><li>
ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP
</li><li>
<code>
ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP
</code>
</li><li>
Collation support, users, roles
</li><li>
Compatibility modes for IBM DB2, Apache Derby, HSQLDB,
MS SQL Server, MySQL, Oracle, and PostgreSQL.
...
...
@@ -145,7 +145,7 @@ encrypted using AES-256 and XTEA encryption algorithms
</li><li>
Support for multi-dimensional indexes
</li><li>
CSV (comma separated values) file support
</li><li>
Support for linked tables, and a built-in virtual 'range' table
</li><li>
EXPLAIN PLAN
support, sophisticated trace options
</li><li>
<code>
EXPLAIN PLAN
</code>
support, sophisticated trace options
</li><li>
Database closing can be delayed or disabled to improve the performance
</li><li>
Web-based Console application (translated to many languages) with autocomplete
</li><li>
The database can generate SQL script files
...
...
@@ -720,7 +720,7 @@ For more information about the algorithms, see
By default, when an application calls
<code>
DriverManager.getConnection(url, ...)
</code>
and the database specified in the URL does not yet exist, a new (empty) database is created.
In some situations, it is better to restrict creating new databases, and only allow to open
existing databases. To do this, add
<code>
;
ifexists=true
</code>
existing databases. To do this, add
<code>
;
IFEXISTS=TRUE
</code>
to the database URL. In this case, if the database does not already exist, an exception is thrown when
trying to connect. The connection only succeeds when the database already exists.
The complete URL may look like this:
...
...
@@ -779,7 +779,7 @@ In some situations, for example when using very large databases (over a few hund
re-creating the index file takes very long.
In these situations it may be better to log changes to the index file,
so that recovery from a corrupted index file is fast.
To enable log index changes, add
LOG=2
to the URL, as in
<code>
jdbc:h2:~/test;LOG=2
</code>
.
To enable log index changes, add
<code>
LOG=2
</code>
to the URL, as in
<code>
jdbc:h2:~/test;LOG=2
</code>
.
This setting should be specified when connecting.
The update performance of the database will be reduced when using this option.
</p>
...
...
@@ -1438,7 +1438,7 @@ data and number of dimensions, the improvement is usually higher than factor 5.
The tool generates a SQL query from a specified multi-dimensional range.
The method used is not database dependent, and the tool can easily be ported to other databases.
For an example how to use the tool, please have a look at the sample code provided
in
TestMultiDimension.java
.
in
<code>
TestMultiDimension.java
</code>
.
</p>
<br
/>
...
...
@@ -1452,24 +1452,24 @@ secure. A way to create good passwords that can be remembered is, take the first
letters of a sentence, use upper and lower case characters, and creatively include special characters.
Example:
</p><p>
i'sE2rtPiUKtT (it's easy to remember this password if you know the trick)
<code>
i'sE2rtPiUKtT
</code>
from the sentence
<code>
it's easy to remember this password if you know the trick
</code>
.
</p>
<h3>
Passwords: Using Char Arrays instead of Strings
</h3>
<p>
Java
S
trings are immutable objects and cannot be safely 'destroyed' by the application.
After creating a
S
tring, it will remain in the main memory of the computer at least
Java
s
trings are immutable objects and cannot be safely 'destroyed' by the application.
After creating a
s
tring, it will remain in the main memory of the computer at least
until it is garbage collected. The garbage collection cannot be controlled by the application,
and even if it is garbage collected the data may still remain in memory.
It might also be possible that the part of memory containing the password
is swapped to disk (because not enough main memory is available).
</p><p>
An attacker might have access to the swap file of the operating system.
It is therefore a good idea to use char arrays instead of
S
trings to store passwords.
It is therefore a good idea to use char arrays instead of
s
trings to store passwords.
Char arrays can be cleared (filled with zeros) after use, and therefore the
password will not be stored in the swap file.
</p><p>
This database supports using char arrays instead of
S
tring to pass user and file passwords.
This database supports using char arrays instead of
s
tring to pass user and file passwords.
The following code can be used to do that:
</p>
<pre>
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
d059ca51
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
d059ca51
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
d059ca51
This source diff could not be displayed because it is too large. You can
view the blob
instead.
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
d059ca51
...
...
@@ -297,7 +297,7 @@ java org.h2.test.TestAll timer
/*
documentation: rolling review at
advanced.html (alphabetically)
documentation: rolling review at
history.html
mvcc merge problem
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论