Connect to server PG from laptop java app

Started by Jennifer Treyabout 17 years ago9 messagesgeneral
Jump to latest
#1Jennifer Trey
jennifer.trey@gmail.com

Hi, I am trying to create my DB schema on the server through my development
laptop.
I have installed Web Server 2008 and PostgreSQL. They are both running. For
some reason its not working. Do I need to open some firewall ports?
PostgreSQL runs on 5432. ( I think I did that though). Do I need to
configure PG somehow as well?

Thanks / Jennifer

#2Jennifer Trey
jennifer.trey@gmail.com
In reply to: Jennifer Trey (#1)
Re: Connect to server PG from laptop java app

no pg_hba entry for host 85.235.... user postgres, database xxx .. ssl off
...
?? I guess that means that I need to set up pg then..

how is the question now :)

/ Jen

On Sun, Apr 5, 2009 at 8:35 PM, Raymond O'Donnell <rod@iol.ie> wrote:

Show quoted text

On 05/04/2009 19:28, Jennifer Trey wrote:

Hi, I am trying to create my DB schema on the server through my

development

laptop.
I have installed Web Server 2008 and PostgreSQL. They are both running.

For

some reason its not working. Do I need to open some firewall ports?
PostgreSQL runs on 5432. ( I think I did that though). Do I need to
configure PG somehow as well?

What does it say in the postgres logs?

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In reply to: Jennifer Trey (#2)
Re: Connect to server PG from laptop java app

On 05/04/2009 19:52, Jennifer Trey wrote:

no pg_hba entry for host 85.235.... user postgres, database xxx .. ssl off

Ah... you need to edit pg_hba.conf and add an entry for the client to
allow it access.

The documentation in the file itself is pretty good, and there's more here:

http://www.postgresql.org/docs/8.3/static/auth-pg-hba-conf.html

HTH,

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In reply to: Jennifer Trey (#2)
Re: Connect to server PG from laptop java app

On 05/04/2009 19:52, Jennifer Trey wrote:

no pg_hba entry for host 85.235.... user postgres, database xxx .. ssl off
...

I meant to add too that pg_hba.comf is found in the top level of your
PostgreSQL data directory.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

#5ries van Twisk
pg@rvt.dds.nl
In reply to: Jennifer Trey (#1)
Re: Connect to server PG from laptop java app

On Apr 5, 2009, at 1:28 PM, Jennifer Trey wrote:

Hi, I am trying to create my DB schema on the server through my
development laptop.

I have installed Web Server 2008 and PostgreSQL. They are both
running. For some reason its not working.

Define : "it's"

Do I need to open some firewall ports?

maybe, please use some network probe tool (telnet even!!)

PostgreSQL runs on 5432. ( I think I did that though).

Yes

Do I need to configure PG somehow as well?

properly...

Please read the docs on how to setup PG tfor remote access.
If you use a search engine please search for pg_hba.conf.

I don't know what Web Server 2008 and can't help you there,

Ries

Show quoted text

Thanks / Jennifer

#6Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Jennifer Trey (#1)
Re: Connect to server PG from laptop java app

On Sunday 05 April 2009 11:28:09 am Jennifer Trey wrote:

Hi, I am trying to create my DB schema on the server through my development
laptop.
I have installed Web Server 2008 and PostgreSQL. They are both running. For
some reason its not working. Do I need to open some firewall ports?
PostgreSQL runs on 5432. ( I think I did that though). Do I need to
configure PG somehow as well?

Thanks / Jennifer

This begs several questions, but first let me see if I can sketch out the
layout.

Laptop(OS ?) <--> App(Java) <--> WebServer 2008(Windows) <--> Postgres(Version?)

Questions:
1) Is logging enabled at the various points in the chain and if so what do the
logs say?
2) Is there an authentication mechanism and if so, is the correct information
being passed through the chain?
3) Do you have network connectivity outside this above chain i.e can you ping
the server from the laptop?

--
Adrian Klaver
aklaver@comcast.net

#7Johan Nel
johan555.nel555@xsinet555.co.za
In reply to: Jennifer Trey (#1)
Re: Connect to server PG from laptop java app

Jennifer,

Jennifer Trey wrote:

Hi, I am trying to create my DB schema on the server through my
development laptop.

I have installed Web Server 2008 and PostgreSQL. They are both running.
For some reason its not working. Do I need to open some firewall ports?
PostgreSQL runs on 5432. ( I think I did that though). Do I need to
configure PG somehow as well?

Default PG installation is setup to work only on localhost or 127.0.0.1

You need to edit your pg_hba.conf file too. Look for the lines:
# IPv4 local connections:
host all all 127.0.0.1/32 md5

Add a line below that depending the IP address range that you want to
connect from, similar to:
host all all 10.0.0.1/8 md5

Remember to reload your configuration.

HTH,

Johan Nel
Pretoria, South Africa.

#8Colin Streicher
colin@obviouslymalicious.com
In reply to: Johan Nel (#7)
Re: Connect to server PG from laptop java app

Also, I don't know if this applies to windows systems, but on linux systems
you have to also modify postgresql.conf
On my system, it is in the same directory as pg_hba.conf
looks like this:

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '192.168.1.101' # what IP address(es) to
listen on;

The address here is mine, it is set to localhost or 127.0.0.1 by default

Show quoted text

On Sunday 05 April 2009 15:27:14 Johan Nel wrote:

Jennifer,

Jennifer Trey wrote:

Hi, I am trying to create my DB schema on the server through my
development laptop.

I have installed Web Server 2008 and PostgreSQL. They are both running.
For some reason its not working. Do I need to open some firewall ports?
PostgreSQL runs on 5432. ( I think I did that though). Do I need to
configure PG somehow as well?

Default PG installation is setup to work only on localhost or 127.0.0.1

You need to edit your pg_hba.conf file too. Look for the lines:
# IPv4 local connections:
host all all 127.0.0.1/32 md5

Add a line below that depending the IP address range that you want to
connect from, similar to:
host all all 10.0.0.1/8 md5

Remember to reload your configuration.

HTH,

Johan Nel
Pretoria, South Africa.

#9Jasen Betts
jasen@xnet.co.nz
In reply to: Jennifer Trey (#1)
Re: Connect to server PG from laptop java app

On 2009-04-05, Johan Nel <johan555.nel555@xsinet555.co.za> wrote:

Jennifer,

Jennifer Trey wrote:

Hi, I am trying to create my DB schema on the server through my
development laptop.

I have installed Web Server 2008 and PostgreSQL. They are both running.
For some reason its not working. Do I need to open some firewall ports?
PostgreSQL runs on 5432. ( I think I did that though). Do I need to
configure PG somehow as well?

Default PG installation is setup to work only on localhost or 127.0.0.1

No. The default is localhost only. if you need 127.0.0.1 you may need to add
it.

Operating systems are moving to IP6 and a recent windows(?) update saw
localhost move to ::1 (from 127.0.0.1) for me this broke some things
that were expecting to find postgres on 127.0.0.1