【数据库–db4o 介绍】

2022-09-13 21:42:49 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

一、db4o 简介

db4o (database for objects) was an embeddable open source object database for Java and .NET developers. It was developed, commercially licensed and supported by Actian. In October 2014, Actian declined to continue to actively pursue and promote the commercial db4o product offering for new customers

db4o 是一个开源的纯面向对象数据库引擎,对于 Java 与 .NET 开发者来说都是一个简单易用的对象持久化工具。db4o 的目标是提供一个功能强大的,适合嵌入的数据库引擎,可以工作在设备,移动产品,桌面以及服务器等各种平台。本系列文章将给我们带来一场面向对象数据库的风暴。

二、特性

db4o 的目标是提供一个功能强大的,适合嵌入的数据库引擎,可以工作在设备,移动产品,桌面以及服务器等各种平台。主要特性如下:

开源模式。与其他 ODBMS 不同,db4o 为开源软件,通过开源社区的力量驱动开发 db4o 产品。

原生数据库。db4o 是 100% 原生的面向对象数据库,直接使用编程语言来操作数据库。程序员无需进行 OR 映射来存储对象,大大节省了程序员在存储数据的开发时间。

高性能。 db4o 比采用 Hibernate/MySQL 方案在某些测试线路上速度高出 44 倍之多!并且安装简单,仅仅需要 400Kb 左右的 .jar 或 .dll 库文件。

易嵌入。使用 db4o 仅需引入 400 多 k 的 jar 文件或是 dll 文件,内存消耗极小。

零管理。使用 db4o 无需 DBA,实现零管理。

支持多种平台。db4o 支持从 Java 1.1 到 Java 5.0,此外还支持 .NET 、 CompactFramework 、 Mono 等 .NET 平台,也可以运行在 CDC 、 PersonalProfile 、 Symbian 、 Savaje 以及 Zaurus 这种支持反射的 J2ME 方言环境中,还可以运行在 CLDC 、 MIDP 、 RIM/Blackberry 、 Palm OS 这种不支持反射的 J2ME 环境中。

Features

One-line-of-code database

db4o contains a function to store any object:

objectContainer.store(new SomeClass());

SomeClass here does not require any interface implementations, annotations or attributes added. It can be any application class including third-party classes contained in referenced libraries.

All field objects (including collections) are saved automatically. Special cases can be handled through writing custom type handlers.[2]

Embeddable

db4o is designed to be embedded in clients or other software components invisible to the end user. Thus, db4o needs no separate installation mechanism, but comes as a single library file with a footprint of around 670kB in the .NET version and around 1MB in the Java version.

Client-server mode

Client/server version allows db4o to communicate between client and server-side applications. It uses TCP/IP for client-server communication and allows to configure port number. Communication is implemented through messaging.

Due to a feature referred to as “Generic Reflection”, db4o can work without implementing persistent classes on the server. However, this mode has limitations.[3]

Dynamic schema evolution

db4o supports automatic object schema evolution for the basic class model changes (field name deletion/addition). More complex class model modifications, like field name change, field type change, hierarchy move are not automated out-of-the box, but can be automated by writing small utility update program (see documentation).

This feature can be viewed as an advantage over relational model, where any change in the schema results in mostly manual code review and upgrade to match the schema changes.

Native queries

Rather than using string-based APIs (such as SQL, OQL, JDOQL, EJB QL, and SODA), Native Queries (NQ) allow developers to simply use the programming language itself (e.g., Java, C#, or VB.NET) to access the database and thus avoid a constant, productivity-reducing context switch between programming language and data access API. Native Queries also provide type safety, as well as remove the need to sanitize against code injection (see SQL Injection).

LINQ

LINQ support is fully integrated in db4o for .NET version 3.5. LINQ allows the creation of object-oriented queries of any complexity with the benefit of compile-time checking, IDE Intellisense integration and automated refactoring.

Due to integration with some open-source libraries db4o also allows optimized LINQ queries on Compact Framework.

LINQ can be used both against relational and object data storage, thus providing a bridge between them. It can also be used as an abstraction layer, allowing to easily switch the underlying database technology.

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/162619.html原文链接:https://javaforall.cn

0 人点赞