New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot connect to azure postresql - Username should be in <username@hostname> format #6371
Comments
@terchris Thanks for the feedback! We are currently investigating and will update you shortly. |
Hi Terje, 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:tiger@myhost.postgres.database.azure.com:5432/mydatabase |
@terchris Can you review the comment by @rachel-msft and let us know if this issue is resolved. |
@terchris When you have a chance to test, please let us know if this resolves your connectivity issue. |
@terchris We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion. |
We have tried to escape with %40 and \ and the jdbc driver fails to connect, any idea to solve this please ? |
Hi @sgandon, what is the error message you see? You said you are using %40 and . Where are you using \ ? |
Hi Rachel, thanks for the quick answer, in fact @ made it work. |
Thanks for letting us know |
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." postgresql://username:sDsO/43J/TU2%40sql-rs-rd423@sql-rs-rd423.database.windows.net:5432/sandbox 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. |
For the sake of completeness: on Ubuntu 18.04 the correct version is "postgresql://user@myhost:passwd@myhost.postgres.database.azure.com:5432/mydatabase No escaping needed. (ckan 2.8.4, python-sqlalchemy 1.1.11, PostgreSQL version 10) |
From Ubuntu 18.04, postgres version 11, none of the previously accepted solutions are working. PSQL, psycopg2 and sqlalchemy are failing. |
I also encountered this problem and tried the connection string fixes above, but couldn't get them to work. |
I'm trying to use your PostgreSQL for CKAN (ckan.org)
CKAN is using http://www.sqlalchemy.org/ for database connection.
A connection string looks like this:
engine = create_engine('postgresql://scott:tiger@myhost.postgres.database.azure.com:5432/mydatabase')
syntax is: postgresql://username:password@hostname:5432/databasename
When trying to connect to azure postgresql I get this error:
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:
postgresql://scott@myhost:tiger@myhost.postgres.database.azure.com:5432/mydatabase
Then I get:
invalid port number: "tiger@myhost.postgres.database.azure.com:5432"
Is there a solution to this ?
Regards
Terje
Document Details
The text was updated successfully, but these errors were encountered: