| 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-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 4 |
and the EPL 1.0 (https://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 |
Quickstart |
| 13 |
</title> |
| 14 |
<link rel="stylesheet" type="text/css" href="stylesheet.css" /> |
| 15 |
<!-- [search] { --> |
| 16 |
<script type="text/javascript" src="navigation.js"></script> |
| 17 |
</head><body onload="frameMe();"> |
| 18 |
<table class="content"><tr class="content"><td class="content"><div class="contentDiv"> |
| 19 |
<!-- } --> |
| 20 |
|
| 21 |
<h1>Quickstart</h1> |
| 22 |
<a href="#embedding"> |
| 23 |
Embedding H2 in an Application</a><br /> |
| 24 |
<a href="#h2_console"> |
| 25 |
The H2 Console Application</a><br /> |
| 26 |
|
| 27 |
<h2 id="embedding">Embedding H2 in an Application</h2> |
| 28 |
<p> |
| 29 |
This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to: |
| 30 |
</p> |
| 31 |
<ul> |
| 32 |
<li>Add the <code>h2*.jar</code> to the classpath (H2 does not have any dependencies) |
| 33 |
</li><li>Use the JDBC driver class: <code>org.h2.Driver</code> |
| 34 |
</li><li>The database URL <code>jdbc:h2:~/test</code> opens the database <code>test</code> in your user home directory |
| 35 |
</li><li>A new database is automatically created |
| 36 |
</li></ul> |
| 37 |
|
| 38 |
<h2 id="h2_console">The H2 Console Application</h2> |
| 39 |
<p> |
| 40 |
The Console lets you access a SQL database using a browser interface. |
| 41 |
<br /> |
| 42 |
<img src="images/console-2.png" |
| 43 |
width="535" height="179" |
| 44 |
alt="Web Browser - H2 Console Server - H2 Database" /> |
| 45 |
<br /> |
| 46 |
If you don't have Windows XP, or if something does not work as expected, |
| 47 |
please see the detailed description in the <a href="tutorial.html">Tutorial</a>. |
| 48 |
</p> |
| 49 |
|
| 50 |
<h3>Step-by-Step</h3> |
| 51 |
|
| 52 |
<h4>Installation</h4> |
| 53 |
<p> |
| 54 |
Install the software using the Windows Installer (if you did not yet do that). |
| 55 |
</p> |
| 56 |
|
| 57 |
<h4>Start the Console</h4> |
| 58 |
<p> |
| 59 |
Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]:<br /> |
| 60 |
<img class="screenshot" src="images/quickstart-1.png" alt="Screenshot: start H2 Console" /><br /> |
| 61 |
A new console window appears:<br /> |
| 62 |
<img class="screenshot" src="images/quickstart-2.png" alt="Screenshot: H2 running" /><br /> |
| 63 |
Also, a new browser page should open with the URL <a href="http://localhost:8082" class="notranslate">http://localhost:8082</a>. |
| 64 |
You may get a security warning from the firewall. If you don't want other computers in the network to access the database |
| 65 |
on your machine, you can let the firewall block these connections. Only local connections are required at this time. |
| 66 |
</p> |
| 67 |
|
| 68 |
<h4>Login</h4> |
| 69 |
<p> |
| 70 |
Select [Generic H2] and click [Connect]:<br /> |
| 71 |
<img class="screenshot" src="images/quickstart-3.png" alt="Screenshot: login" /><br /> |
| 72 |
You are now logged in. |
| 73 |
</p> |
| 74 |
|
| 75 |
<h4>Sample</h4> |
| 76 |
<p> |
| 77 |
Click on the [Sample SQL Script]:<br /> |
| 78 |
<img class="screenshot" src="images/quickstart-4.png" alt="Screenshot: click on the sample SQL script" /><br /> |
| 79 |
The SQL commands appear in the command area.<br /> |
| 80 |
</p> |
| 81 |
|
| 82 |
<h4>Execute</h4> |
| 83 |
<p> |
| 84 |
Click [Run]<br /> |
| 85 |
<img class="screenshot" src="images/quickstart-5.png" alt="Screenshot: click Run" /><br /> |
| 86 |
On the left side, a new entry TEST is added below the database icon. |
| 87 |
The operations and results of the statements are shown below the script.<br /> |
| 88 |
<img class="screenshot" src="images/quickstart-6.png" alt="Screenshot: see the result" /><br /> |
| 89 |
</p> |
| 90 |
|
| 91 |
<h4>Disconnect</h4> |
| 92 |
<p> |
| 93 |
Click on [Disconnect]:<br /> |
| 94 |
<img src="images/icon_disconnect.gif" alt="Disconnect icon" /><br /> |
| 95 |
to close the connection. |
| 96 |
</p> |
| 97 |
|
| 98 |
<h4>End</h4> |
| 99 |
<p> |
| 100 |
Close the console window. |
| 101 |
For more information, see the <a href="tutorial.html">Tutorial</a>. |
| 102 |
</p> |
| 103 |
|
| 104 |
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html> |
| 105 |
|