Обсуждение: Help me start postmaster on a default installation of PostgreSQL.

Поиск
Список
Период
Сортировка

Help me start postmaster on a default installation of PostgreSQL.

От
Lord Voldemort
Дата:
Hi!
I'm running Ubuntu 10.10 and I have installed PostgreSQL and JDBC
drivers form the repository. I have not changed any default settings. I
want to run the postmaster service to access database from a Java
program. I've read around a bit about and it has not helped. I don't
want to go in great depth about how to do this because right now I'm
focusing on learning Java and I don't really have enough time to read
hundreds of pages of docs.

I've added /usr/lib/postgresql/8.4/bin to my PATH variable.

Command "pg_ctl start" or "postmaster" gives an error about not being
able to find "postgresql.conf" in the directory specified by PGDATA or
my home folder if it's blank.

I found this file (postgresql.con) in /etc/postgresql/8.4/main/ and
created a shortcut to it in my home folder.

Now I'm getting error

2011-07-06 09:56:57 GMT FATAL:  data directory
"/var/lib/postgresql/8.4/main" has wrong ownership
2011-07-06 09:56:57 GMT HINT:  The server must be started by the user
that owns the data directory.

This data directory is owned by postgres.

I read somewhere that this postmaster has to be run by the user postgres
but I don't know how to do that.

Apart from that my installation is working fine. I've already created a
user for myself and a small trial  database too.

Please help me.

Re: Help me start postmaster on a default installation of PostgreSQL.

От
"Kevin Grittner"
Дата:
Lord Voldemort <murderthemuggles@yahoo.co.in> wrote:

> I'm running Ubuntu 10.10 and I have installed PostgreSQL and JDBC
> drivers form the repository.

What repository do you mean?  Ubuntu's?

> I have not changed any default settings.

> Command "pg_ctl start" or "postmaster" gives an error about not
> being able to find "postgresql.conf" in the directory specified by
> PGDATA or my home folder if it's blank.

If you used Ubuntu's version, shouldn't you be using the `service`
command to control it?  I'm not sure what version comes with 10.10,
but on my older kubuntu machine, it's:

sudo service postgresql-8.4 start

> Apart from that my installation is working fine. I've already
> created a user for myself and a small trial  database too.

Without successfully starting the database server???

If the above suggestion doesn't help, please read this and post a
more detailed message:

http://wiki.postgresql.org/wiki/Guide_to_reporting_problems

It's easier for people to help if your post isn't such a, er,
Riddle....   ;-)

-Kevin

Re: Help me start postmaster on a default installation of PostgreSQL.

От
Maciek Sakrejda
Дата:
Also, since your post is not really jdbc related, you may want to try
the pgsql-general list.
---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com

Re: Help me start postmaster on a default installation of PostgreSQL.

От
Lord Voldemort
Дата:
I've sorted out things myself.

Firstly IMHO this list is the appropriate place for my query as you'd see that what I really want is to use JDBC with PostgreSQL. Running postmaster was supposed to be a way to accomplish that.

But as it turns out, newer versions of PostgreSQL have done away with postmaster completely. After default installation nothing needs to be changed. Services necessary for backend database access are started automatically at boot-up. After installing libpg-java (that's the JDBC driver package for postgreSQL) all that needs to be done is to add /usr/share/java/postgresql.jar to the java library. I use NetBeans so that was easy for me. I don't know how to do that when running applications from command line using "java classname" though.

If you'd still maintain that I'm posting at the wrong place, please forgive me 'coz I was ill-advised and I'm not so bright either ;-)

Cheers!!

Re: Help me start postmaster on a default installation of PostgreSQL.

От
Craig Ringer
Дата:
On 7/07/2011 6:36 PM, Lord Voldemort wrote:
> I've sorted out things myself.
>
> Firstly IMHO this list is the appropriate place for my query as you'd
> see that what I really want is to use JDBC with PostgreSQL. Running
> postmaster was supposed to be a way to accomplish that.
>
> But as it turns out, newer versions of PostgreSQL have done away with
> postmaster completely.

Say what?

No, there's still a postmaster. You wouldn't ever be invoking it
directly, though; you use pg_ctl to control PostgreSQL if you installed
from source or from the EnterpriseDB packages. For distro packages of
PostgreSQL you use your distro's service management mechanism: the
"service" command, /etc/init.d/ scripts, etc.

If you're using distro packages of PostgreSQL, stick to the distro's
management methods.

> After default installation nothing needs to be
> changed. Services necessary for backend database access are started
> automatically at boot-up.

Note that PostgreSQL probably only listens on 127.0.0.1 or it may have
TCP/IP disabled so it only uses UNIX sockets. You may need to alter
postgresql.conf if you want to listen on other interfaces.

> After installing libpg-java (that's the JDBC
> driver package for postgreSQL) all that needs to be done is to add
> /usr/share/java/postgresql.jar to the java library. I use NetBeans so
> that was easy for me. I don't know how to do that when running
> applications from command line using "java /classname/" though.

Use the -classpath argument to the JVM.

Typically, though, you bundle the PostgreSQL JDBC driver within your
executable JAR and run it with "java -jar myapp.jar", using a
Main-class: entry in META-INF/MANIFEST.MF to tell Java what the entry
point class is. This is all basic Java stuff and has nothing to do with
PostgreSQL, though.

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088     Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

Re: Help me start postmaster on a default installation of PostgreSQL.

От
Radosław Smogura
Дата:
 On Thu, 07 Jul 2011 20:04:33 +0800, Craig Ringer wrote:
> On 7/07/2011 6:36 PM, Lord Voldemort wrote:
>> I've sorted out things myself.
>>
>> Firstly IMHO this list is the appropriate place for my query as
>> you'd
>> see that what I really want is to use JDBC with PostgreSQL. Running
>> postmaster was supposed to be a way to accomplish that.
>>
>> But as it turns out, newer versions of PostgreSQL have done away
>> with
>> postmaster completely.
>
> Say what?
>
> No, there's still a postmaster. You wouldn't ever be invoking it
> directly, though; you use pg_ctl to control PostgreSQL if you
> installed from source or from the EnterpriseDB packages. For distro
> packages of PostgreSQL you use your distro's service management
> mechanism: the "service" command, /etc/init.d/ scripts, etc.
>
> If you're using distro packages of PostgreSQL, stick to the distro's
> management methods.
>
>> After default installation nothing needs to be
>> changed. Services necessary for backend database access are started
>> automatically at boot-up.
>
> Note that PostgreSQL probably only listens on 127.0.0.1 or it may
> have TCP/IP disabled so it only uses UNIX sockets. You may need to
> alter postgresql.conf if you want to listen on other interfaces.
>
>> After installing libpg-java (that's the JDBC
>> driver package for postgreSQL) all that needs to be done is to add
>> /usr/share/java/postgresql.jar to the java library. I use NetBeans
>> so
>> that was easy for me. I don't know how to do that when running
>> applications from command line using "java /classname/" though.
>
> Use the -classpath argument to the JVM.
>
> Typically, though, you bundle the PostgreSQL JDBC driver within your
> executable JAR and run it with "java -jar myapp.jar", using a
> Main-class: entry in META-INF/MANIFEST.MF to tell Java what the entry
> point class is. This is all basic Java stuff and has nothing to do
> with PostgreSQL, though.
 ...and for more advanced tasks use urlclassloader, refer to JavaDoc.

 Regards,
 Radek

> --
> Craig Ringer
>
> POST Newspapers
> 276 Onslow Rd, Shenton Park
> Ph: 08 9381 3088     Fax: 08 9388 2258
> ABN: 50 008 917 717
> http://www.postnewspapers.com.au/