Eric
Eric

Reputation: 2128

C++ Database Access With No Required Installation

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:

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 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.

Upvotes: 4

Views: 1373

Answers (2)

Jordan Parmer
Jordan Parmer

Reputation: 37174

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.

Upvotes: 6

Dirk is no longer here
Dirk is no longer here

Reputation: 368261

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.

Upvotes: 5

Related Questions