title: sqlcmd connect to MSSQL via ODBC in Linux
body: <p>I want to use wine to run a Window's command line program in Linux. This program uses ODBC to connect to an MSSQL server. So far, I have installed MS ODBC driver 17. Now I want to test if the ODBC connection is working. </p>
  
  <p>How do I use sqlcmd to connect to MSSQL via ODBC in Debian 9? I have followed the instructions <a href="https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017#microsoft-odbc-driver-17-for-sql-server" rel="nofollow noreferrer">here</a> to install MS ODBC driver 17</p>
  
  <p>This works.</p>
  
  <p><code>sqlcmd -S 12.6.01.123 -U SA -P</code></p>
  
  <p>Here are my configs.</p>
  
  <pre><code>root@633e3d7a58a3:/# odbcinst -j
  unixODBC 2.3.4
  DRIVERS............: /etc/odbcinst.ini
  SYSTEM DATA SOURCES: /etc/odbc.ini
  FILE DATA SOURCES..: /etc/ODBCDataSources
  USER DATA SOURCES..: /root/.odbc.ini
  SQLULEN Size.......: 8
  SQLLEN Size........: 8
  SQLSETPOSIROW Size.: 8
  
  root@633e3d7a58a3:/# cat /etc/odbc.ini
  [DB_TEST]
  DRIVER=ODBC Driver 17 for SQL Server
  UID=SA
  PWD=PASSSSSSSSS
  DATABASE=DB_TEST
  WSID=W1002
  APP=Microsoft® Windows® Operating System
  SERVER=12.6.01.123
  Description=DSA
  </code></pre>