You are not logged in.
Line 293 of mormot.db.sql.postgres
fPGConn := PQ.SetDBLogin(pointer(Properties.ServerName), nil, nil, nil, pointer(Properties.DatabaseName), pointer(Properties.UserID),
pointer(Properties.PassWord));
When Propertyies.ServerName is set to be "localhost:5432" , it will thrown exception "Connection to database postgres failed [could not translate host name "localhost:5432" to address: Unknownhost]'.
To make it work, Properties.ServerName must NOT include the port, like this "localhost". Port cannot be specified as part of the ServerName.
The second parameter of libpq API, PQ.SetDBLogin is actually for specifying the port. But it is not used by mORMot (i.e., nil for the default 5432)
Hence, this is a missing piece here that a user cannot specify a port other than the default 5432.
Last edited by wxinix (2021-09-23 12:23:09)
Offline
I have just included this "host:port" parsing.
Thank you it works.
Offline
Ah, also missed in mORMot1. I miss it there mostly because I always use a DatabaseName (it can accept a full Postgres URI ) and keep a serverName empty.
Offline