On 11/05/2012 12:33 PM, Scott Marlowe wrote:
> On Fri, Nov 2, 2012 at 11:11 PM, Hernán Cano Martínez
> <jhernancanom@hotmail.com> wrote:
>> Hi, boys.
>> I am interested in the way of implement PostgreSQL in my apps --if
>> possible-- in a native way.
>> I am in a project that use C++ as the base programming-language.
> If you want an embedded db, you'd likely do better looking elsewhere.
> PostgreSQL's design does not lend itself to embedded work. SQLite is a
> good choice there.
Agreed. For small DBs or apps that must be portable, PostgreSQL isn't a
great choice, and it's utterly unsuitable if you want to embed the
database in-process. For that you want SQLite or Firebird.
In particular, I strongly advise you not to bundle the EnterpriseDB
installer in an application as a silent install. The poor user will
wonder where this "PostgreSQL" thing came from and might just uninstall
it. Or they might try to use it and wonder why they don't know the
passwords. They might even try to install another package that bundles
PostgreSQL, or directly install PostgreSQL for their own use, and find
out that they can't because your app has already installed it.
The standard installer version doesn't like having the data directory
moved around or having permissions messed with, doesn't like the service
account password being changed (pre-9.2), etc. It's really not ideal for
bundling in an application.
If you want to use PostgreSQL, consider distributing the .zip binaries
without the installer. Start PostgreSQL on demand with `pg_ctl` or by
installing your own service in Windows services / launchd / systemd /
etc. Run PostgreSQL on a non-standard port so you don't conflict with
any installs the user may do themselves. You'll need to check for some
common problems like the user trying to put the data directory on a
FAT32 volume, which isn't supported, but that isn't hard.
--
Craig Ringer