There are many reasons why a connection can be refused. Is dbHost
a localhost?
Try
conn = OpenSQLConnection[
JDBC["PostgreSQL", "<host_name>/<db_name>"],
"Username" -> "<user_name>", "Password" -> "<password>"
]
E.g to connect to a public RNA sequence PostgreSQL database named pfmegrnargs
hosted by RNACentral
conn = OpenSQLConnection[
JDBC["PostgreSQL", "hh-pgsql-public.ebi.ac.uk/pfmegrnargs"],
"Username" -> "reader", "Password" -> "NWDMCE5xdipIjRrp"
]
tables = SQLTableNames[conn]
Execute query using SQL string (WL style SQL queries would be an alternative)
SQLExecute[conn, "select * from xref where ac = 'OTTHUMT00000106564.1'"]
Close connection
CloseSQLConnection[conn]