Embedded database in JUCE


#1

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 ?


#2

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.


#3

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

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.


#4

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.


#5

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? :slight_smile:


#6

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.


#7

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.


#8

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/


#9

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.


#10

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


#11

The easiest way to use SQLite in your project is to use the “amalgamation”: 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.


#12

Thanks that is what I was looking for photon.


#13