Wednesday 14 June 2017

postgis - Connect to PostgreSQL localhost in QGIS


I am fairly new to actively work with databases. I wanted to try out some stuff on my home computer where I have installed pgAdmin and PostgreSQL previously. I can connect to my localhost in pgAdmin but I can't do the same in QGIS. I just get an error message saying:



"Connection failed -  Check settings and try again"

I am new in this game and don't really know where to look for solutions. My database connection info is standard settings:


Name: postgres
Host:Localhost
Port:5432
Database:test

Any ideas what could be wrong?



Answer




I'll add an answer with a screenshot, as it will be easier to look at for reference.


Here is an example with the absolute minimum you would have to enter. It would connect to a database called twitter, and I would name that connection twitterDB. Note that it does not matter how you name the connection; this is just a name you give to your connection so you can refer to it later on (see last screenshot).


enter image description here


And here a screenshot of the actual database I am connecting to:


enter image description here


In QGIS your connection would show up like this:


enter image description here


Hit the Connect button, and if it worked, the Schema area will be populated, where you can then navigate to your tables.


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...