2

I created new database called "shashi" in PgAdmin III. In QGIS to create new connection I entered following details.

In PostgreSQL 9.5 pgAdmin lll Please enter password for user postgres on server PostgreSQL 9.5: ****

In QGIS Create a New PostGIS Connection Name: shashidhar Service: Host: localhost Port: 5432 Database: postgres SSL mode: disable

Authentication Username: postgres Password: **** (same password that I used in pgAdmin lll to connect to the server )

Test connection ERROR: Connection failed-consult message log for details

1
  • I am completely new to databases.
    – Shashi
    May 2, 2016 at 0:26

2 Answers 2

2

It looks like you have confused the username and the database name.

If you created a database called shashi, you should have Database: shashi in the QGIS PostGIS Connection window. Your username is likely postgres.

If that doesn't work, look in the message log. My logs are in /usr/local/pgsql/var/, but they may be somewhere else on your machine.

3
  • Also...If your PG database & QGIS installed in different PC then you have to grant your IP (QGIS PC IP) @ POSTGIS pg.hba conf file to get full DB access... May 2, 2016 at 6:02
  • Yes, I tried with Database: Shashi in the QGIS PostGIS connection window and username: postgres, Still unable to connect to the database.
    – Shashi
    May 8, 2016 at 19:30
  • Can you post your message log? Also try the CREATE EXTENSION POSTGIS as lejedi76 suggests.
    – amball
    May 14, 2016 at 2:46
2

You can not connect to your database in Qgis if your dB is not spatial. Please run CREATE EXTENSION POSTGIS; on your db in pgadminIII and Retry to connect

2
  • Can you Please give steps of where to write that query "CREAT EXTENSION POSTGIS;
    – Shashi
    May 8, 2016 at 19:31
  • Do you have pgadmin3 installed? Simply open a query and execute CREATE EXTENSION postgis;. Have a look at this tutorial if you've never used pgadmin: youtube.com/watch?v=YHXLNtiCI1U
    – amball
    May 14, 2016 at 2:44

Your Answer

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

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