faq.html 8.3 KB
Newer Older
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
<!--
3 4 5
Copyright 2004-2008 H2 Group. Multiple-Licensed under the H2 License, Version 1.0,,
and under the Eclipse Public License, Version 1.0
(http://h2database.com/html/license.html).
6 7
Initial Developer: H2 Group
-->
8 9
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
10
Frequently Asked Questions
11
</title><link rel="stylesheet" type="text/css" href="stylesheet.css" />
12 13 14 15 16 17
<script type="text/javascript" src="navigation.js"></script>
</head><body onload="frameMe();">
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">

<h1>Frequently Asked Questions</h1>

18
<a href="#known_bugs">
19
    Are there Known Bugs? When is the Next Release?</a><br />
20 21 22
<a href="#open_source">
    Is this Database Engine Open Source?</a><br />
<a href="#query_slow">
23
    My Query is Slow</a><br />
24 25 26 27 28 29 30
<a href="#create_database">
    How to Create a New Database?</a><br />
<a href="#connect">
    How to Connect to a Database?</a><br />
<a href="#database_files">
    Where are the Database Files Stored?</a><br />
<a href="#size_limit">
31
    What is the Size Limit (Maximum Size) of a Database?</a><br />
32 33
<a href="#reliable">
    Is it Reliable?</a><br />
34 35
<a href="#slow_open">
    Why is Opening my Database Slow?</a><br />
36
<a href="#gcj">
37
    Is the GCJ Version Stable? Faster?</a><br />
38 39
<a href="#translate">
    How to Translate this Project?</a><br />
40 41

<br /><a name="known_bugs"></a>
42
<h3>Are there Known Bugs? When is the Next Release?</h3>
43
<p>
44
Usually, bugs get fixes as they are found. There is a release every few weeks.
45
Here is the list of known and confirmed issues:
46
</p>
47
<ul>
48 49
<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 when used in combination with other joins.
50
</li></ul>
51

52
<br /><a name="open_source"></a>
53
<h3>Is this Database Engine Open Source?</h3>
54
<p>
55 56
Yes. It is free to use and distribute, and the source code is included.
See also under license.
57
</p>
58

59
<br /><a name="query_slow"></a>
60
<h3>My Query is Slow</h3>
61 62 63 64 65 66 67
<p>
Slow SELECT (or DELETE, UPDATE, MERGE) statement can have multiple reasons.
Follow this checklist:
</p>
<ul>
<li>Run ANALYSE (see documentation for details).
</li><li>Run the query with EXPLAIN and check if indexes are used (see documentation for details).
68
</li><li>If required, create additional indexes and try again using ANALYZE and EXPLAIN.
69
</li><li>If it doesn't help please report the problem.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
</li>
</ul>

<br /><a name="create_database"></a>
<h3>How to Create a New Database?</h3>
<p>
By default, a new database is automatically created if it does not yet exist.
</p>

<br /><a name="connect"></a>
<h3>How to Connect to a Database?</h3>
<p>
The database driver is <code>org.h2.Driver</code>,
and the database URL starts with <code>jdbc:h2:</code>.
To connect to a database using JDBC, use the following code:
</p>
<pre>
Class.forName("org.h2.Driver");
88
Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
89
</pre>
90

91 92 93
<br /><a name="database_files"></a>
<h3>Where are the Database Files Stored?</h3>
<p>
94 95 96
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;.
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
97 98 99
(the current working directory). When using the H2 Console application from the start menu, this is [Installation Directory]/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).
100
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.
101 102 103 104
Example: jdbc:h2:file:C:/data/test
</p>

<br /><a name="size_limit"></a>
105
<h3>What is the Size Limit (Maximum Size) of a Database?</h3>
106 107 108 109
<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.
</p>
110
<p>
111 112
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.
113
</p>
114 115 116 117
<p>
The larger the database, the more main memory is required. Currently the mininum main memory required for a 12 GB database
is around 240 MB.
</p>
118 119

<br /><a name="reliable"></a>
120
<h3>Is it Reliable?</h3>
121
<p>
122 123 124
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
125 126 127 128 129 130 131
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:
</p>
<ul>
<li>Using SET LOG 0 to disable the transaction log file.
</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.
132
</li><li>Using FILE_LOCK=NO in the database URL.
133 134 135 136 137 138 139 140
</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.
</p>

<p>
141
Areas that are not fully tested:
142
</p>
143
<ul>
144
<li>Platforms other than Windows XP and the Sun JVM 1.4 and 1.5
145
</li><li>The MVCC (multi version concurrency) mode
146 147 148
</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
149
</li><li>Updatable result sets
150 151
</li><li>Referential integrity and check constraints, triggers
</li><li>ALTER TABLE statements, views, linked tables, schema, UNION
152
</li><li>Not all built-in functions are completely tested
153
</li><li>The optimizer may not always select the best plan
154
</li><li>Data types BLOB, CLOB, VARCHAR_IGNORECASE, OTHER
155
</li><li>Wide indexes with large VARCHAR or VARBINARY columns and / or with a lot of columns
156
</li><li>Multi-threading and using multiple connections
157
</li></ul>
158

159
<p>
160
Areas considered Experimental:
161
</p>
162
<ul>
163
<li>The PostgreSQL server
164
</li><li>Compatibility modes for other databases (only some features are implemented)
165
</li><li>The ARRAY data type and related functionality
166
</li></ul>
167

168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
<br /><a name="slow_open"></a>
<h3>Why is Opening my Database Slow?</h3>
<p>
If it takes a long time to open a database, in most cases it was not closed the last time.
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.
</p>
<p>
To find out what the problem is, open the database in embedded mode using the H2 Console. 
This will print progress information. If you have many 'Creating index' lines it is an indication that the 
database was not closed the last time. 
</p>
<p>
Other possible reasons are: the database is very big (many GB), or contains linked tables
that are slow to open.
</p>

187
<br /><a name="gcj"></a>
188
<h3>Is the GCJ Version Stable? Faster?</h3>
189 190 191 192 193 194 195
<p>
The GCJ version is not as stable as the Java version.
When running the regression test with the GCJ version, sometimes the application just stops
at what seems to be a random point without error message.
Currently, the GCJ version is also slower than when using the Sun VM.
However, the startup of the GCJ version is faster than when using a VM.
</p>
196

197 198 199
<br /><a name="translate"></a>
<h3>How to Translate this Project?</h3>
<p>
200
For more information, see
201
<a href="build.html#translating">Build/Translating</a>.
202 203
</p>

204
</div></td></tr></table><!-- analytics --></body></html>