Sign in to follow this  
dgrantkp

Embedded relational db's

Recommended Posts

What options exist for application embedded databases? I know of http://www.sqlite.org/, but I haven't investigated it in any detail yet. I'd like some experienced opinions on: - When and where it is appropriate to employ such a relational database. - What database transaction dialects exist, and what their strengths are. References to any good articles on the subject would be useful as well. ;) Many thanks..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by dgrantkp
- When and where it is appropriate to employ such a relational database.


whenever there are strict hardware constraints (i.e. cpu/ram) and when there's hardly any forseeable need for a full-featured server-based solution.
Likewise, embedding a database engine in your app will significantly reduce the required setup and maintenance overhead, as you are decreasing external dependencies.
Also, by embedding your database natively into your app, you can theoretically improve security, as embedded databases usually do not feature server-based access to its data.

Basically, you'll really want to check out the sqlite site, as it features in-depth information about the strengths, weaknesses and application areas for embedded databases in general. Also, make sure to check out related wikipedia entries.


Share this post


Link to post
Share on other sites
I've read up on the SQLite website now, it does appear very accessible. I will check out the wiki links next as you suggest, thanks for that.

I will add my interest is the potential of a database transaction dialect to simplify AI programming. AI benefits from assessing a data-rich environment from many different perspectives, and C++ is very poor at expressing the sort of database-sifting that SQL makes look very simple by comparison. (This expressivity is important to me because of numerous rewrites required during development to find a good solution.) What I don't have is the experience to understand the real applicability of a relational database like SQLite to this task.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i think microsoft's sql everywhere is worth mentioning. a relational db that fits on a floppy (if you can still find one :)). few dlls, native and managed interface.. runs on win.ce up to vista.

Share this post


Link to post
Share on other sites
You may also want to look at Firebird. It is a pretty full featured database than can be deployed as a single dll with your application. It's free, open-source (very permissive license), and runs on just about any platform you want. I haven't done a lot with it, but it's worth looking at.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
well, there are pretty powerful template-based database access layers available for C++, so that you can basically write pretty much standards-oriented SQL statements directly in your SQL code, this works without pre-processing, everything is done thru templates, so there are obviously some minor differences-apart from that it's however pretty intutive, and lends itself for further abstraction using scripting languages.

So, you may want to check out the liteSQL project (note *lite*SQL NOT SQLite!!) for further information:

http://litesql.sourceforge.net

For alternative solutions, you may want to check out the references collected in the boost wiki, as there's an up2date collection of SQL wrapper C++ libraries, because it is considered to eventually provide a boost-based solution for providing SQL access (and possibly later on also SQL databases).

Share this post


Link to post
Share on other sites
Embedded databases are for applications where you want a database, but don't want to require 'heavy'(large, cpu/resource intensive) database servers - stand-alone database programs are typically not something you want to install on a machine that won't be doing mainly database serving. Smaller servers like mysql might not be so bad, but the big ones like Oracle are designed to run on machines they 'own', and you can definitely tell that the machine belongs to the DB server when you install it. It can also be a lot of pain to set up a database server with users etc, and it can be difficult to export the entire database to a single file for easy moving. With an embedded database, your application directly controls everything and you don't need to worry about settings, and they typically work with a small number of files that you application can easily package up if you want to copy the data elsewhere.

You can find several embeddable databases in my thread Free Small Stand-Alone DataBase?

[Edited by - Extrarius on October 5, 2006 6:13:53 PM]

Share this post


Link to post
Share on other sites
Extrarius, your topic is enlightening. Your lightweight preferences are very similar to mine, though I don't have to worry about locking (so far). Your application appears to be a very suitable transaction implementation for users. I am looking more at the transaction dialect as a tool for exploring search-space solutions for AI. My idea is that I could take the concepts for solutions to implementation for testing much quicker than with C structs. (This also means I'm thinking of the working database as transient, with tables generated on entry into the AI processing function and dropped on exit.) Does this sound reasonable?

litesql looks promising in the sense that it has natural integration with existing C++ applications!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by dgrantkp
litesql looks promising in the sense that it has natural integration with existing C++ applications!


litesql is indeed pretty cool, it allows you to define your database(object) structure using XML files, which are then compiled into C++ template code, so that you can easily access these databases using different backends (i.e. mySQL, SQLite, PostGres) directly in your C++ code using corresponding templates.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Quote:
Original post by dgrantkp
litesql looks promising in the sense that it has natural integration with existing C++ applications!


litesql is indeed pretty cool, it allows you to define your database(object) structure using XML files, which are then compiled into C++ template code, so that you can easily access these databases using different backends (i.e. mySQL, SQLite, PostGres) directly in your C++ code using corresponding templates.


Excellent. Thanks everyone.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
actually, liteSQL really isn't an embedded database in itself, rather it is mainly an object persistence framework based on relational databases, that is you can use various different relational databases as backends and basically use them as if they were object oriented databases.

Of course you CAN use an embedded database such as SQLite together with liteSQL, however ultimately liteSQL adds of course some overhead to your code and to the overall project due to the templating stuff and OODBMS/RDBMS mapping. So, while it is indeed very powerful and intuitive to use, if you're looking for using embedded databases, liteSQL probably isn't all that interesting. If however, you have a programming/database problem that lends itself to be accomplished in an OO fashion, but cannot afford the requirement for a a fully object oriented database (engine) (such as db4o), then using liteSQL is indeed an excellent option as it is highly interoperable (support for various backends, easy to add new backends) and extremely easy to get started, also the license is very liberal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this