Re: embedded postgresql

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: embedded postgresql
Дата
Msg-id 60llqk53vy.fsf@dev6.int.libertyrms.info
обсуждение исходный текст
Ответ на Re: embedded postgresql  ("Joshua D. Drake" <jd@commandprompt.com>)
Ответы Re: embedded postgresql  (jini us <jiniusuk@yahoo.co.uk>)
Список pgsql-general
jiniusuk@yahoo.co.uk (jini us) writes:
> So when the user starts my application I would start the database
> server, then stop it programmatically when the user stops using the
> application.

> I would obviously need some functionality so that I can programmatically
> configure which disk I would use to create the database. 

It is not necessary for PostgreSQL to be a "DLL" in order to all of do
these things.

Your application can configure where the database server is supposed
to find its data, and spawn the database server.

This came up a while back on the GnuCash discussion list, and I
described how you'd start up a 'pseudo-embedded' instance of
PostgreSQL:

<http://www.gnucash.org/pipermail/gnucash-devel/2003-June/009418.html>

Code to initialize and start up the database:
-----------------------------------------------------------------------
mkdir("~/GnuCash/DB");
system("initdb -d ~/GnuCash/DB");
[dribble a few changes into ~/GnuCash/DB/{pg_hba|postgres}.conf,
   notably turning on TCP/IP, picking a port #, probably not too
   much else...]
system("pg_ctl -D ~/GnuCash/DB start");
-----------------------------------------------------------------------

Code to stop it upon exiting the application:
-----------------------------------------------------------------------
system("pg_ctl -D ~/GnuCash/DB stop");
-----------------------------------------------------------------------

I daresay I was a just little bit dogmatic about it, and the approach
was not accepted particularly graciously...

<http://www.gnucash.org/pipermail/gnucash-devel/2003-June/009449.html>

-------------------------------------------------------------------
Derek Atkins wrote:
> Christopher Browne <gnucash at cbbrowne.com> writes:
>
> > It seems no more reasonable to expect that casual home users have to:
> >
> >  - Run mke2fs, or whatever else is involved in setting up filesystems;
> >  - Run whatever frightening incantations are involved in getting X
> >    working.
>
> If this is how you feel then you are grossly over-estimating the
> competence and skillset of the average user.  Most users grab the
> Red Hat install media and click "go".  They have no clue what mke2fs
> is.  They have no clue how to set up X.

It nonetheless happens, does it not?  They _do_ have to cope with it,
in some manner, because X and ext2 don't get there by magic.

Reciting some mantra of "embedded database, embedded database" will
also not lead to the system being simpler just because it gets
repeated enough times.

... much elided ...

But none of that changes the vital points, that
 - The "embedded" process belongs to the user;
 - So do the files;
 - It does NOT forcibly require a sysadmin's attentions.
-------------------------------------------------------------------

> I am hoping to be able to create the database on a virtual drive /
> network drive programmatically from my application.

So long as you can run the program:

  pg_ctl -D X:\WHEREVER_THE_DATA_IS start

there oughtn't be a problem with doing this.

It is a little bit disappointing that people _haven't_ documented the
use of this sort of approach to have PostgreSQL be 'quasi-embedded' in
such a manner that the database instance is not made manifestly
visible.
--
"aa454","@","freenet.carleton.ca"
http://cbbrowne.com/info/rdbms.html
Why  are  there  flotation   devices  under  plane  seats  instead  of
parachutes?

В списке pgsql-general по дате отправления:

Предыдущее
От: Troels Arvin
Дата:
Сообщение: Storage consumption
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: More Praise for 7.4RC2