Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cannot connect to azure postresql - Username should be in <username@hostname> format #6371
I'm trying to use your PostgreSQL for CKAN (ckan.org)
A connection string looks like this:
FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in username@hostname format.
If I try to use the username format like this:
Then I get:
Is there a solution to this ?
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Since that tool requests a url syntax as follows: postgresql://username:password@hostname:5432/databasename
You would need to escape the '@' in our username@hostname format, because that url syntax expects @ to signify the start of the full hostname.
Please try this format: postgresql://scott%40myhost:email@example.com:5432/mydatabase
Hi. I tried everything I could think off, including escaping the @ character with %40. I am using sqlalchemy to connect to the database, and I am not able to connect, as the error says "The Username should be in username@hostname format."
Any help will be very much appreciated
Hi @etiennecelery. There a couple things here.
Hi Rachel and thank you for your reply.
It is weird because I am able to connect using pyodbc module, so I can confirm that the database exists and that the login credentials are ok. However, when trying to connect via sqlalchemy or psycopg2, I do either get a format error in the username (username@hostname) or I get this "check your server name" error.
I also tried uri formating the password, but the error messages prevail. It has been very frustrating to connect to the database, so any suggestions you have would be greatly appreciated.
@etiennecelery, can you confirm that you are connecting to a Postgres server? In my previous response, I only edited the url you had sent to arrange the components correctly. But now I notice you are currently using .database.windows.net which would be for Azure SQL DB. If this is a Postgres database it should be .postgres.database.azure.com
To be sure, I recommend going to the Azure Portal and selecting the Postgres server. On the Overview page you will see your server's fully defined host name.