Skip to main content

Generate connection string

Forms a connection string from the passed data

Function GenerateConnectionString(Val Address, Val Base, Val Login, Val Password = "", Val Port = "5432") Export

ParameterCLI optionTypeRequiredDescription
Address--addrStringIP address or domain name of the server
Base--dbStringName of the database to connect
Login--loginStringPostgres user login
Password--passStringPostgres user password
Port--portStringConnection port

Returns: String - PostgreSQL database connection string


1C:Enterprise/OneScript code example
    Address  = "127.0.0.1";
Login = "bayselonarrend";
Password = "12we...";
Base = "postgres";

Result = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password);
    oint postgres GenerateConnectionString \
--addr "127.0.0.1" \
--db "postgres" \
--login "bayselonarrend" \
--pass "***"
Result
"postgresql://bayselonarrend:***@127.0.0.1:5432/postgres"