xo / usql

Universal command-line interface for SQL databases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usernames with @ unescapable?

pergeri opened this issue · comments

We login with a AD user and pass to databases where our usernames are email adresses, this mucks a bit with the connection since the connection takes the first @ and expects everything after it to be the database server. Escaping it with a \ doesn't work. Is there a workaround?

Have you tried urlencoding them? That is, replace @ with %40.

@pergeri we use standard URLs for database connections. As @nineinchnick stated, you need to URL encode it.

Hi! Got the same issue I'm afraid:

usql sqlserver://email%40domain.com@database.server.com/
error: sqlserver: 40532: login error: Cannot open server "domain.com" requested by the login.  The login failed.

@pergeri You can try writing a DSN directly using this syntax:

(not connected)=> \c sqlserver 'parameters ...'

Please see here for parameters:

https://github.com/microsoft/go-mssqldb

I'll take a look lower look at what's going on, but URL encoding special characters in passwords has worked fine for me with sqlserver.