could not connect to server "postgres_someDB"

Category: azure database for postgresql

Question

Aravindmandapaka on Thu, 05 Dec 2019 23:57:57


Working on Azure PostGresSQL, trying to import a table present in another database of postgres from a diferrent database.

bBoth the databases are on same server.

create EXTENSION postgres_fdw;

CREATE SERVER postgresPtDB FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'xxxxxazure.com', dbname 'Product', port '5432');
CREATE USER MAPPING FOR xxxx SERVER postgres_PtDB OPTIONS (user 'xxxx'password 'dxxxx');
IMPORT FOREIGN SCHEMA rw limit to (abc) FROM SERVER postgres_PtDB INTO rw;
CREATE foreign TABLE "abcde"
(
    

".

.

.

.

.

)

SERVER postgres_PtDB;

Till this point all the statements worked perfect and even created table since i can see it if I expand the database.

But, when I do this I see the error could not connect to server "postgres_ptdb"

select*from "abcde"

Any leads is appreciated. Thanks :)

  

Replies

Mike Ubezzi (Azure) on Fri, 06 Dec 2019 03:38:55


Hi Aravind,

I see that the postgres_ptdb extension v. 1.0 is supported: PostgreSQL extensions in Azure Database for PostgreSQL - Single Server

But what I would like to verify is if you have the network access from Azure services enabled: Connecting from Azure

There should be the ability to enable Azure services to connect to your PostgreSQL instance. Please verify that this is enabled.

~Mike

Aravindmandapaka on Fri, 06 Dec 2019 14:41:35


Hello Mike, 

Yes, The access has been enabled already and still I had encountered the above problem.

The server I am connecting to is something like this "somename.postgres.database.azure.com"

Thanks,

Aravind

Mike Ubezzi (Azure) on Mon, 09 Dec 2019 19:11:32


Could you try something for me. Please do the following:

  1. Perform an nslookup somename.postgres.database.com (from a cmd prompt)
  2. Take the resulting IP Address and add that to the Allow List

If the above does not resolve this issue, I can have this issue investigated further by enabling a one-time incident ticket if you currently do not have an Azure Support Plan.

Regards,

Mike

Mike Ubezzi (Azure) on Fri, 13 Dec 2019 17:51:28


Please let me know if you need further assistance for this issue.

Regards,

Mike

Kalyan Chanumolu-MSFT on Fri, 20 Dec 2019 02:38:55


Just checking in to see if the above answer(s) helped.

 

If this answers your query, do click “Mark as Answer” and Up-Vote for the same which might be beneficial to other community members reading this thread .

And, if you have any further query do let us know.