The Crystal Programming Language Forum

connection to postgres

I came across a problem with the database connection. A standard piece of code:

DB.open "postgres://myuser:mypasswd@remoteserver/mydb" do |db|
  # code
end

throws an exception:
“(DB::ConnectionRefused), caused by: Cleartext auth is not supported (Exception)”

What should I add to a connection string to avoid that error?

I can connect that db using a pgAdmin4 or simple php script:

$db = new PDO("pgsql:dbname=mydb host=remoteserver", "myuser", "mypasswd");

and I have no influence on the database configuration.

Hi!

Ref: https://github.com/will/crystal-pg/issues/192