bodhilogic

bodhilogic

Mysql errors when using mssql

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?

==> 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:

  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

First Post!

matreyes

matreyes

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

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?

Last Post!

bodhilogic

bodhilogic

"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"},

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement