I am looking for one embedded database written C++ with ability subscribing to events like value changed, value deleted, value added in values class, etc.
Platforms: posix, so almost any.
At this moment I am looking on SQLite and leveldb.
May be you know how to add this ability? Or may be another cool database?

  • 1
    Surely the database does not have to be written in C++ as long as it has a C++ API. Do you have any price/licence constraints? Commented Feb 7, 2017 at 5:03
  • 1
    Yes. OpenSource is in preference.co
    – kyb
    Commented Feb 7, 2017 at 6:33
  • 1
    Just to make sure I understant what you're requesting: You want the DB to expose hooks for functions to get called for each record as it's about to be deleted/updated or right after it's been added?
    – einpoklum
    Commented Feb 7, 2017 at 17:27
  • @einpoklum absolutely yes.
    – kyb
    Commented Feb 7, 2017 at 19:58

2 Answers 2


As Steve said, you don’t really need a database that was coded in C++, unless you plan to extend its functionality. All you care about is a database that interfaces well with C++.

For that, you need a database connector https://en.wikipedia.org/wiki/Database_connection and (almost?) all popular databases will offer one.

Have you decided whether you want/need a relational database https://en.wikipedia.org/wiki/Relational_database or a “NoSQL database”? https://en.wikipedia.org/wiki/NoSQL

After that decision, just look at popular free DBs http://blog.capterra.com/free-database-software/ and choose one which is right for you (we can’t help you with that, sorry).

Sqlite, which you mentioned is fine, and has the advantage that you can link it with your code and so release only a single executable, with no additional files, and has good documentation and support, but ultimately the choice is yours.

[Update] in response to OP’s comment.

I personally recommend having a single running instance of a single application which is the only database user. I do this in case I have multiple remote clients. My app can handle contention when multiple clients want to read/write simultaneously. Of course, the database can take care of that, but I prefer to know about it & have control of it. If you implement that way, you don’t need to know about database triggers, because your database control app can generate them.

If you don’t have a single debase control app, and have lots of distributed copies of your client app, then triggers is how they will know when the database has been updated.

If that’s all that you want, then you can go with Sqlite or MySql if you have a database control app. If you have multiple client apps, go with Mysql.

  • My main point is event-driven embedded database. Other is secondary
    – kyb
    Commented Feb 7, 2017 at 13:04
  • I have updated my answer to add more info.
    – Mawg
    Commented Feb 7, 2017 at 13:58
  • 1
    Nice update. Anyway I need to write some wrapper.
    – kyb
    Commented Feb 7, 2017 at 19:57

I think you might be able to get MonetDB to do that. Or rather, I'm sure you can do it in a not-fun way by writing a custom MAL module which wraps your C++ code - which you would add to a clone of the MonetDB codebase, since MonetDB is FOSS; then you could submit queries in MAL (the operation interpreter into which MonetDB parses SQL queries) which use your code. If it were Python or R functions it would have been much simpler and easier.

H-o-w-e-v-e-r - MonetDB is a column store, not a row store; and it's more analytics-oriented than transaction oriented, so I'm not sure that would be such a great solution performance-wise. If you're still interested, you should probably re-ask your question with more specific details on what you intend to do, on the MonetDB user mailing list.

Now, if you want to go the embdedded way with MonetDB, well, it is embeddable - there's an R embedding of it named MonetDBLite. I'm not sure how much work it would be to adapt an embedding to work with a C++ application: It could be a lot, since MonetDB is a big project with some cruft here and there; but it could be not so much, considering how it's a C language project. If you want to discuss this option, talk to Dr. Hannes Mulheisen at my group at CWI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.