# Embedded database in JUCE

**URL:** <https://forum.juce.com/t/embedded-database-in-juce/2021>\
**Category:** General JUCE discussion\
**Created:** [August 16, 2007, 9:18am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021 "2007-08-16T09:18:13Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![atom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/atom/32/113_2.png) [@atom](https://forum.juce.com/u/atom)\
**Post date:** [August 16, 2007, 9:18am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/1 "2007-08-16T09:18:13Z")

</div>

Is it perhaps planned to embed any kind of database in JUCE, like SQLite or my favorite GDBM. It would be a great additon to all the capabilities that already exist. I know that GDBM is GPLed so license is not a problem i don’t know about SQLite, programmicly the interfaces are fairly simple and like mysql don’t need no other software running, purly file based. What do you think about it ?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 16, 2007, 9:20am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/2 "2007-08-16T09:20:06Z")

</div>

My to-do list is already too long to add anything that big to it! I’m also a bit of a novice when it comes to databases. But I believe there are people who are linking various DBs into their juce programs already.

---

<div class="post-metadata">

**Author:** ![atom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/atom/32/113_2.png) [@atom](https://forum.juce.com/u/atom)\
**Post date:** [August 16, 2007, 10:57am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/3 "2007-08-16T10:57:21Z")

</div>

i can imagine your TODO list (or perhaps i can’t 🙂 ).

it’s not a problem to link any db interface to juce, i was thinking of a consistent data storage system for juce, for storing large amounts of data.

---

<div class="post-metadata">

**Author:** ![valley](https://avatars.discourse-cdn.com/v4/letter/v/67e7ee/32.png) [@valley](https://forum.juce.com/u/valley)\
**Post date:** [August 16, 2007, 2:09pm UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/4 "2007-08-16T14:09:28Z")

</div>

> [@atom](#):
>
> I know that GDBM is GPLed so license is not a problem i don’t know about SQLite

SQLite is public domain.

I’ve used SQLite alongside JUCE quite comfortably. Admittedly not for any large projects, as my main project has no need of a DB, but for smaller sticky-tape[1] projects.

I’m no sure I see the need for a DB engine in JUCE. Unless you are looking at the lightest of lightweight solutions, implementing a SQL server is a huge deal. Most people tend to be real picky about their choice of DB engine once the data application gets outside of the realms of utterly trivial. There is definitely a bit of a gap between lightweight XML based data files, and SQL engines, but it’s a pretty small gap IMHO, and SQLite fits the bill well enough there anyway.

As for GDBM, I’ve never used it. Why do you prefer it to SQLite? I’ve personally stuck with SQLite because I appreciate the fact that it is PD, can be statically linked, and produces db files that transfer well from platform to platform.

[1] A large amount of my time is spent making one-off programs that solve a single purpose and are then never used again. Make of that what you will.

---

<div class="post-metadata">

**Author:** ![robiwan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/robiwan/32/2446_2.png) [@robiwan](https://forum.juce.com/u/robiwan)\
**Post date:** [August 16, 2007, 5:17pm UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/5 "2007-08-16T17:17:45Z")

</div>

I’ve used SQLite in a large project (via the ODBC driver) for storing archived data from a biotech instrument with db sizes well in excess of 1 GB.

Its implementation of SQL is quite well enough for all but the most complex queries (you got joins though), and its fast too. I’d recommend for anyone needing a database to go with SQLite.

I also second the non-need to include a db-engine into Juce. But an ODBC wrapper maybe? 🙂

---

<div class="post-metadata">

**Author:** ![atom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/atom/32/113_2.png) [@atom](https://forum.juce.com/u/atom)\
**Post date:** [August 17, 2007, 11:21am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/6 "2007-08-17T11:21:23Z")

</div>

yeah ODBC would be a better idea, but i don’t like the way it’s configured across platforms (i recently had to configure it on my UBUNTU installation and editing INI files was not that “easy”).

GDBM is fast and simple, it’s nt a SQL based engine, so you don’t need to know SQL, it’s a simple KEY-\>VALUE storage engine, it’s small and simple. SQLite is nice, like i said depending on what you want, if you want a SQL based database then yeah SQLite is the way to go, i was thinking of a more generic data storage for a framework, not necessary SQL based.

---

<div class="post-metadata">

**Author:** ![valley](https://avatars.discourse-cdn.com/v4/letter/v/67e7ee/32.png) [@valley](https://forum.juce.com/u/valley)\
**Post date:** [August 17, 2007, 2:28pm UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/7 "2007-08-17T14:28:05Z")

</div>

Ahh, that’s interesting.

As I’ve not used GDBM, I missed the subtlety of the point you were making, sorry.

Yeah, an engine like that could be useful. More of a registry-alike database than a real database engine.

It seems to me that just providing methods efficiently serialize the StringPairArray container might get you near where you want to be. If the array were serialized as a binary lock, rather than as a text file, it’d be pretty fast to access. A simple hash table index could be used to quickly locate key/values, which would allow the programmer to choose whether the file should be fully unserialized into memory as a normal StringPairArray, or whether values should be read from file on demand.

Looking at it in that context, I don’t know that this would be so large a development job. If I wasn’t in such a time crush right now, I’d probably have a go at it myself, as I could see a uses for such a thing.

---

<div class="post-metadata">

**Author:** ![robiwan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/robiwan/32/2446_2.png) [@robiwan](https://forum.juce.com/u/robiwan)\
**Post date:** [August 20, 2007, 1:43pm UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/8 "2007-08-20T13:43:41Z")

</div>

Just in case anyone is interested, here is the database template library (DTL) which I use to speak with DBs over ODBC…  
[http://dtemplatelib.sourceforge.net/](http://dtemplatelib.sourceforge.net/)

---

<div class="post-metadata">

**Author:** ![graystatic](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/graystatic/32/467_2.png) [@graystatic](https://forum.juce.com/u/graystatic)\
**Post date:** [August 21, 2007, 3:04am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/9 "2007-08-21T03:04:43Z")

</div>

Does anybody know of a tutorial on (or want to explain about) how to implement sqlite using vc++ express, I was looking into using sqlite with juce, but can’t quite figure it out.

---

<div class="post-metadata">

**Author:** ![valley](https://avatars.discourse-cdn.com/v4/letter/v/67e7ee/32.png) [@valley](https://forum.juce.com/u/valley)\
**Post date:** [August 21, 2007, 8:34pm UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/10 "2007-08-21T20:34:33Z")

</div>

dunno about a tutorial, but what are you stuck on specifically?

---

<div class="post-metadata">

**Author:** ![photon](https://avatars.discourse-cdn.com/v4/letter/p/b5a626/32.png) [@photon](https://forum.juce.com/u/photon)\
**Post date:** [August 21, 2007, 9:44pm UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/11 "2007-08-21T21:44:35Z")

</div>

The easiest way to use SQLite in your project is to use the “amalgamation”: [http://sqlite.org/sqlite-amalgamation-3\_4\_2.zip](http://sqlite.org/sqlite-amalgamation-3_4_2.zip)

I gives you the whole SQLite code in one header file sqlite3.h and a huge source file sqlite3.c. Just add both to your project and compile them as part of your code. No additional configuration is needed in general, the default configuration of SQLite is suitable for most cases.

Now you can use SQLite with JUCE within your project.

You can also start a new DLL or static library project in VC++ Express add sqlite3.h and sqlite3.c, compile it and link against this new library from your project.

---

<div class="post-metadata">

**Author:** ![graystatic](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/graystatic/32/467_2.png) [@graystatic](https://forum.juce.com/u/graystatic)\
**Post date:** [August 22, 2007, 12:06am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/12 "2007-08-22T00:06:33Z")

</div>

Thanks that is what I was looking for photon.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 10:14am UTC](https://forum.juce.com/t/embedded-database-in-juce/2021/13 "2017-05-12T10:14:15Z")

</div>


