# Mysql errors when using mssql

**URL:** <https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067>\
**Category:** Questions\
**Tags:** ecto, mssql\
**Created:** [January 6, 2020, 8:51pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067 "2020-01-06T20:51:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bodhilogic](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bodhilogic/32/10652_2.png) [@bodhilogic](https://forum.elixirforum.com/u/bodhilogic)\
**Post date:** [January 6, 2020, 8:51pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/1 "2020-01-06T20:51:40Z")

</div>

I’m trying to create an API that interfaces to a MS SQL database. My `mix deps.get` reports no errors or problems, but when I `mix run --no-halt`, I get a series of warnings about SQL and migrations _(my app is a read-only app for an existing MS SQL database so I have no migrations)_.

How do I deal with this problem?

```elixir
==> ecto
Compiling 70 files (.ex)
warning: redefining module Ecto.Adapters.MySQL (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.MySQL.beam)
  lib/ecto/adapters/mysql.ex:1

warning: redefining module Ecto.Adapters.SQL.Stream (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.SQL.Stream.beam)
  lib/ecto/adapters/sql/stream.ex:1

warning: redefining module Ecto.Adapter.Migration (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapter.Migration.beam)
  lib/ecto/adapter/migration.ex:1

warning: redefining module Ecto.Adapters.SQL.Sandbox (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.SQL.Sandbox.beam)
  lib/ecto/adapters/sql/sandbox.ex:1

warning: redefining module Ecto.Migration.Runner (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Migration.Runner.beam)
  lib/ecto/migration/runner.ex:1

warning: redefining module Ecto.Adapters.SQL.Sandbox.Connection (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Adapters.SQL.Sandbox.Connection.beam)
  lib/ecto/adapters/sql/sandbox.ex:296

warning: redefining module Ecto.Migration.SchemaMigration (current version loaded from /Users/steve/Sites/ade_umbrella/_build/dev/lib/ecto_sql/ebin/Elixir.Ecto.Migration.SchemaMigration.beam)
  lib/ecto/migration/schema_migration.ex:1

== Compilation error in file lib/ecto/adapters/mysql.ex ==
** (FunctionClauseError) no function clause matching in Keyword.fetch!/2    
    
    The following arguments were given to Keyword.fetch!/2:
    
        # 1
        :mariaex
    
        # 2
        :driver
    
    Attempted function clauses (showing 1 out of 1):
    
        def fetch!(keywords, key) when is_list(keywords) and is_atom(key)
    
    (elixir) lib/keyword.ex:390: Keyword.fetch!/2
    lib/ecto/adapters/mysql.ex:118: (module)
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6

```

Here is my mix deps declaration:

```elixir
  defp deps do
    [
      {:jason, "~> 1.0"},
      {:mssql_ecto, "~> 1.2.0"},
      {:mssqlex, "~> 1.1.0"},
      {:poison, "~> 3.0"},
      {:plug, "~> 1.8"},
      {:cowboy, "~> 2.7"},
    ]
  end

```

---

<div class="post-metadata">

**Author:** ![matreyes](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/matreyes/32/8924_2.png) [@matreyes](https://forum.elixirforum.com/u/matreyes)\
**Post date:** [January 6, 2020, 10:37pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/2 "2020-01-06T22:37:23Z")

</div>

Not sure why it’s calling to MYSQL (not mssql), maybe you should check the Repo configuration for the adapter. It should be

```elixir
config :my_app, MyApp.Repo,
adapter: MssqlEcto

```

(it seems to be MySql)

FYI, I had a similar use case (read only) and I’ve avoided using ecto (another dependency), and I just used raw sql queries from mssqlex. It was way simpler for this case. Maybe it’s a good idea also for you?

---

<div class="post-metadata">

**Author:** ![bodhilogic](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bodhilogic/32/10652_2.png) [@bodhilogic](https://forum.elixirforum.com/u/bodhilogic)\
**Post date:** [January 6, 2020, 10:40pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/3 "2020-01-06T22:40:27Z")

</div>

> [@matreyes](#):
>
> adapter: MssqlEcto

My Repo is like this, but your idea would work, I’ll think about doing that.

```elixir
defmodule TwApi.Repo do
  use Ecto.Repo,
    otp_app: :tw_api,
    adapter: Ecto.Adapters.MssqlEcto

    ...
    ...
end

```

---

<div class="post-metadata">

**Author:** ![matreyes](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/matreyes/32/8924_2.png) [@matreyes](https://forum.elixirforum.com/u/matreyes)\
**Post date:** [January 6, 2020, 10:48pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/4 "2020-01-06T22:48:48Z")

</div>

But it’s still calling to the mysql adapter… have you checked your config files?

---

<div class="post-metadata">

**Author:** ![bodhilogic](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bodhilogic/32/10652_2.png) [@bodhilogic](https://forum.elixirforum.com/u/bodhilogic)\
**Post date:** [January 6, 2020, 10:53pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/5 "2020-01-06T22:53:33Z")

</div>

I’ve been checking EVERY file - not a MySQL anywhere!?!?  
It seems to be something that elixir is adding in ‘after the fact’…

---

<div class="post-metadata">

**Author:** ![matreyes](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/matreyes/32/8924_2.png) [@matreyes](https://forum.elixirforum.com/u/matreyes)\
**Post date:** [January 6, 2020, 11:10pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/6 "2020-01-06T23:10:58Z")

</div>

Maybe as default, when no config was set… 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/32/27235_2.png) [@NobbZ](https://forum.elixirforum.com/u/NobbZ)\
**Post date:** [January 6, 2020, 11:20pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/7 "2020-01-06T23:20:41Z")

</div>

Please check your `mix.lock` which version of `ecto` got pulled in. Perhaps we can use that information to narrow things down.

---

<div class="post-metadata">

**Author:** ![bodhilogic](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bodhilogic/32/10652_2.png) [@bodhilogic](https://forum.elixirforum.com/u/bodhilogic)\
**Post date:** [January 6, 2020, 11:21pm UTC](https://forum.elixirforum.com/t/mysql-errors-when-using-mssql/28067/8 "2020-01-06T23:21:42Z")

</div>

` "ecto": {:hex, :ecto, "2.2.12", "ce7f619c1451daad0f59e8f01fd8e2584226171dc273e3346444446a13d93943", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},`
