The goto method to connect to databases in Elixir are the Ecto adapters. Connecting to the SQL-server is done using the TDS
adapter. Unfortunately, TDS
does not support windows authetication.
The way to overcome this limitation is to use the erlang ODBC
library.
def get_data do
{:ok, ref} = :odbc.connect('Driver={SQL Server};SERVER=<<SERVER>>;Trusted_Connection=yes;DATABASE=<<DB>>', [])
:odbc.sql_query(ref, 'SELECT TOP 10 * FROM <<TABLE>>')
end