1

When I'm using mysql client, I can configure my db credentials in ~/.my.ini.

How can I achieve similar thing with sqlcmd on Linux? Where and what filename I should create?

My goal is to avoid keep repeating hostname, user and passwords for every command.

  • If your goal is to avoid repeating, you can factorize the call with a generic function. – Hybris95 Dec 11 '18 at 14:06
0

MS SQL client is supporting unixODBC. So the credentials can be set in odbc.ini (e.g. ~/.odbc.ini, /etc/odbc.ini). The configuration file can be also specified by ODBCINI environment variable.

Sample content:

[the_db]
    Description = The Database using MyODBC Driver DSN
    SERVER = localhost
    PORT =
    USER = root
    Password = somePassword
    Database = the_db

See: Configuring and Testing iODBC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.