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

Improve documentation

上级 301ae834
......@@ -98,8 +98,8 @@ For these data types, the objects are not fully read into memory, by using strea
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.
If the client/server mode is used, the BLOB and CLOB data is fully read into memory when
accessed. In this case, the size of a BLOB or CLOB is limited by the memory.
When using the client/server mode, large BLOB and CLOB data is stored in a temporary file
on the client side.
</p>
<br /><a name="linked_tables"></a>
......@@ -123,9 +123,9 @@ target database, that means no joins. Prepared statements are used where possibl
To view the statements that are executed against the target table, set the trace level to 3.
</p>
<p>
There is a restriction when inserting data to this table: When inserting or updating rows into the table,
NULL and values that are not set in the insert statement are both inserted as NULL.
This may not have the desired effect if a default value in the target table is other than NULL.
There is a restriction: When inserting into a linked table, and when updating a linked table,
NULL and values that are not set are both inserted as NULL.
This may not have the desired effect if the default value for this column in the target table is not NULL.
</p>
<p>
If multiple linked tables point to the same database (using the same database URL), the connection
......@@ -460,7 +460,7 @@ server.stop();
</pre>
<p>
By default, only connections from localhost are allowed. To allow remote connections, use
<code>-pgAllowOthers true</code> when starting the server.
<code>-pgAllowOthers</code> when starting the server.
</p>
<h3>ODBC Configuration</h3>
......@@ -585,8 +585,9 @@ Transactions in this database are always atomic.
<h3>Consistency</h3>
<p>
This database is always in a consistent state.
Referential integrity rules are always enforced.
By default, this database is always in a consistent state.
Referential integrity rules are enforced except when
explicitly disabled.
</p>
<h3>Isolation</h3>
......@@ -628,7 +629,6 @@ supports the modes "rws" and "rwd":
</li><li>rws: In addition to rwd, every update to the metadata is written synchronously.</li>
</ul>
<p>
This feature is used by Derby.
A test (org.h2.test.poweroff.TestWrite) with one of those modes achieves around 50 thousand write operations per second.
Even when the operating system write buffer is disabled, the write rate is around 50 thousand operations per second.
This feature does not force changes to disk because it does not flush all buffers.
......@@ -659,7 +659,7 @@ In Mac OS X, fsync does not flush hard drive buffers. See
So the situation is confusing, and tests prove there is a problem.
</p>
<p>
Trying to flush hard drive buffers hard, and if you do the performance is very bad.
Trying to flush hard drive buffers is hard, and if you do the performance is very bad.
First you need to make sure that the hard drive actually flushes all buffers.
Tests show that this can not be done in a reliable way.
Then the maximum number of transactions is around 60 per second.
......@@ -695,13 +695,13 @@ It also extracts the content of the log file or large objects (CLOB or BLOB).
To run the tool, type on the command line:
</p>
<pre>
java org.h2.tools.Recover
java -cp h2*.jar org.h2.tools.Recover
</pre>
<p>
For each database in the current directory, a text file will be created.
This file contains raw insert statement (for the data) and data definition (DDL) statement to recreate
This file contains raw insert statements (for the data) and data definition (DDL) statements to recreate
the schema of the database. This file can be executed using the RunScript tool or a
<code>RUNSCRIPT FROM</code> SQL statement. The script include at least one
<code>RUNSCRIPT FROM</code> SQL statement. The script includes at least one
CREATE USER statement. If you run the script against a database that was created with the same
user, or if there are conflicting users, running the script will fail. Consider running the script
against a database that was created with a user name that is not in the script.
......@@ -711,7 +711,7 @@ against a database that was created with a user name that is not in the script.
<h2>File Locking Protocols</h2>
<p>
Whenever a database is opened, a lock file is created to signal other processes
that the database is in use. If database is closed, or if the process that opened
that the database is in use. If the database is closed, or if the process that opened
the database terminates, this lock file is deleted.
</p><p>
In special cases (if the process did not terminate normally, for example because
......@@ -909,9 +909,9 @@ the underlying security primitives.
<h3>User Password Encryption</h3>
<p>
When a user tries to connect to a database, the combination of
user name, @, and password hashed using SHA-256, and this hash value
user name, @, and password are hashed using SHA-256, and this hash value
is transmitted to the database.
This step does not try to an attacker from re-using the value if he is able to listen to the
This step does not protect against an attacker that re-uses the value if he is able to listen to the
(unencrypted) transmission between the client and the server.
But, the passwords are never transmitted as plain text,
even when using an unencrypted connection between client and server.
......@@ -921,21 +921,22 @@ this password is still protected up to some point. See also
for more information.
</p><p>
When a new database or user is created, a new cryptographically secure
random salt value is generated. The size of the salt is 64 bit.
random salt value is generated. The size of the salt is 64 bits.
Using the random salt reduces the risk of an attacker pre-calculating hash values
for many different (commonly used) passwords.
</p><p>
The combination of user-password hash value (see above) and salt is hashed
using SHA-256. The resulting value is stored in the database.
When a user tries to connect to the database, the database combines
user-password hash value with the stored salt value and calculated the
user-password hash value with the stored salt value and calculates the
hash value. Other products use multiple iterations (hash the hash value again and again),
but this is not done in this product to reduce the risk of denial of service attacks
(where the attacker tries to connect with bogus passwords, and the server
spends a lot of time calculating the hash value for each password).
The reasoning is: if the attacker has access to the hashed passwords, he also has
access to the data in plain text, and therefore does not need the password any more.
If the data is protected by storing it on another computer and only remotely, then the iteration count is not required at all.
If the data is protected by storing it on another computer and only accessible remotely,
then the iteration count is not required at all.
</p>
<h3>File Encryption</h3>
......@@ -950,7 +951,7 @@ When a user tries to connect to an encrypted database, the combination of the wo
transmitted to the server.
</p><p>
When a new database file is created, a new cryptographically secure
random salt value is generated. The size of the salt is 64 bit.
random salt value is generated. The size of the salt is 64 bits.
The combination of the file password hash and the salt value is hashed 1024 times
using SHA-256. The reason for the iteration is to make it harder for an attacker to
calculate hash values for common passwords.
......@@ -969,8 +970,8 @@ encrypted using the AES-128 or XTEA algorithm.
When decrypting, the operation is done in reverse. First, the block is decrypted using the key,
and then the IV is calculated combined with the decrypted text using XOR.
</p><p>
Therefore, the block cipher mode of operation is CBC (Cipher-block chaining), but each chain
is only one block long. The advantage over the ECB (Electronic codebook) mode is that patterns
Therefore, the block cipher mode of operation is CBC (cipher-block chaining), but each chain
is only one block long. The advantage over the ECB (electronic codebook) mode is that patterns
in the data are not revealed, and the advantage over multi block CBC is that flipped cipher text bits
are not propagated to flipped plaintext bits in the next block.
</p><p>
......@@ -983,18 +984,23 @@ File encryption slows down the performance of the database engine. Compared to u
database operations take about 2.2 times longer when using XTEA, and 2.5 times longer using AES (embedded mode).
</p>
<h3>Wrong Password Delay</h3>
<h3>Wrong Password / User Name Delay</h3>
<p>
To protect against remote brute force password attacks, the delay after each unsuccessful
login gets double as long. Use the system properties h2.delayWrongPasswordMin
and h2.delayWrongPasswordMax to change the minimum (the default is 250 milliseconds)
or maximum delay (the default is 4000 milliseconds, or 4 seconds). The delay only
applies for those using the wrong password. Normally there is no delay for a user that knows the correct
password, with one exception: after using the wrong password, there is a delay of up (randomly distributed)
password, with one exception: after using the wrong password, there is a delay of up to (randomly distributed)
the same delay as for a wrong password. This is to protect against parallel brute force attacks,
so that an attacker needs to wait for the whole delay. Delays are synchronized. This is also required
to protect against parallel attacks.
</p>
<p>
There is only one exception message for both wrong user and for wrong password,
to make it harder to get the list of user names. It is not possible from the stack trace to see
if the user name was wrong or the password.
</p>
<h3>HTTPS Connections</h3>
<p>
......@@ -1035,12 +1041,17 @@ Here is a small program to estimate the probability of having two identical UUID
after generating a number of values:
</p>
<pre>
double x = Math.pow(2, 122);
for(int i=35; i&lt;62; i++) {
double n = Math.pow(2, i);
double p = 1 - Math.exp(-(n*n)/(2*x));
String ps = String.valueOf(1+p).substring(1);
System.out.println("2^"+i+"="+(1L&lt;&lt;i)+" probability: 0"+ps);
public class Test {
public static void main(String[] args) throws Exception {
double x = Math.pow(2, 122);
for (int i = 35; i &lt; 62; i++) {
double n = Math.pow(2, i);
double p = 1 - Math.exp(-(n * n) / 2 / x);
System.out.println("2^" + i + "=" + (1L &lt;&lt; i) +
" probability: 0" +
String.valueOf(1 + p).substring(1));
}
}
}
</pre>
<p>
......@@ -1097,8 +1108,10 @@ This database has the following known limitations:
This number is excluding BLOB and CLOB data:
Every CLOB or BLOB can be up to 256 GB as well.
</li><li>The maximum file size for FAT or FAT32 file systems is 4 GB. That means when using FAT or FAT32,
the limit is 4 GB for the data. This is the limitation of the file system, and this database does not provide a
workaround for this problem. The suggested solution is to use another file system.
the limit is 4 GB for the data. This is the limitation of the file system. The database does provide a
workaround for this problem, it is to use the file name prefix 'split:'. In that case files are split into
files of 1 GB by default. An example database URL is:
<code>jdbc:h2:split:~/test</code>.
</li><li>There is a limit on the complexity of SQL statements.
Statements of the following form will result in a stack overflow exception:
<pre>
......@@ -1174,8 +1187,8 @@ OR X = 2 OR X = 2 OR X = 2 OR X = 2 OR X = 2
</tr>
<tr>
<td>SQL Injection</td>
<td>A security vulnerability where an application generates SQL
statements with embedded user input. See also: <a
<td>A security vulnerability where an application embeds SQL
statements or expressions in user input. See also: <a
href="http://en.wikipedia.org/wiki/SQL_injection">Wikipedia:
SQL Injection</a></td>
</tr>
......
......@@ -55,7 +55,6 @@ Newer version or compatible software works too.
</li><li>OpenOffice 3.0
</li><li>NSIS 2.38 (Nullsoft Scriptable Install System)
</li><li>Maven 2.0.9
</li><li>YourKit Java Profiler
</li></ul>
<br /><a name="building"></a>
......@@ -79,8 +78,8 @@ build jar
<h3>Switching the Source Code</h3>
<p>
By default the source code uses Java 1.6 features, however Java 1.4 and 1.5 are supported as well.
To disable Java 1.6 specific features, run:
By default the source code uses Java 1.5 features, however Java 1.4 and 1.5 are supported as well.
To switch the source code to the install version of Java, run:
</p>
<pre>
build switchSource
......@@ -91,7 +90,7 @@ build switchSource
<p>
The build system can generate smaller jar files as well. The following targets are currently supported:
</p>
<ul><li>jarClient: Create the h2client.jar. This only contains the remote JDBC implementation.
<ul><li>jarClient: Create the h2client.jar. This only contains the JDBC client.
</li><li>jarSmall: Create the file h2small.jar. This only contains the embedded database. Debug information is disabled.
</li><li>jarJaqu: Create the file h2jaqu.jar. This only contains the JaQu (Java Query) implementation. All other jar files do not include JaQu.
</li><li>javadocImpl: Create the Javadocs of the implementation.
......@@ -152,7 +151,7 @@ The translation of this software is split into the following parts:
</li><li>Web site: src/docsrc/text/_docs_*.utf8.txt
</li></ul>
<p>
To translate the H2 Console, start it and select Options / Translate.
To translate the H2 Console, start it and select Preferences / Translate.
The conversion between UTF-8 and Java encoding (using the \u syntax), as well as the HTML entities (&amp;#..;)
is automated by running the tool PropertiesToUTF8. The web site translation is automated as well,
using <code>build docs</code>.
......@@ -164,7 +163,8 @@ using <code>build docs</code>.
If you like to provide patches, please consider the following guidelines to simplify merging them:
</p>
<ul><li>Only use Java 1.4 features (do not use Java 1.5 or 1.6) (see Environment).
</li><li>Follow the coding style used in the project, use Checkstyle (see above) to check the coding style.
</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>.
</li><li>Please provide test cases and integrate them into the test suite.
For Java level tests, see <code>src/test/org/h2/test/TestAll.java</code>.
......@@ -177,7 +177,7 @@ If you like to provide patches, please consider the following guidelines to simp
</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>Verify the formatting using <code>build docs</code> and <code>build javadoc</code>.
</li><li>Submit patches as .patch files (compressed if big). To create a patch, use for example Eclipse Team/Create Patch.
</li><li>Submit patches as .patch files (compressed if big). To create a patch using Eclipse, use Team / Create Patch.
</li></ul>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
......
......@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Queries that are ordered by an indexed column returned no rows in certain cases
<ul><li>In-memory databases can now run inside the Google App Engine.
</li><li>Queries that are ordered by an indexed column returned no rows in certain cases
(if all rows were deleted from the table previously, and there is a low number of rows
in the table, and when not using other conditions, and when using the default b tree index).
</li><li>The wrong exception was thrown when using unquoted text for
......
......@@ -105,12 +105,12 @@ Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
<h3>Where are the Database Files Stored?</h3>
<p>
When using database URLs like jdbc:h2:~/test, the database is stored in the user directory.
For Windows, this is usually C:\Documents and Settings\&lt;userName&gt;.
For Windows, this is usually "C:\Documents and Settings\&lt;userName&gt;".
If the base directory is not set (as in jdbc:h2:test), 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.
(the current working directory). When using the H2 Console application from the start menu, this is "&lt;Installation Directory&gt;/bin".
The base directory can be set in the database URL. A fixed or relative path can be used. When using the URL
jdbc:h2:file:data/sample, the database is stored in the directory data (relative to the current working directory).
The directory is created automatically if it does not yet exist. It is also possible to use the fully qualified directory (and for Windows, drive) name.
jdbc:h2:file:data/sample, the database is stored in the directory "data" (relative to the current working directory).
The directory is created automatically if it does not yet exist. It is also possible to use the fully qualified directory name (and for Windows, drive name).
Example: jdbc:h2:file:C:/data/test
</p>
......@@ -118,14 +118,15 @@ Example: jdbc:h2:file:C:/data/test
<h3>What is the Size Limit (Maximum Size) of a Database?</h3>
<p>
The theoretical limit is currently 256 GB for the data. This number is excluding BLOB and CLOB data:
Every CLOB or BLOB can be up to 256 GB as well. The size limit of the index data is 256 GB as well.
every CLOB or BLOB can be up to 256 GB as well. The size limit of the index data is 256 GB as well.
</p>
<p>
The maximum number of rows per table is 2'147'483'648.
</p>
<p>
The maximum file size for FAT or FAT32 file systems is 4 GB. So if you use FAT or FAT32, the
limit is 4 GB for the data.
The maximum file size for FAT or FAT32 file systems is usually 4 GB.
The database does provide a workaround for this problem, it is to use the file
name prefix 'split:'. See also Advanced / Limitations.
</p>
<p>
The larger the database, the more main memory is required. Currently the minimum main memory required for a 12 GB database
......@@ -137,33 +138,32 @@ is around 240 MB.
<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 as this is a relatively new product, there are probably
some problems that have not yet been found (as with most software). Some features are known
to be dangerous by design, and some problems are hard to solve. Those are:
are run regularly. But there are probably still
bug that have not yet been found (as with most software). Some features are known
to be dangerous, they are only supported for situations where performance is more important
than reliability. Those dangerous features are:
</p>
<ul>
<li>Using SET LOG 0 to disable the transaction log file.
<li>Disabling the transaction log mechanism using SET LOG 0.
</li><li>Using the transaction isolation level READ_UNCOMMITTED (LOCK_MODE 0) while at the same time using multiple
connections may result in inconsistent transactions.
</li><li>Using FILE_LOCK=NO in the database URL.
connections.
</li><li>Disabling database file protection using FILE_LOCK=NO in the database URL.
</li><li>Disabling referential integrity using SET REFERENTIAL_INTEGRITY FALSE.
</li></ul>
<p>
In addition to that, running out of memory should be avoided.
In some versions, OutOfMemory errors while using the database could corrupt a databases.
Not all such problems may be fixed.
In older versions, OutOfMemory errors while using the database could corrupt a databases.
</p>
<p>
Areas that are not fully tested:
</p>
<ul>
<li>Platforms other than Windows XP or Linux, or JVMs other than Sun 1.4 - 1.6
<li>Platforms other than Windows XP, Linux, Mac OS X, or JVMs other than Sun 1.4 - 1.6
</li><li>The features AUTO_SERVER and AUTO_RECONNECT
</li><li>The MVCC (multi version concurrency) mode
</li><li>Cluster mode, 2-phase commit, savepoints
</li><li>24/7 operation
</li><li>Some operations on databases larger than 500 MB may be slower than expected
</li><li>Multi-threading and using multiple connections
</li><li>The optimizer may not always select the best plan
</li></ul>
......@@ -173,7 +173,6 @@ Areas considered Experimental:
<ul>
<li>The PostgreSQL server
</li><li>Compatibility modes for other databases (only some features are implemented)
</li><li>The ARRAY data type and related functionality
</li></ul>
<br /><a name="slow_open"></a>
......@@ -184,6 +183,8 @@ 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 SHUTDOWN. 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.
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 SET LOG 2 (see SQL Grammar).
</p>
<p>
To find out what the problem is, open the database in embedded mode using the H2 Console.
......
......@@ -91,7 +91,7 @@ Features
<h3>Main Features</h3>
<ul>
<li>Very fast database engine
</li><li>Free, with source code
</li><li>Open source
</li><li>Written in Java
</li><li>Supports standard SQL, JDBC API
</li><li>Embedded and Server mode, Clustering support
......@@ -144,9 +144,9 @@ Features
</li><li>Support for linked tables, and a built-in virtual 'range' table
</li><li>EXPLAIN PLAN support, sophisticated trace options
</li><li>Database closing can be delayed or disabled to improve the performance
</li><li>Web-based Console application (English, German, partially French and Spanish) with autocomplete
</li><li>Web-based Console application (translated to many languages) with autocomplete
</li><li>The database can generate SQL script files
</li><li>Contains a recovery tool that can dump the contents of the data file
</li><li>Contains a recovery tool that can dump the contents of the database
</li><li>Support for variables (for example to calculate running totals)
</li><li>Automatic re-compilation of prepared statements
</li><li>Uses a small number of database files
......@@ -372,7 +372,7 @@ http://www.h2database.com/html/roadmap.html
*5 The default H2 jar file contains debug information, jar files for other databases do not.<br />
*6 PostgreSQL supports functional indexes.<br />
*7 Derby only supports updatable result sets if the query is not sorted.<br />
*8 Derby and HSQLDB don't support standard compliant information schema tables.
*8 Derby and HSQLDB don't support standard compliant information schema tables.<br />
*9 H2 supports row level locks when using multi version concurrency.
</p>
......@@ -408,7 +408,7 @@ The following connection modes are supported:
</p>
<ul>
<li>Embedded mode (local connections using JDBC)
</li><li>Remote mode (remote connections using JDBC or ODBC over TCP/IP)
</li><li>Server mode (remote connections using JDBC or ODBC over TCP/IP)
</li><li>Mixed mode (local and remote connections at the same time)
</li></ul>
......@@ -424,13 +424,13 @@ or on the number of open connections.
<img src="images/connection-mode-embedded.png"
alt="The database is embedded in the application" />
<h3>Remote Mode</h3>
<h3>Server Mode</h3>
<p>
When using the remote mode (sometimes called server mode or client/server mode), an application opens a
When using the server mode (sometimes called remote mode or client/server mode), an application opens a
database remotely using the JDBC or ODBC API. A server needs to be started within the same
or another virtual machine (or on another computer).
or another virtual machine, or on another computer.
Many applications can connect to the same database at the same time.
The remote mode is slower than the embedded mode, because all data
The server mode is slower than the embedded mode, because all data
is transferred over TCP/IP.
As in all modes, both persistent and in-memory databases are supported.
There is no limit on the number of database open concurrently,
......@@ -441,13 +441,17 @@ or on the number of open connections.
<h3>Mixed Mode</h3>
<p>
The mixed mode is a combination of the embedded and the remote mode.
The mixed mode is a combination of the embedded and the server mode.
The first application that connects to a database does that in embedded mode, but also starts
a server so that other applications (running in different processes or virtual machines) can
concurrently access the same data. The embedded connections are as fast as if
concurrently access the same data. The local connections are as fast as if
the database is used in just the embedded mode, while the remote
connections are a bit slower. All clients that want to connect to the database (no matter if
it's an embedded or remote connection) can do so using the exact same database URL.
connections are a bit slower.
</p><p>
The server can be started and stopped from within the application (using the server API),
or automatically (automatic mixed mode). When using the <a href="#auto_mixed_mode">automatic mixed mode</a>,
all clients that want to connect to the database (no matter if
it's an local or remote connection) can do so using the exact same database URL.
</p>
<img src="images/connection-mode-mixed.png"
alt="The database and the server is running inside the application; another application connects remotely" />
......@@ -469,18 +473,18 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</td>
</tr>
<tr>
<td><a href="#memory_only_databases">In-Memory (private)</a></td>
<td><a href="#memory_only_databases">In-memory (private)</a></td>
<td>jdbc:h2:mem:</td>
</tr>
<tr>
<td><a href="#memory_only_databases">In-Memory (named)</a></td>
<td><a href="#memory_only_databases">In-memory (named)</a></td>
<td>
jdbc:h2:mem:&lt;databaseName&gt;<br />
jdbc:h2:mem:test_mem
</td>
</tr>
<tr>
<td><a href="tutorial.html#using_server">Remote using TCP/IP</a></td>
<td><a href="tutorial.html#using_server">Server mode (remote connections)<br /> using TCP/IP</a></td>
<td>
jdbc:h2:tcp://&lt;server&gt;[:&lt;port&gt;]/[&lt;path&gt;]&lt;databaseName&gt;<br />
jdbc:h2:tcp://localhost/~/test<br />
......@@ -488,14 +492,14 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</td>
</tr>
<tr>
<td><a href="advanced.html#ssl_tls_connections">Remote using SSL/TLS</a></td>
<td><a href="advanced.html#ssl_tls_connections">Server mode (remote connections)<br /> using SSL/TLS</a></td>
<td>
jdbc:h2:ssl://&lt;server&gt;[:&lt;port&gt;]/&lt;databaseName&gt;<br />
jdbc:h2:ssl://secureserv:8085/~/sample;
</td>
</tr>
<tr>
<td><a href="#file_encryption">Using Encrypted Files</a></td>
<td><a href="#file_encryption">Using encrypted files</a></td>
<td>
jdbc:h2:&lt;url&gt;;CIPHER=[AES|XTEA]<br />
jdbc:h2:ssl://secureserv/~/testdb;CIPHER=AES<br />
......@@ -503,7 +507,7 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</td>
</tr>
<tr>
<td><a href="#database_file_locking">File Locking Methods</a></td>
<td><a href="#database_file_locking">File locking methods</a></td>
<td>
jdbc:h2:&lt;url&gt;;FILE_LOCK={NO|FILE|SOCKET}<br />
jdbc:h2:file:~/quickAndDirty;FILE_LOCK=NO<br />
......@@ -511,81 +515,81 @@ This is achieved using different database URLs. Settings in the URLs are not cas
</td>
</tr>
<tr>
<td><a href="#database_only_if_exists">Only Open if it Already Exists</a></td>
<td><a href="#database_only_if_exists">Only open if it already exists</a></td>
<td>
jdbc:h2:&lt;url&gt;;IFEXISTS=TRUE<br />
jdbc:h2:file:~/sample;IFEXISTS=TRUE<br />
</td>
</tr>
<tr>
<td><a href="#do_not_close_on_exit">Don't Close the Database when the VM Exits</a></td>
<td><a href="#do_not_close_on_exit">Don't close the database when the VM exits</a></td>
<td>
jdbc:h2:&lt;url&gt;;DB_CLOSE_ON_EXIT=FALSE
</td>
</tr>
<tr>
<td><a href="#passwords">User Name and/or Password</a></td>
<td><a href="#passwords">User name and/or password</a></td>
<td>
jdbc:h2:&lt;url&gt;[;USER=&lt;username&gt;][;PASSWORD=&lt;value&gt;]<br />
jdbc:h2:file:~/sample;USER=sa;PASSWORD=123<br />
</td>
</tr>
<tr>
<td><a href="#log_index_changes">Log Index Changes</a></td>
<td><a href="#log_index_changes">Log index changes</a></td>
<td>
jdbc:h2:&lt;url&gt;;LOG=2<br />
jdbc:h2:file:~/sample;LOG=2<br />
</td>
</tr>
<tr>
<td><a href="#trace_options">Debug Trace Settings</a></td>
<td><a href="#trace_options">Debug trace settings</a></td>
<td>
jdbc:h2:&lt;url&gt;;TRACE_LEVEL_FILE=&lt;level 0..3&gt;<br />
jdbc:h2:file:~/sample;TRACE_LEVEL_FILE=3<br />
</td>
</tr>
<tr>
<td><a href="#ignore_unknown_settings">Ignore Unknown Settings</a></td>
<td><a href="#ignore_unknown_settings">Ignore unknown settings</a></td>
<td>
jdbc:h2:&lt;url&gt;;IGNORE_UNKNOWN_SETTINGS=TRUE<br />
</td>
</tr>
<tr>
<td><a href="#custom_access_mode">Custom File Access Mode</a></td>
<td><a href="#custom_access_mode">Custom file access mode</a></td>
<td>
jdbc:h2:&lt;url&gt;;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws<br />
</td>
</tr>
<tr>
<td><a href="#database_in_zip">Database in or Zip File</a></td>
<td><a href="#database_in_zip">Database in a zip file</a></td>
<td>
jdbc:h2:zip:&lt;zipFileName&gt;!/&lt;databaseName&gt;<br />
jdbc:h2:zip:~/db.zip!/test
</td>
</tr>
<tr>
<td><a href="#compatibility">Compatibility Mode</a></td>
<td><a href="#compatibility">Compatibility mode</a></td>
<td>
jdbc:h2:&lt;url&gt;;MODE=&lt;databaseType&gt;<br />
jdbc:h2:~/test;MODE=MYSQL
</td>
</tr>
<tr>
<td><a href="#auto_reconnect">Auto-Reconnect</a></td>
<td><a href="#auto_reconnect">Auto-reconnect</a></td>
<td>
jdbc:h2:&lt;url&gt;;AUTO_RECONNECT=TRUE<br />
jdbc:h2:tcp://localhost/~/test;AUTO_RECONNECT=TRUE
</td>
</tr>
<tr>
<td><a href="#auto_mixed_mode">Automatic Mixed Mode</a></td>
<td><a href="#auto_mixed_mode">Automatic mixed mode</a></td>
<td>
jdbc:h2:&lt;url&gt;;AUTO_SERVER=TRUE<br />
jdbc:h2:~/test;AUTO_SERVER=TRUE
</td>
</tr>
<tr>
<td><a href="#other_settings">Changing Other Settings</a></td>
<td><a href="#other_settings">Changing other settings</a></td>
<td>
jdbc:h2:&lt;url&gt;;&lt;setting&gt;=&lt;value&gt;[;&lt;setting&gt;=&lt;value&gt;...]<br />
jdbc:h2:file:~/sample;TRACE_LEVEL_SYSTEM_OUT=3<br />
......@@ -608,7 +612,7 @@ To point to the user home directory, use ~/, as in: jdbc:h2:~/test.
<h2>Memory-Only Databases</h2>
<p>
For certain use cases (for example: rapid prototyping, testing, high performance
operations, read-only databases), it may not be required to persist (changes to) the data at all.
operations, read-only databases), it may not be required to persist data, or persist changes to the data.
This database supports the memory-only mode, where the data is not persisted.
</p><p>
In some cases, only one connection to a memory-only database is required.
......
......@@ -9,9 +9,7 @@ Initial Developer: H2 Group
<title>Fragments</title>
<!-- [search] { -->
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="navigation.js"></script>
<script type="text/javascript" src="search.js"></script>
</head><body onload="highlight();">
<table class="nav" onmousemove="return mouseMove(event)"><tr class="nav"><td class="nav" valign="top">
......@@ -88,6 +86,8 @@ Initial Developer: H2 Group
<!-- [close] { -->
</div></td></tr></table>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="search.js"></script>
<!-- } -->
</body></html>
\ No newline at end of file
......@@ -719,8 +719,8 @@ For H2, opening a connection is fast if the database is already open.
Still, using a connection pool improves performance if you open and close connections a lot.
A simple connection pool is included in H2. It is based on the
<a href="http://www.source-code.biz/snippets/java/8.htm">Mini Connection Pool Manager</a>
from Christian d'Heureuse. There are other, more complex connection pools available, for example
<a href="http://jakarta.apache.org/commons/dbcp/">DBCP</a>.
from Christian d'Heureuse. There are other, more complex, open source connection pools available,
for example the <a href="http://jakarta.apache.org/commons/dbcp/">Apache Commons DBCP</a>.
For H2, it is about twice as faster to get a connection from the built-in connection pool than to get
one using DriverManager.getConnection(). The build-in connection pool is used as follows:
</p>
......@@ -744,10 +744,12 @@ public class Test {
<br /><a name="fulltext"></a>
<h2>Fulltext Search</h2>
<p>
H2 supports Lucene full text search and native full text search implementation.
H2 includes two fulltext search implementations. One is using Apache Lucene,
and the other (the native implementation) stores the index data in special
tables in the database.
</p>
<h3>Using the Native Full Text Search</h3>
<h3>Using the Native Fulltext Search</h3>
<p>
To initialize, call:
</p>
......@@ -757,7 +759,7 @@ CALL FT_INIT();
</pre>
<p>
You need to initialize it in each database where you want to use it.
Afterwards, you can create a full text index for a table using:
Afterwards, you can create a fulltext index for a table using:
</p>
<pre>
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
......@@ -766,7 +768,7 @@ CALL FT_CREATE_INDEX('PUBLIC', 'TEST', NULL);
</pre>
<p>
PUBLIC is the schema, TEST is the table name. The list of column names (column separated) is optional,
in this case all columns are indexed. The index is updated in read time.
in this case all columns are indexed. The index is updated in realtime.
To search the index, use the following query:
</p>
<pre>
......@@ -783,7 +785,7 @@ To get the raw data, use <code>FT_SEARCH_DATA('Hello', 0, 0);</code>.
The result contains the columns SCHEMA (the schema name),
TABLE (the table name), COLUMNS (an array of column names), and KEYS
(an array of objects). To join a table, use a join as in:
<code>SELECT T.*FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T
<code>SELECT T.* FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T
WHERE FT.TABLE='TEST' AND T.ID= FT.KEYS[0];</code>
</p>
<p>
......@@ -797,9 +799,9 @@ org.h2.fulltext.FullText.searchData(conn, text, limit, offset);
<h3>Using the Lucene Fulltext Search</h3>
<p>
To use the Lucene full text search, you need the Lucene library in the classpath.
How his is done depends on the application; if you use the H2 Console, you can add the Lucene
How to do that depends on the application; if you use the H2 Console, you can add the Lucene
jar file to the environment variables H2DRIVERS or CLASSPATH.
To initialize the Lucene full text search in a database, call:
To initialize the Lucene fulltext search in a database, call:
</p>
<pre>
CREATE ALIAS IF NOT EXISTS FTL_INIT FOR "org.h2.fulltext.FullTextLucene.init";
......@@ -816,7 +818,7 @@ CALL FTL_CREATE_INDEX('PUBLIC', 'TEST', NULL);
</pre>
<p>
PUBLIC is the schema, TEST is the table name. The list of column names (column separated) is optional,
in this case all columns are indexed. The index is updated in read time. To search the index,
in this case all columns are indexed. The index is updated in realtime. To search the index,
use the following query:
</p>
<pre>
......@@ -829,11 +831,11 @@ This will produce a result set that contains the query needed to retrieve the da
QUERY: "PUBLIC"."TEST" WHERE "ID"=1
</p>
<p>
To get the raw data, use <code>FT_SEARCH_DATA('Hello', 0, 0);</code>.
To get the raw data, use <code>FTL_SEARCH_DATA('Hello', 0, 0);</code>.
The result contains the columns SCHEMA (the schema name),
TABLE (the table name), COLUMNS (an array of column names), and KEYS
(an array of objects). To join a table, use a join as in:
<code>SELECT T.*FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T
<code>SELECT T.* FROM FTL_SEARCH_DATA('Hello', 0, 0) FT, TEST T
WHERE FT.TABLE='TEST' AND T.ID= FT.KEYS[0];</code>
</p>
<p>
......@@ -848,14 +850,14 @@ org.h2.fulltext.FullTextLucene.searchData(conn, text, limit, offset);
<h2>User-Defined Variables</h2>
<p>
This database supports user-defined variables. Variables start with @ and can be used wherever
expressions or parameters are used. Variables not persisted and session scoped, that means only visible for
the session where they are defined. A value is usually assigned using the SET command:
expressions or parameters are allowed. Variables are not persisted and session scoped, that means only visible
from within the session in which they are defined. A value is usually assigned using the SET command:
</p>
<pre>
SET @USER = 'Joe';
</pre>
<p>
It is also possible to change a value using the SET() method. This is useful in queries:
The value can also be changed using the SET() method. This is useful in queries:
</p>
<pre>
SET @TOTAL = NULL;
......@@ -887,7 +889,7 @@ the database using the RUNSCRIPT command or the RunScript tool in the new time z
<br /><a name="spring"></a>
<h2>Using Spring</h2>
<p>
Use the following configuration to start and stop the H2 TCP Server using the Spring Framework:
Use the following configuration to start and stop the H2 TCP server using the Spring Framework:
</p>
<pre>
&lt;bean id="org.h2.tools.Server"
......@@ -899,7 +901,7 @@ Use the following configuration to start and stop the H2 TCP Server using the Sp
&lt;/bean&gt;
</pre>
<p>
The "destroy-method" will help prevent exceptions on hot-redeployment or when restarting server.
The "destroy-method" will help prevent exceptions on hot-redeployment or when restarting the server.
</p>
<!-- [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.
......@@ -204,12 +204,13 @@ public class Engine {
* method waits some time (to make brute force / rainbow table attacks
* harder) and then throws a 'wrong user or password' exception. The delay
* is a bit randomized to protect against timing attacks. Also the delay
* doubles after each unsuccessful logins, to make brute force attacks harder.
* doubles after each unsuccessful logins, to make brute force attacks
* harder.
*
* There is only one exception both for wrong user and for wrong password,
* to make it harder to get the list of user names. This method must only be
* called from one place, so it is not possible from the stack trace to see
* if the user name was wrong or the password.
* There is only one exception message both for wrong user and for
* wrong password, to make it harder to get the list of user names. This
* method must only be called from one place, so it is not possible from the
* stack trace to see if the user name was wrong or the password.
*
* @param correct if the user name or the password was correct
* @throws SQLException the exception 'wrong user or password'
......
......@@ -282,11 +282,13 @@ java org.h2.test.TestAll timer
/*
automated tests (status on web site)
test web site with firefox 3, internet explorer, opera, safari, google chrome
test loading time of page
documentation: rolling review at tutorial.html:701
automated tests (status on web site)
EclEmma
test web site with firefox 3, internet explorer, opera, safari, google chrome
documentation: rolling review at features.html: 612
create a short 4 pages documentation
......
......@@ -585,4 +585,4 @@ versus extracts squirrel misdirected rle looking arc addressed european
soerensen favicon glass restarts flexive fish resulted vpda mvc kotek jan
consistently springfuse grep signatures wrote symbolic parents caches readers
animate scaladoc models disadvantages vladykin sergi trims requesting
handing bonita placed euros
\ No newline at end of file
handing bonita placed euros embeds reliability singular
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论