Closed cpursley closed 6 years ago
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.
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...
Hi @shdblowers ~ yes, still seeing the same error. For what it's worth, msodbcsql v17.0.1.1-1 is getting installed by Docker.
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}"
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?
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
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.
Also I have linked your project in the README
I figured as much (regarding tests). Cheers.
This looks like a very useful project; thanks for making it. But I'm having a difficult time setting it up. I'd love to see a simple reference Elixir application using this library that I could clone. Or as an alternative, expand the README to include how to use mssql_ecto along with a repo and simple schema.