Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I"m just getting started with PostgreSQL/PostGIS db (v9.2) and I'm wanting to connect to db while not on the localhost using QGIS. I've been able to connect successfully on localhost, however I'm not sure what I need to do to make this non localhost connection. I'm able to ping the db server from my desktop.

In pgAdmin within the db properties I defined the following privileges:

enter image description here

Then in QGIS here are my connection settings (using postgres username/password, but logged in as my domain user):

enter image description here

I've tried searching the web for this, however all the hits are just coming up with examples of how to connect on localhost. I'm thinking maybe I have to add my domain info as user login?

Thanks

share|improve this question
add comment

3 Answers

HOST should be the IP of the POSTGIS/Postgres Location

on Windows you can do ipconfig to get the v4 ip something like 192.0.168.101

You need to allow connections to this server in postgres pg_hba.conf

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

firewalls also need to be adjusted to accommodate successful connections.

You can use the Trust switch

host    all         all         192.168.0.101/32        trust

http://stackoverflow.com/questions/1406025/no-pg-hba-conf-entry-for-host

share|improve this answer
add comment

The defaults for Postgres don't allow remote connections. To allow remote connections you'll need to modify the pg_hba.conf and postgresql.conf files on your sever.

Here's a quick how to on which settings need to be changed in which config files:

http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html

share|improve this answer
    
For my 9.2 version, there are two pg_hba.conf files one in \9.2\data and in \9.2\share. Do I edit both, or just one of these files? –  artwork21 Apr 18 '13 at 15:54
    
the file in \data should be the file Postgres is reading so edit that one. –  HeyOverThere Apr 18 '13 at 16:32
add comment

First, edit postgresql.conf file so that the server will listen to any address:

  1. In pgAdmin (after connected to your server as postgres or any super user): select menu 'Tools -> Server Configuration -> postgresql.conf'
  2. Double click on 'listen_addresses' line and change 'value' to '*'
  3. Press the 'Save' button , then 'Reload Server to apply configuration changes'
  4. Close the Backend Configuration Editor window.

Edit pg_hba.conf file to allow postgres to connect to your databases.

  1. In pgAdmin select menu 'Tools -> Server Configuration -> pg_hba.conf'
  2. Create a new line or modify an existing line so that its content like the following highlighted (orange) line:enter image description hereWith this line, user postgres can connect to any database (all) from any ip address (0.0.0.0/0) with md5 method (enter username and password).
  3. Save, Reload and close the window.

Now you can connect to your database from Qgis like you've done in your question.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.