views:

3137

answers:

6

If it's possible, I'm interested in being able to embed a PostGreSQL database, similar to sqllite. I've read that it's not possible. I'm no database expert though, so I want to hear from you.

Essentially I want PostGreSQL without all the configuration and installation. If it's possible, tell me how.

+4  A: 

Instead of literally embedding it, could you install it alongside your program and only run it while your program is running?

Cody Brocious
+2  A: 

PostgreSQL is intended to run as a stand-alone server; it's probably possible to embed it if you hack at it hard and long enough, but it would be much easier to just run it as intended in a separate process.

John Millikin
+5  A: 

You cannot embed it, nor should you try.

For embedding you should use sqlite as you mentioned or firebird rdbms.

Brian R. Bondy
I recommend Firebird
Hugues Van Landeghem
+2  A: 

Unless you do a major rewrite of code, it is not possible to run Postgres "embedded". Either run it as a separate process or use something else. SQLite is an excellent choice. But there are others. MySQL has an embedded version. See it at http://mysql.com/oem/. Also several java choices, and Mac has Core Data you can write too. Hell, you can even use FoxPro. What OS you on and what services you need from the database?

Crag
We already have an application that uses PGSQL (Windows XP), - I don't know what the ramifications of switching to a different database - but I assumed they would be less significant if there was an embedded version of PGSQL.
pc1oad1etter
The environment is Windows XP, and one of the biggest concerns is that the environment's policies requires extra hoops to jump through if an new package is being installed, whereas simply dropping a zero-config, no installation file on it would be simpler.
pc1oad1etter
+2  A: 

You can't embed it as a in process type thing like sqlite etc, but you can easily embed it into your application setup using Inno setup at http://www.innosetup.org. Search their mailing list archive and you will find someone did most of the work for you and all you have to to is grab the zipped distro and you can easily have postgresql installed when the user installs your app. You can then use the pg_hba.conf file to restrict the server to local host only. Not a true embedded DB, but it would work.

A: 

Anyone tried on Mac OS X:

http://pagesperso-orange.fr/bruno.gaufier/xhtml/prod_postgresql.xhtml

http://www.macosxguru.net/article.php?story=20041119135924825

(Of course sqlite would be my embedded db of choice as well)