Can we create "Server Aliases" in Linux clients (webservers etc.) so that you can change connections without touching the application's DB URL string?
The official documentation seems to talk about a GUI way of doing this in Windows, so I was wondering if something like this exists for Linux. This has lots of benefits, especially during containerization of apps.
My high level objective is to see if I can create some level of indirection so that the application always thinks of DB as DSN=myDsn;Uid=myUsername;Pwd=myPwd;
while the real driver redirects it to DSN=realDsn;Uid=realUsername;Pwd=realPwd;
. Initially I was thinking of something like socat
, but I am not sure how password changes can be handled! "Server Aliases for client" seems to do something like this, hence the question.
1 Answer 1
Aliases on Windows are set using the SQL Server Configuration Manager GUI. The Linux equivalent is mssql-conf, but there isn't an equivalent to aliases on Linux.
(I don't think this is a case of "isn't supported yet" related to Linux support being relatively new. My guess on the future is just a hunch & guessing rather than fact.)
If you need server name redirection, I'd recommend using a CNAME
to redirect that name for all clients centrally, rather than a client by client setting. Alternatively, I'd use the hosts
file to redirect from one server name to another.
If you need to also do credential impersonation (your example implies this), allowing the user to supply one credential, and using something different to connect to the database, that sounds like something to be handled by your application, rather than expecting the drivers to do it for you.
-
Thank you for clarifying this. Agree, application seems to be the right place for storing passwords.Nishant– Nishant2020年10月16日 04:07:05 +00:00Commented Oct 16, 2020 at 4:07