Ecto/Tds connection error to a mssql database

Context: I’ve got an application that connects to two different databases–one mssql and the other postgres–and manages the flow of data between the two. The postgres part works perfectly.

I’ve got a pair of remote mssql databases I’m using. Each is on a different remote machine in a vpn that I’m connected to. One is my dev database and the other is our staging database. When I use the dev database it works perfectly, but when I switch to the staging database I get the following error:

** (DBConnection.ConnectionError) bad return value: {:error, %Tds.Protocol{env: %{trans: <<0>>}, itcp: nil, opts: [password: :REDACTED, idle_timeout: 5000, name: EventBridge.C3poRepo.Pool, otp_app: :event_bridge, repo: EventBridge.C3poRepo, timeout: 15000, pool_timeout: 5000, adapter: Tds.Ecto, username: “uap_event_bridge”, database: “FASTTRACK_PROD”, hostname: “AS-MSDB01”, pool: DBConnection.Poolboy], pak_data: “”, pak_header: “”, query: %Tds.Query{handle: 1, statement: nil}, result: %Tds.Result{columns: , command: nil, num_rows: 0, rows: }, sock: {:gen_tcp, #Port<0.6472>}, state: :ready, tail: “”, transaction: nil, usock: nil}}

My initial thought was that the configuration was wrong for the database that I can’t connect to via my application so I went and validated the configuration for each. We use DBeaver for connecting to the various databases we use and I can make a connection to both of these remote machines.

I am using these deps for my application:

{:tds_ecto, “~> 2.0.3”},
{:postgrex, “>= 0.0.0”},
{:gen_stage, “~> 0.12”},
{:timex, “~> 3.1”},
{:timex_ecto, “~> 3.0”},
{:poison, “~> 3.1”},
{:ecto, “~> 2.1”}

I’ve had no luck on the internet or on stackoverflow with this and I’m hoping someone can point me in the right direction to sort it out.

1 Like