H2 Database 简明教程

H2 Database - Introduction

H2 是一个开源轻型 Java 数据库。它可以嵌入在 Java 应用程序中,或在客户端-服务器模式下运行。H2 数据库主要可以配置为内存数据库运行,这意味着数据不会保存在磁盘上。由于是嵌入式数据库,因此它不会用于生产开发,而是主要用于开发和测试。

H2 is an open-source lightweight Java database. It can be embedded in Java applications or run in the client-server mode. Mainly, H2 database can be configured to run as inmemory database, which means that data will not persist on the disk. Because of embedded database it is not used for production development, but mostly used for development and testing.

此数据库可以在嵌入模式或服务器模式下使用。以下是 H2 数据库的主要功能 -

This database can be used in embedded mode or in server mode. Following are the main features of H2 database −

  1. Extremely fast, open source, JDBC API

  2. Available in embedded and server modes; in-memory databases

  3. Browser-based Console application

  4. Small footprint − Around 1.5MB jar file size

Features of H2 Database

H2 数据库的主要功能如下 -

The main features of H2 Database are as follows −

  1. It is an extremely fast database engine.

  2. H2 is open source and written in Java.

  3. It supports standard SQL and JDBC API. It can use PostgreSQL ODBC driver too.

  4. It has embedded and Server mode.

  5. H2 supports clustering and multi-version concurrency.

  6. It has strong security features.

Additional Features

以下是 H2 数据库的一些附加功能 -

Following are some additional features of H2 Database −

  1. H2 is a disk-based or in-memory databases and tables, read-only database support, temporary tables.

  2. H2 provides transaction support (read committed), 2-phase-commit multiple connections, table level locking.

  3. H2 is a cost-based optimizer, using a genetic algorithm for complex queries, zeroadministration.

  4. H2 contains scrollable and updatable result set support, large result set, external result sorting, functions can return a result set.

  5. H2 supports encrypted database (AES), SHA-256 password encryption, encryption functions, and SSL.

Components in H2 Database

为了使用 H2 数据库,您需要具有以下组件 -

In order to use H2 Database, you need to have the following components −

  1. A web browser

  2. A H2 console server

这是一个客户端/服务器应用程序,因此需要服务器和客户端(浏览器)才能运行它。

This is a client/server application, so both server and client (a browser) are required to run it.