我刚开始使用Elixir Phoenix新的网络应用程序:
mix phoenix.new phoenix_sample --database mssql
它使用db配置生成了config / dev.exs文件,我已修改为匹配我当前的ms sql服务器:
config :phoenix_sample, PhoenixSample.Repo,
adapter: Tds.Ecto,
username: "dev",
password: "dev",
database: "phoenix_sample_db",
hostname: "localhost",
pool_size: 10
我能够以dev
用户身份登录ssms并连接到phoenix_sample_db
数据库
但是当我跑步时:mix ecto.create
我总是出错:
** (EXIT from #PID<0.46.0>) %Tds.Error{message: "tcp connect: nxdomain", mssql: nil}
17:44:04.805 [error] GenServer #PID<0.274.0> terminating
** (stop) %Tds.Error{message: "tcp connect: nxdomain", mssql: nil}
Last message: {:connect, [port: 1433, hostname: ".", database: "master", otp_app: :phoenix_sample, repo: PhoenixSample.Repo, adapter: Tds.Ecto, username: "dev", password: "dev", pool_size: 10]}
State: %{attn_timer: nil, env: %{trans: <<0>>}, ireq: nil, itcp: nil, opts: [port: 1433, hostname: ".", database: "master", otp_app: :phoenix_sample, repo: PhoenixSample.Repo,
adapter: Tds.Ecto, username: "dev", password: "dev", pool_size: 10], pak_data: "", pak_header: "", queue: {[{{:connect, [port: 1433, hostname: ".", database: "master", otp_app: :phoenix_sample, repo: PhoenixSample.Repo, adapter: Tds.Ecto, username: "dev", password: "dev", pool_size: 10]}, {#PID<0.46.0>, #Reference<0.0.2.504>}, #Reference<0.0.2.505>}], []}, sock: nil, state: :ready, statement: nil, tail: "", usock: nil}
为什么它不起作用以及为什么ecto
尝试连接到master
db?
如果ecto
尝试创建新数据库,那么我需要将sa
凭据传递给db user config吗?