C # using Berkeley DB

Berkeley DB is an open source document database, between relational databases and in-memory database.

Berkeley DB is embedded key database library that provides scalable, high-performance data management services for the application. Berkeley DB product using a simple function call API for data access and management.

It is developed using C, C # call is P / Invoke form, but Oracle released the C # version, which encapsulates the API calls, so we only need to reference the assembly directly call on the line.

A more detailed description, please visit the Oracle Berkeley DB official website https://www.oracle.com/database/technologies/related/berkeleydb.html

 

The following describes how to start using BerkeleyDB in C # (because the official did not provide compiled dll, so we need to download the source code to compile)

1. Open the official download page (login required Oracle account, end of the article provides a link to download the Windows platform source code), optionally, a three links, two of which are compressed in front, behind a package is installed. Recommended download zip format

https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html

2, extract the source files, open build_windows directory, open the corresponding sln files according to their own version vs

3. Compile

Two points to note here is the compiled version, and the output directory

Version: If we need 64-bit version of the dll, you need to separate each project are elected to 64-bit. 32 also do so. If not the median, it will call unsuccessful.

It is noteworthy that, prior to compilation, to see the current mode is the Release or Debug mode, 32-bit or 64-bit set is provided. If you are currently active Release mode, but change is to set Debug mode, which would cause the compiler out of the library in question.

 

Output Directory: This solution directory in C # and C ++ compiler output is not the same, it is recommended to set them to a directory, so easy to find the file, it will not mess up.

我这里是把截图中的三个工程输出到了同一个目录,其它的工程是示例程序,可以忽略。

编译完成后,打开编译目录,可以看到以下文件

4、调用(这里只提供了简单的使用,更加详细的使用可以看解决方案中的其它工程)

新建一个C#控件台程序,引用libdb_dotnet181.dll,输入以下代码

 

Guess you like

Origin www.cnblogs.com/zhaotianff/p/10929955.html