Code Monkey home page Code Monkey logo

Comments (9)

cpursley avatar cpursley commented on May 29, 2024

I've set up an example repo that takes the Friends ecto example and have dockerized it. The master branch is working with Postgres.

I've attempted to get a mssql branch going, but no luck so far. I've used the Dockerfile from mssqlex and set up a Docker Compose file.

My confix.ex file looks like this:

config :friends, ecto_repos: [Friends.Repo]

config :friends, Friends.Repo,
  adapter:       MssqlEcto,
  database:      "friends_repo",
  username:      "sa",
  password:      "reallyStrongPwd123",
  hostname:      "mssql_db",
  instance_name: "MSSQLSERVER",
  port:          "1433",
  pool_size:     10,
  odbc_driver:   "{ODBC Driver 13.1 for SQL Server}"

When firing up iex -S mix (via Docker Compose), I get this error:

[error] Mssqlex.Protocol (#PID<0.985.0>) failed to connect: ** (Mssqlex.Error) [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 13.1 for SQL Server' : file not found Connection to database failed. | ODBC_CODE 01000 | SQL_SERVER_CODE 0

Perhaps I have my configuration wrong, but I'm also wondering if the Dockerfile is installing the wrong version of msodbcsql. Any thoughts? I'd love to use this project. Thank you.

from mssql_ecto.

shdblowers avatar shdblowers commented on May 29, 2024

Have you gone through the Installation steps, installing the Erlang ODBC application and the ODBC driver?

Edit: Oh wait sorry, you're doing it with docker...

from mssql_ecto.

cpursley avatar cpursley commented on May 29, 2024

Hi @shdblowers ~ yes, still seeing the same error. For what it's worth, msodbcsql v17.0.1.1-1 is getting installed by Docker.

from mssql_ecto.

shdblowers avatar shdblowers commented on May 29, 2024

OK, looks like you've specified to use ODBC Driver 13.1 in your config, can you double-check which ODBC driver version you have installed?

It might work if you change this value to "{ODBC Driver 13 for SQL Server}"

from mssql_ecto.

shdblowers avatar shdblowers commented on May 29, 2024

I like your idea of having a simple application that mssql_ecto as a reference.

If you'd like we can update the README to link to your project once everything is working correctly?

from mssql_ecto.

cpursley avatar cpursley commented on May 29, 2024

Awesome, I got it working by changing odbc_driver to "{ODBC Driver 17 for SQL Server}". ODBC Driver 17 is what the MS script installs as of today; I couldn't find an elegant way to set the msodbcsql version number.

Sure, I've renamed and improved the README a bit:
https://github.com/cpursley/mssql_ecto_friends

from mssql_ecto.

shdblowers avatar shdblowers commented on May 29, 2024

This same bug also affects the tests for this project, didn't realise because the tests haven't been run since MS updated the driver to 17.

from mssql_ecto.

shdblowers avatar shdblowers commented on May 29, 2024

Also I have linked your project in the README

from mssql_ecto.

cpursley avatar cpursley commented on May 29, 2024

I figured as much (regarding tests). Cheers.

from mssql_ecto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.