开发者

C++ Database Access With No Required Installation

开发者 https://www.devze.com 2023-03-10 04:55 出处:网络
I am looking for a database that can I run SQL statements on without having to have a database server installed.I.e. I need the ability to select/insert/update a database given only the database file

I am looking for a database that can I run SQL statements on without having to have a database server installed. I.e. I need the ability to select/insert/update a database given only the database file and any external libraries.

Here is my situation:

  • I am using C++ to parse through a number of oddly-formatted binary files, and I would like to store them into some type of database to offer more convenient access to the data.
  • Once the files have been inserted into the database, I will use C# to write an interface/GUI by which a user can interact with the database.
  • I'm using C++ for the speed of reading the files and because I've already written that part.
  • I'm using C# because it is much easier to do GUI programming.

Here are my requirements:

  1. Database must provide a way to run commands in C++ using only external libraries (no installation)

  2. I should be able to move the database to any (similar [Windows]) computer and run my application

I believe this is possible with MS Access *.mdb files using ADO or JET or something like that, however, I would like to hear some alternatives. Please provide the database and the C++ engine/libraries开发者_JAVA百科 in your answer.

My priorities are:

  1. "Lite"-ness
  2. Performance (speed of insert/select)
  3. Client code simplicity (i.e. how easy it is to set up)

Thank you all.


You need to look into SQLite. It is perfect for this scenario and very easy to use. It is vastly popular (large community), compact, cross-platform, and simple to use.

There are SQLite implementations for other languages too. For instance, you can also access SQLite databases using C#. There is even a Linq-to-SQLite.


You cannot go wrong with SQLite here.

It is small enough to be embedded in many apps (see e.g. here for a list of famous apps ranging from Photoshop to Apple Mail + Safari, Dropbox, Firefox, Chrome, Skype and more), yet complete enough to cover most SQL aspects you may need. Great support too, and wide coverage in terms of APIs and languages.

It can have issues with locks and multiple write accesses. But for a single client it should work perfectly fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消