Question

Whats the correct setting in my app.config file to ensure connection to my managed postgresql database

Posted January 6, 2022 94 views
UbuntuPostgreSQLDatabasesUbuntu 20.04

I have just imported my database into my postgresql managed database

Specified connection string is as below. (I have put ?? temporarily for password)

username = doadmin
password = ??
host = crystalclouddb-do-user-1920042-0.b.db.ondigitalocean.com
port = 25060
database = crystal
sslmode = require

I am now trying to set above up in my app.config file .
I have 3 options below.

OPTION 1 (Connection to local Db on my PC) Worked Fine
<add name=“CRYSTALAPPZ” connectionString=“Host = 127.0.0.1; Database = tournaments; Port = 5432; Username = postgres; Password = manager ”/>

OPTION 2 (Connection to Managed Db on Digital Ocean) Did not Work
<add name=“CRYSTALAPP” connectionString=“host = 68.183.192.130; database = crystal; port = 25060; username = doadmin; Password = wAFtPnmnwV6bFVRP” />

OPTION 3 (Connection to Managed Db on Digital Ocean) Did not Work
<add name=“CRYSTALAPPX” connectionString=“Host = crystalclouddb-do-user-1920042-0.b.db.ondigitalocean.com; Database = crystal; Port = 25060; Username = doadmin –set=sslmode=require –set=sslrootcert=c:\crystal\images\ca-certificate.crt” />

I have not been able to connect to my managed database . It reports a connection problem even though OPTION 1 works for local Database.

Option 2 specified the IP of my Droplet as host (Is this correct)

Option 3 specified host as in parameters above (Is this correct)

My preference is for OPTION 3 that uses the ca-certificate

How can I get my connection to the managed postgresql database working

Please note that i have used psql to query the managed database and that works

Thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @techsupport19fe,

Everything seems fine from looking at it. Having said that, make sure to allow your IP in the trusted hosts for the database. This might be the reason why you are not being able to connect.

Additionally, what tool are you using to connect to your Managed Database from your local computer?