I cannot connect to azure postgresql database in golang application
wrong information:
fatal: invalid username specified. please check the username and retry connection. the username should be in <username@hostname> format. (sqlstate 28000))
There is no @ in my username.
I use gorm as orm and connect like this
dburl := fmt.sprintf("postgres://%s:%s@%s:5432/%s", dbuser, dbpass, dbhost, dbname) db, err := gorm.open(postgres.open(dburl), &gorm.config{})
My variables look like this
postgres_password="password!" db_host="some-url-with-dashes.postgres.database.azure.com" app_port="8080" postgres_user="postgresuser" db_name="file"
My code does see them and creates dburl
correctly, like this:
postgres://postgresuser:[email protected]:5432/file
I have tried changing the username and password
You must configure the parameters db_user_namespace
to on
. Do not do this.
The above is the detailed content of Unable to connect to azure PostresSQL database - username should be in the format