Debian Codegraph @

src/docsrc/html/cheatSheet.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <!--
3 Copyright 2004-2019 H2 Group. Multiple-Licensed under the MPL 2.0,
4 and the EPL 1.0 (http://h2database.com/html/license.html).
5 Initial Developer: H2 Group
6 -->
7 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
8 <head>
9 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
10 <meta name="viewport" content="width=device-width, initial-scale=1" />
11 <title>
12 H2 Database Engine
13 </title>
14 <style type="text/css">
15 td, input, select, textarea, body, td, th {
16 font: 13px Arial, sans-serif;
17 }
18 h1, h2, h3, h4, h5 {
19 font: 13px Arial, sans-serif;
20 font-weight: bold;
21 }
22 h1 {
23 background-color: #0000bb;
24 padding: 2px 4px 2px 4px;
25 margin-bottom: 0px;
26 color: #fff;
27 font-size: 19px;
28 line-height: normal;
29 }
30 h2 {
31 font-size: 16px;
32 }
33 a.link {
34 text-decoration: underline;
35 color: blue;
36 }
37 a.link:hover {
38 text-decoration: underline;
39 color: blue;
40 }
41 a {
42 text-decoration: none;
43 color: black;
44 }
45 a:hover {
46 text-decoration: underline;
47 color: blue;
48 }
49 td, input, select, textarea, body, code, pre {
50 font: 13px Arial, sans-serif;
51 }
52 pre {
53 background-color: #ece9d8;
54 border: 1px solid #aca899;
55 padding: 6px;
56
57 -moz-border-radius: 4px;
58 -webkit-border-radius: 4px;
59 -khtml-border-radius: 4px;
60 border-radius: 4px;
61
62 -moz-box-shadow: 2px 2px 2px #aca899;
63 -webkit-box-shadow: 2px 2px 2px #aca899;
64 -khtml-box-shadow: 2px 2px 2px #aca899;
65 -o-box-shadow: 2px 2px 2px #aca899;
66 box-shadow: 2px 2px 2px #aca899;
67 }
68 code {
69 background-color: #ece9d8;
70 padding: 0px 4px;
71
72 -moz-border-radius: 4px;
73 -webkit-border-radius: 4px;
74 -khtml-border-radius: 4px;
75 border-radius: 4px;
76 }
77 table {
78 background-color: #ffffff;
79 border-collapse: collapse;
80 border: 0px solid #aca899;
81 }
82 th {
83 text-align: left;
84 background-color: #ece9d8;
85 border: 1px solid #aca899;
86 padding: 2px;
87 }
88 td {
89 background-color: #ffffff;
90 text-align: left;
91 vertical-align: top;
92 border: 0px solid #aca899;
93 padding: 2px;
94 }
95 ul, ol {
96 list-style-position: outside;
97 padding-left: 20px;
98 }
99 li {
100 margin-top: 2px;
101 }
102 </style>
103 </head><body>
104
105 <div style="width:780px; margin:0 auto;">
106
107 <h1>H2 Database Engine Cheat Sheet</h1>
108 <div style="float:left; margin:5px; width:370px;">
109
110 <h2>Using H2</h2>
111 <ul><li><a href="http://h2database.com">H2</a> is
112 <a href="https://github.com/h2database/h2database">open source</a>,
113 <a href="license.html">free to use and distribute</a>.
114 </li><li><a href="http://h2database.com/html/download.html">Download</a>:
115 <a href="http://repo1.maven.org/maven2/com/h2database/h2/${version}/h2-${version}.jar" class="link">jar</a>,
116 <a href="http://www.h2database.com/h2-setup-${versionDate}.exe" class="link">installer (Windows)</a>,
117 <a href="http://www.h2database.com/h2-${versionDate}.zip" class="link">zip</a>.
118 </li><li>To start the
119 <a href="quickstart.html#h2_console">H2 Console tool</a>, double click the jar file, or
120 run <code>java -jar h2*.jar</code>, <code>h2.bat</code>, or <code>h2.sh</code>.
121 </li><li><a href="tutorial.html#creating_new_databases">A new database is automatically created</a>
122 <a href="features.html#database_only_if_exists">by default</a>.
123 </li><li><a href="features.html#closing_a_database">Closing the last connection closes the database</a>.
124 </li></ul>
125
126 <h2>Documentation</h2>
127 <p>
128 Reference:
129 <a href="grammar.html" class="link">SQL grammar</a>,
130 <a href="functions.html" class="link">functions</a>,
131 <a href="datatypes.html" class="link">data types</a>,
132 <a href="tutorial.html#command_line_tools" class="link">tools</a>,
133 <a href="../javadoc/index.html" class="link">API</a>
134 <br />
135 <a href="features.html">Features</a>:
136 <a href="tutorial.html#fulltext" class="link">fulltext search</a>,
137 <a href="features.html#file_encryption" class="link">encryption</a>,
138 <a href="features.html#read_only" class="link">read-only</a>
139 <a href="features.html#database_in_zip" class="link">(zip/jar)</a>,
140 <a href="tutorial.html#csv" class="link">CSV</a>,
141 <a href="features.html#auto_reconnect" class="link">auto-reconnect</a>,
142 <a href="features.html#triggers" class="link">triggers</a>,
143 <a href="features.html#user_defined_functions" class="link">user functions</a>
144 </p>
145
146 <h2><a href="features.html#database_url">Database URLs</a></h2>
147 <p>
148 <b><a href="features.html#connection_modes">Embedded</a></b><br />
149 <code>jdbc:h2:~/test</code> 'test' in the user home directory<br />
150 <code>jdbc:h2:/data/test</code> 'test' in the directory /data<br />
151 <code>jdbc:h2:./test</code> in the current(!) working directory<br />
152 </p><p>
153 <b><a href="features.html#in_memory_databases">In-Memory</a></b><br />
154 <code>jdbc:h2:mem:test</code> multiple connections in one process<br />
155 <code>jdbc:h2:mem:</code> unnamed private; one connection<br />
156 </p><p>
157 <b><a href="tutorial.html#using_server">Server Mode</a></b><br />
158 <code>jdbc:h2:tcp://localhost/~/test</code> user home dir<br />
159 <code>jdbc:h2:tcp://localhost//data/test</code> absolute dir<br />
160 <a href="tutorial.html#using_server">Server start</a>:<code>java -cp *.jar org.h2.tools.Server</code>
161 </p><p>
162 <b><a href="features.html#database_url">Settings</a></b><br />
163 <code>jdbc:h2:..;MODE=MySQL</code> <a href="features.html#compatibility" >compatibility (or HSQLDB,...)</a><br />
164 <code>jdbc:h2:..;TRACE_LEVEL_FILE=3</code> <a href="features.html#trace_options">log to *.trace.db</a><br />
165 </p>
166
167 </div>
168 <div style="float:right; padding:5px; width:370px;">
169
170 <h2><a href="tutorial.html#connecting_using_jdbc">Using the JDBC API</a></h2>
171 <pre>
172 Connection conn = DriverManager.
173 getConnection("jdbc:h2:~/test");
174 conn.close();
175 </pre>
176
177 <h2><a href="tutorial.html#connection_pool">Connection Pool</a></h2>
178 <pre>
179 import org.h2.jdbcx.JdbcConnectionPool;
180 JdbcConnectionPool cp = JdbcConnectionPool.
181 create("jdbc:h2:~/test", "sa", "sa");
182 Connection conn = cp.getConnection();
183 conn.close(); cp.dispose();
184 </pre>
185
186 <h2><a href="build.html#maven2">Maven 2</a></h2>
187 <pre>
188 &lt;dependency&gt;
189 &lt;groupId&gt;com.h2database&lt;/groupId&gt;
190 &lt;artifactId&gt;h2&lt;/artifactId&gt;
191 &lt;version&gt;${version}&lt;/version&gt;
192 &lt;/dependency&gt;
193 </pre>
194
195 <h2><a href="tutorial.html#using_hibernate">Hibernate</a></h2>
196 <p>
197 hibernate.cfg.xml (or use the HSQLDialect):
198 </p>
199 <pre>
200 &lt;property name="dialect"&gt;
201 org.hibernate.dialect.H2Dialect
202 &lt;/property&gt;
203 </pre>
204
205 <h2><a href="tutorial.html#using_toplink">TopLink and Glassfish</a></h2>
206 <p>
207 Datasource class: <code>org.h2.jdbcx.JdbcDataSource</code><br />
208 <code>oracle.toplink.essentials.platform.</code><br />
209 <code>database.H2Platform</code>
210 </p>
211
212 </div>
213
214 </div>
215
216 </body></html>