8

I have installed PostgreSQL and PostGIS on my laptop (Win 7 64 bit OS). I am running QGIS 1.8.0 on my machine .

When I am trying to connect Postgis I am getting connection failed error then I tried following things :

Details:

Port :5433 User name : postgres Password :postgres

  1. I checked the pg_hba.conf file (All default settings)

  2. Restart the PostgreSQL service and tried

  3. I have reinstalled PostsreSQL and getting same error.

  4. Tried using empty fields while connecting still getting an error. (Not sure what to put in service field..tried using postgres and postgresql)

  5. My firewall is disabled.

  6. The database PostgreSQL (version 9.2) is installed on my local machine also postgis (version 2.0.3-2) installed on my machine and both are for 64 bit setups.

7.Should I try lower version of Postgresql with qGIS ??

Screenshot 1 screenshot 2

Researching on Google also and found similar bugs related to connection issue(not sure)

7
  • I have postgresql 9.1 and postgis 2.0 on Linux up and running. Maybe you really should downgrade postgresql. Check your QGIS ability to connect postgis here: host: gis-lab.info; port 5432; database: osm_shp; ssl: disable; username: guest; password: guest. Have patience - there are a lot of data. Don't know which pogtresql/gis versions there. Commented Mar 27, 2013 at 19:31
  • Have you installed postgis into your database or created it from the postgis template? If not, your connect will fail.
    – gsherman
    Commented Mar 27, 2013 at 21:11
  • What does the pg_hba.conf entry for "local" say? Is it using peer, ident or md5 for authentication?
    – SaultDon
    Commented Mar 27, 2013 at 21:41
  • @gsherman I have installed postgis into my data base and while installing only default option was selected
    – Sunil
    Commented Mar 28, 2013 at 6:28
  • @SaultDon Its md5
    – Sunil
    Commented Mar 28, 2013 at 6:31

7 Answers 7

4

I am not sure if it matters, but for me, Postgis 1.5 and Postgres 9.0 (x86) are talking to QGIS 1.8.0 without problems.

QGIS is still 32-bit, even on Windows 7 64-bit machines. Give the x86 version a try, and the old postgis version.

2
  • Thanks for the reply It works perfectly on my machine and wondering that this issue will be fix in upcoming 2.0 version also I am not able to find such document that will check qgis 1.8.0 and PostgreSQL compatibility.. thanks once again : )
    – Sunil
    Commented Mar 28, 2013 at 17:56
  • 1
    64-bit support is still on the wish list, because all dependent packages have to be compiled with 64-bit support. I'm glad that the 32-bit is still working ;-)
    – AndreJ
    Commented Mar 29, 2013 at 16:04
4

You must confirm the database is PostGIS not PostGres

Go to pgAdmin and view your database. Open and view the DB and besides "Schemas" there will be a count of schemas available. If it says "Schemas (1)" it's probably only a PostGres DB. Inside "Schemas" there should be an entry for "topology." If there is no topology it is not a spatial database (PostGIS) and therefore will not be visible in QGIS.

3

I don't know if this will help but....

I have only just started on this but I found that "localhost" would not resolve on my PC which has similar config/versions to yours. I replaced it with 127.0.0.1 and I got a successful connection.

1
  • Thanks for the answer . I tried that one but it was not working.
    – Sunil
    Commented May 14, 2013 at 8:00
2

I had this problem recently as well. What worked for me is:

  1. leaving the host field blank. "localhost" refers to connecting to your local machine via IP, which I don't believe is what you want.
  2. look in your postgresql.conf file for

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

    and make sure that it is an '*', this will ensure it can find your local connection

  3. check your pg_hba.conf file and make sure your authentication permissions are set correctly for the "local" entry

Edit: Here's a link to my similar question on Database Administrators.

2
  • I tried your way but it not worked : (
    – Sunil
    Commented Mar 28, 2013 at 17:54
  • 1
    thanks for the link. I will look into it still wondering why it was not connecting..BTW I have resolved problem by installing 32 bit software as per @Andre Joost answer.. thanks for providing additional information : )
    – Sunil
    Commented Mar 29, 2013 at 6:16
2

The answer is in a post 5 years later, last revised 4 years later! I found it regarding "QGIS Ticket #930". What you MUST do: ONLY check the SAVE username & password in the dialog defining your connection. THAT'S ALL. It worked suddenly for me and I am pretty sure will do for you. My env.: Windows 7 Pro/QGIS 1.8/PostgreSQL 9.2/PostGIS 2.0.2/All of them 64 bits.

1
  • thanks for the answer. I will look into it and let you know..thanks
    – Sunil
    Commented Jul 29, 2013 at 5:04
0

You use the port 5433, but the standard port is 5432. Maybe control it.

2
  • Are you able to expand upon this as an answer because it looks more a comment/suggestion rather than something issued with confidence.
    – PolyGeo
    Commented May 14, 2013 at 10:47
  • @PolyGeo Actually I tried those previously & I tried Andre Joost workaround and it works for me perfectly : ) So if possible please protect this question.
    – Sunil
    Commented May 15, 2013 at 8:15
-1

Install the latest version and reconnect

1
  • Could you explain why this would fix the problem
    – Bera
    Commented Jan 31, 2021 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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