I'm trying to connect to a Heroku PostgreSQL instance using the npgsql
NuGet package. I've a problem with the connection string – the hostname gets replaced with my computer's public IP (see the screenshot below). An exception gets thrown in the Open()
method of the NpgsqlConnection
stating that the host doesn't exist. The rest of the parameters specified in the string (username, password and the database used) get recognized correctly.
I've tried using Host
, Server
and server
instead of host
but that doesn't seem to change anything. The database is up and running as I can connect to it using DataGrip with the same connection details.
Thanks!
CodePudding user response:
The error you are seeing is from the database, not the library. It is saying that pg_hga.conf
doesn't have an entry to allow your ip address to have access. You can read more about this file here:
https://www.postgresql.org/docs/current/auth-pg-hba-conf.html