Apache Derby 简明教程

Apache Derby - Introduction

Apache Derby 是一个完全基于 (编写/实现于) Java 编程语言的*关系* 数据库 管理 系统。它是由 Apache 软件基金会开发的一个开源数据库。

Apache Derby is a *R*elational *D*atabase *M*anagement *S*ystem which is fully based on (written/implemented in) Java programming language. It is an open source database developed by Apache Software Foundation.

Oracle 释出了名称为 JavaDB 的 Apache Derby 等价版本。

Oracle released the equivalent of Apache Derby with the name JavaDB.

Features of Apache Derby

以下项是 Derby 数据库的显著功能−

Following are the notable features of Derby database −

  1. Platform independent − Derby uses on-disc database format where the databases in it are stored in a file in the disc within the directory with the same name as the database.

  2. No modifying data − Because of this, you can move derby databases to other machines without modifying the data.

  3. Transactional support − Derby provides complete support for transactions ensuring data integrity.

  4. Including databases − You can include pre-build/existing databases into your current derby applications.

  5. Less space − Derby database has a small footprint, i.e., it occupies less space and it is easy to use and deploy it.

  6. Embed with Java Application − Derby provides an embedded database engine which can be embedded in to Java applications and it will be run in the same JVM as the application. Simply loading the driver starts the database and it stops with the applications.

Limitations of Apache Derby

以下是 Apache Derby 的局限性−

Following are the limitations of Apache Derby −

  1. Derby does not support indexes for datatypes such as BLOB and LONGVARCHAR.

  2. If Derby does not have enough disc space, it will shut down immediately.

Data storage

在存储数据时,Apache Derby 遵循一个称为 conglomerate 的概念。其中,表的数据将存储在单独的文件中。同样,表的每个索引也存储在单独的文件中。因此,数据库中每个表或索引都将有一个单独的文件。

While storing data, Apache Derby follows a concept known as conglomerate. In this, data of a table will be stored in a separate file. In the same way, each index of a table is also stored in a separate file. Thus, there will be a separate file for every table or index in the database.

Apache Derby Library/Components

Apache Derby 发行版提供各种组件。在已下载的 Apache 发行版的 lib 文件夹中,你可以观察到表示各种组件的 jar 文件。

Apache Derby distribution provides various components. In the lib folder of the apache distribution you have downloaded, you can observe jar files representing various components.

Jar file

Component

Description

derby.jar

Database Engine and JDBC driver

The Database engine of Apache Derby is an embedded relational database engine which supports JDBC and SQL API’s. This also acts as embedded Driver, using which you can communicate to Derby using Java applications.

derbynet.jar derbyrun.jar

Network server

The Network Sever of Apache Derby provides the client server functionality, where the clients can connect to the Derby server through a network.

derbyclient.jar

Network client JDBC driver

derbytools.jar

Command line tools

This jar file holds tools such as sysinfo, ij, and dblook.

derbyoptionaltools.jar

Optional command line utilities (tools)

This jar file provides optional tools: databaseMetaData optional tool, foreignViews optional tool, luceneSupport optional tool, rawDBReader optional tool, simpleJson optional tool, etc

derbyLocale_XX.jar

Jar files to localize messages

In addition to the above mentioned jar files, you can see several derbyLocale_XX.jar (es, fr, hu, it, ja, etc.). Using these, you can localize the messages of Apache Derby.