Closed maretodoric closed 4 months ago
URL encoding is the right way,maybe there are other characters? If you only tried the encoded pw in usqlrc, see if the entry gets matched correctly. You need to provide the right proto, hostname, port, and username
Nope, all other characters are alfanumeric. Only two octothorpes/hashes are in password. Proto, hostname is all *, example:
mssql:*:*:*:*:%23alfanumeric%23alfanumeric
And for DSN i use:
mssql://sa@localhost:62275?database=dbname
And i get 'Login failed for user 'sa'.
If i use same DSN - different port for different DB and different password entry in usqlrc file with password without # but with + which is also urlencodable but I've added it just plain '+' without encoding it - it will work. So wondering if encoding is even needed/honored from usqlrc ?
@maretodoric please try connecting directly without the .usqlpass
file. Are you able to connect? Display what your actual connection string is from within usql
by using the \conninfo
meta command.
Yup, connecting directly (with urlencoding hashes) worked.
So urlencoding it in .usqlpass doesn't work for some reason. \conninfo
displays something like:
Connected with driver sqldriver (sqlserver://sa:%23password%23password@localhost:...
Can you try using sqlserver in usqlpass? Mssql is an alias.
Yup, connecting directly (with urlencoding hashes) worked. So urlencoding it in .usqlpass doesn't work for some reason.
@maretodoric same here I am using PostgreSQL.
it seems the password can't include :
either. I am trying to connect to sql server and parsing the string fails.
usql ms://admin_username:pass:Tord@host/instance/dbname
invalid port ":T" after host.
You need to URL escape the password:
$ usql ms://admin_username:pass%3ATord@host/instance/dbname
thanks. i am getting login failed
error now.
I too have login failed in mssql connection string when password contains this symbol %
Hello,
I've been using usql by running it via python subprocess on Windows Server, forming DSN URL like
However when password contains special characters, specifically "#", windows probably interprets it as a comment so usql complains about wrong DSN. So i wanted to add that password into .usqlrc file (by also creating it in python) but, as you guessed, it's also interpreted as a comment and then usql complains about having an empty field. How would i escape hash/comment characted if it's part of a password? I tried URL encoding it with
%23
but it didn't work.