New to Phoenix, issue with mix ecto.create: (MatchError) no match of right hand side value: {:error, :econnreset}

I’m trying to use MSSQL with phoenix framework but when I use mix ecto.create, this error will appear:

14:39:38.695 [error] GenServer #PID<0.5164.0> terminating
** (MatchError) no match of right hand side value: {:error, :econnreset}
    (tds 2.3.0) lib/tds/protocol.ex:343: Tds.Protocol.instance/2
    (tds 2.3.0) lib/tds/protocol.ex:81: Tds.Protocol.connect/1
    (db_connection 2.4.2) lib/db_connection/connection.ex:82: DBConnection.Connection.connect/onnection.Connection.connect/2
    (connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Tds.Protocol
** (Mix) The database for Hello.MRepo couldn't be created: killed

This is my devs.exs :

config :hello, Hello.MRepo,

  adapter: Tds.Ecto,

  hostname: "localhost",

  instance: "SERVER",

  port: 1433,

  username: "sa",

  password: "server",

  database: "hello_dev_mssql",

  show_sensitive_data_on_connection_error: true,

  pool_size: 10

And this is my repo :

defmodule Hello.MRepo do

  use Ecto.Repo,

    otp_app: :hello,

    adapter: Ecto.Adapters.Tds


The general configuration:
Elixir: 1.13.3
OTP: 24
Phoenix 1.6.6

Thanks! :smiley:

The error is coming from here:

Which means the UDP socket to the DB is being reset before the recv call.

Can you verify that connecting to the DB with those credentials works from the command line (using sqlcmd for instance)?

I don’t have any error when I use sqlcmd

I try this command :

  • sqlcmd -E -S localhost\SQLEXPRESS
  • sqlcmd -S localhost\SQLEXPRESS -U sa -P sqlserver

this work correctly and I can execute SQL query

the error no longer appears even though I haven’t changed anything, thank you for your help al2o3cr