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

Hide the feature FILE_LOCK=NO a bit, so that hopefully less people will use it.

上级 8414de9c
...@@ -151,8 +151,8 @@ than reliability. Those dangerous features are: ...@@ -151,8 +151,8 @@ than reliability. Those dangerous features are:
<ul><li>Using the transaction isolation level <code>READ_UNCOMMITTED</code> <ul><li>Using the transaction isolation level <code>READ_UNCOMMITTED</code>
(<code>LOCK_MODE 0</code>) while at the same time using multiple (<code>LOCK_MODE 0</code>) while at the same time using multiple
connections. connections.
</li><li>Disabling database file protection using <code>FILE_LOCK=NO</code> </li><li>Disabling database file protection using (setting <code>FILE_LOCK</code> to
in the database URL. <code>NO</code> in the database URL).
</li><li>Disabling referential integrity using <code>SET REFERENTIAL_INTEGRITY FALSE</code>. </li><li>Disabling referential integrity using <code>SET REFERENTIAL_INTEGRITY FALSE</code>.
</li></ul> </li></ul>
<p> <p>
......
...@@ -500,8 +500,7 @@ This is achieved using different database URLs. Settings in the URLs are not cas ...@@ -500,8 +500,7 @@ This is achieved using different database URLs. Settings in the URLs are not cas
<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 class="notranslate"> <td class="notranslate">
jdbc:h2:&lt;url&gt;;FILE_LOCK={NO|FILE|SOCKET}<br /> jdbc:h2:&lt;url&gt;;FILE_LOCK={FILE|SOCKET|NO}<br />
jdbc:h2:file:~/quickAndDirty;FILE_LOCK=NO<br />
jdbc:h2:file:~/private;CIPHER=XTEA;FILE_LOCK=SOCKET<br /> jdbc:h2:file:~/private;CIPHER=XTEA;FILE_LOCK=SOCKET<br />
</td> </td>
</tr> </tr>
...@@ -684,14 +683,18 @@ the database terminates, this lock file is deleted. ...@@ -684,14 +683,18 @@ the database terminates, this lock file is deleted.
The following file locking methods are implemented: The following file locking methods are implemented:
</p> </p>
<ul> <ul>
<li>The default method is 'file' and uses a watchdog thread to <li>The default method is <code>FILE</code> and uses a watchdog thread to
protect the database file. The watchdog reads the lock file each second. protect the database file. The watchdog reads the lock file each second.
</li><li>The second method is 'socket' and opens a server socket. The socket method does </li><li>The second method is <code>SOCKET</code> and opens a server socket.
not require reading the lock file every second. The socket method should only be used The socket method does not require reading the lock file every second.
if the database files are only accessed by one (and always the same) computer. The socket method should only be used if the database files
are only accessed by one (and always the same) computer.
</li><li>It is also possible to open the database without file locking; </li><li>It is also possible to open the database without file locking;
in this case it is up to the application to protect the database files. in this case it is up to the application to protect the database files.
</li></ul> Failing to do so will result in a corrupted database.
Using the method <code>NO</code> forces the database to not create a lock file at all.
Please note that this is unsafe as another process is able to open the same database,
possibly leading to data corruption.</li></ul>
<p> <p>
To open the database with a different file locking method, use the parameter To open the database with a different file locking method, use the parameter
<code>FILE_LOCK</code>. <code>FILE_LOCK</code>.
...@@ -701,14 +704,6 @@ The following code opens the database with the 'socket' locking method: ...@@ -701,14 +704,6 @@ The following code opens the database with the 'socket' locking method:
String url = "jdbc:h2:~/test;FILE_LOCK=SOCKET"; String url = "jdbc:h2:~/test;FILE_LOCK=SOCKET";
</pre> </pre>
<p> <p>
The following code forces the database to not create a lock file at all. Please note that
this is unsafe as another process is able to open the same database, possibly leading to
data corruption:
</p>
<pre>
String url = "jdbc:h2:~/test;FILE_LOCK=NO";
</pre>
<p>
For more information about the algorithms, see For more information about the algorithms, see
<a href="advanced.html#file_locking_protocols">Advanced / File Locking Protocols</a>. <a href="advanced.html#file_locking_protocols">Advanced / File Locking Protocols</a>.
</p> </p>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论