Unix Technical Forum

Starting PostgreSQL from a windows application

This is a discussion on Starting PostgreSQL from a windows application within the pgsql Admins forums, part of the PostgreSQL category; --> Hello, I have installed Postures on a Windows server and it starts as a service and all is OK. ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 07:26 AM
Hovik Avedian
 
Posts: n/a
Default Starting PostgreSQL from a windows application

Hello,

I have installed Postures on a Windows server and it starts as a service and all is OK.

I have 2 questions:

1.I need to be able to wrap PostgreSQL as part of my application and, therefore, start it as part of my app. start-up. I know that pg_ctl start is the command, but as your documentation clearly states, PostgreSQL can only be started by a non-privileged user. Here lies my problem.
Most software needs a privileged user to start it. So how can I start PostgreSQL as a different user from the one which needs to be logged in to start the other software?

2. How do I give my users a totally new database. Is backup/restore the only mechanism?
Can I copy (parts of) the data directory, from one installation of PostgreSQL to another?

Thanks in advance for your support,

Hovik Avedian
Senior Consultant
Ebase Technology Ltd.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 07:26 AM
Andy Shellam
 
Posts: n/a
Default Re: Starting PostgreSQL from a windows application

Hi Hovik:
> Hello,
>
> I have installed Postures on a Windows server and it starts as a
> service and all is OK.
>
> I have 2 questions:
>
> 1. I need to be able to wrap PostgreSQL as part of my application and,
> therefore, start it as part of my app. start-up. I know that pg_ctl
> start is the command, but as your documentation clearly states,
> PostgreSQL can only be started by a non-privileged user. Here lies my
> problem.
> Most software needs a privileged user to start it. So how can I start
> PostgreSQL as a different user from the one which needs to be logged
> in to start the other software?

You would need the commands to start and stop a Windows service ("net
start <ServiceName>" I believe). Does it really matter that PostgreSQL
is running while the application isn't?
>
> 2. How do I give my users a totally new database. Is backup/restore
> the only mechanism?
> Can I copy (parts of) the data directory, from one installation of
> PostgreSQL to another?

NO!! Never touch the raw PostgreSQL data files. You could, as part of
your application, build in an SQL script of your DB schema, created by
"pg_dump --schema-only" that gets run through psql, or piped to an
Npgsql .NET library, ODBC connection or other technology.
>
> Thanks in advance for your support,
>
> Hovik Avedian
> Senior Consultant
> Ebase Technology Ltd.
>
>
> !DSPAM:14,44c7a9ac143291148420564!


--
Andy Shellam <mailto:andy.shellam@mailnetwork.co.uk>,
the Mail Network <http://www.mailnetwork.co.uk/>

NetServe Support - we don't go the extra mile; we go the whole distance!

p: (+44) 0 845 838 0879 / +44 0 7818 000834
w: www.mailnetwork.co.uk <http://www.mailnetwork.co.uk/>
e: support@mailnetwork.co.uk <mailto:support@mailnetwork.co.uk>




---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:52 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com