H2 Database 简明教程
H2 Database - Installation
H2 是用 Java 编写的数据库。我们可以使用 JDBC 轻松地将该数据库嵌入到应用程序中。我们可以在许多不同的平台或任何版本的 Java 运行时环境中运行它。但是,在安装数据库之前,应该在系统中安装 Java。
H2 is a database written in Java. We can easily embed this database to our application by using JDBC. We can run this on many different platforms or any version of Java Runtime Environment. However, before installing the database, there should be Java installed in the system.
Verify Java Installation
如果在系统中安装了 JDK,请尝试使用以下命令验证 Java 版本。
If JDK is installed in the system, try the following command to verify the Java version.
java –version
如果已成功在系统中安装 JDk,那么我们将会看到以下输出。
If JDk is successfully installed in the system, then we will get the following output.
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
如果系统中未安装 JDK,请访问以下链接 Install JDK 。
If JDK is not installed in the system, then visit the following link to Install JDK.
Install H2 Database
我们可以在许多不同的平台上运行该数据库。在本章中,我们将了解 H2 数据库在 Windows 上的安装方法。
We can run this database on many different platforms. In this chapter, we will learn about H2 Database installation on Windows.
以下是 Windows 操作系统下安装 H2 数据库的步骤。
Following are the steps to install H2 Database on Windows operating system.
Step 1: Download H2 Setup File
从提供的链接下载最新版本的 H2 Database 。在该链接中,您将获得以两种类型提供的 H2 数据库的最新版本。一种是 Windows Installer 类型(即 .exe 文件),另一种是适用于其他操作系统的平台无关的 zip 文件。
Download the latest version of H2 Database from the given link. In this link, you will get the latest version of H2 database in two types. One is Windows Installer type (that is .exe file) and second is Platform-Independent zip file for other operating systems.
下载 .exe 文件后,单击 Windows 安装程序以下载 Windows 支持的 H2 数据库。在此案例中,我们将使用带有版本 1.4.192 的 H2 数据库。
Click the Windows installer for downloading the Windows supportable H2 database after downloading the .exe file. In this case, we are using H2 Database with the version 1.4.192.
Step 2: Install H2 Database
下载后,我们在“下载”目录中获取 H2 Windows 安装程序文件(即 h2-setup-yyyy-mm-dd.exe)。要启动 H2 数据库的安装过程,请双击安装程序文件。
After downloading we get the H2 Windows installer file (i.e. h2-setup-yyyy-mm-dd.exe) in the Downloads directory. To start the installation process of H2 Database, double click on the installer file.
以下屏幕是安装过程的第一步。提供一个位置,以便像以下屏幕截图所示的那样安装 H2 数据库服务器。
The following screen is the first step in the installation process. Provide a path where we want to install the H2 database server as shown in the following screenshot.
如以上屏幕截图所示,默认情况下它会将 C:\ProgramFiles (x86)\H2 作为目标文件夹。单击下一步继续执行下一步。然后会弹出以下屏幕。
As seen in the above screenshot, by default it will take C:\ProgramFiles (x86)\H2 as the destination folder. Click next to proceed to the next step. The following screen pops up.
在以上屏幕截图中,单击“安装”按钮以启动安装过程。安装后,我们会看到以下屏幕截图。
In the above screenshot, click the Install button to start the installation process. After installation, we get the following screenshot.
单击“完成”以完成安装过程。
Click Finish to complete the installation process.
Step 3: Verify H2 Database Installation
安装后,让我们验证系统中的数据库安装。单击 Windows → 键入 H2 控制台 → 单击 H2 控制台图标。连接到 URL http://localhost:8082 。在连接时,H2 数据库将要求进行数据库注册,如下面的屏幕截图所示。
After installation, let us verify the database installation in the system. Click Windows → type H2 Console → Click H2 console icon. Connect to the URL http://localhost:8082. At the time of connecting, the H2 database will ask for database registration as shown in the following screenshot.
在上述对话框中填写所有详细信息,例如已保存设置、设置名称、驱动程序类、JDBC URL、用户名以及密码。在 JDBC URL 中,指定数据库的位置和数据库名称。用户名和密码是数据库用户名和密码的字段。单击“连接”。
Fill all the details in the above dialog box such as Saved Settings, Settings Name, Driver Class, JDBC URL, User Name, and Password. In the JDBC URL, specify the database is located and the database name. User Name and Password are the fields for user name and password of the database. Click Connect.
由此数据库欢迎页面会弹出,如下所示。
The Database welcome page pops up as shown in the following screenshot.