Code Monkey home page Code Monkey logo

Comments (16)

ssomnoremac avatar ssomnoremac commented on May 30, 2024 3

actually @RobStallion @katbow , I just got it to work. Had your same error but after adding deps to applications

def application do
    [mod: {BlogPhoenix, []},
     applications: [:phoenix, :phoenix_pubsub, :cowboy, :logger, :gettext,
                    :phoenix_ecto, :mssqlex, :mssql_ecto]]

and REMOVING

-  odbc_driver: "{ODBC Driver 13.1 for SQL Server}"

it worked!

from mssql_ecto.

toddharding avatar toddharding commented on May 30, 2024

The default version of Erlang on MacOS does not include Erlang ODBC, could you try to install Erlang via Kerl and follow kerls instructions to enable Erlang ODBC.

If you are still unable to get ODBC to work on MacOS then a fallback solution could be to run your project in a docker container, this is how I develop elixir projects that connect to SQL Server on MacOS.

from mssql_ecto.

shdblowers avatar shdblowers commented on May 30, 2024

@katbow we would like to support mssql_ecto on MacOS in a more official sense and are willing to provide further assistance in order to achieve that.

Hopefully, the resolution of this ticket will include updating our README.md to include instructions specific to MacOS, if the current instructions are relevant. Any help on that from you or @toddharding would be great, as I don't own a MacBook 😓

from mssql_ecto.

katbow avatar katbow commented on May 30, 2024

@toddharding Yes, I was having that issue initially where Erlang ODBC was not included in the version of Erlang I had installed. I managed to get it installed with ODBC. I double checked it was included by running odbc:module_info(). in the Erlang console.

@shdblowers thanks, I'll keep at it for a bit & let you know if I find a solution 👍 .

from mssql_ecto.

shdblowers avatar shdblowers commented on May 30, 2024

@katbow it could be that the version of the ODBC driver you've installed doesn't match up with what mssqlex expects. See this.

Looking at finding a solution...

from mssql_ecto.

shdblowers avatar shdblowers commented on May 30, 2024

@katbow try adding the last line to your config:

config :my_app, MyApp.Repo,
  adapter: MssqlEcto,
  username: "<my_username>",
  password: "<my_password>",
  database: "test",
  hostname: "<my_server>.database.windows.net", 
  pool_size: 10
  odbc_driver: "{ODBC Driver 13.1 for SQL Server}"

I'm not sure if that will be the correct name of the ODBC driver you have installed on you MacOS. Not sure how to check at this point.

from mssql_ecto.

RobStallion avatar RobStallion commented on May 30, 2024

@toddharding. I have also tried all of the suggestions to this point but have still been experiencing the same issue. I have also added a Vagrantfile to test things in an linux environment but have still had the same issue.

I have also tried querying the DB with node running in the linux environment and that worked as expected. That code is in the repo that can be found here: https://github.com/RobStallion/azure-elixir.

If anything is unclear or you would like any more information please let me know.

from mssql_ecto.

ssomnoremac avatar ssomnoremac commented on May 30, 2024

I've just been through all the steps the healthlocker people have been through. Same exact path. Installed erlang on iOS with kerl, verified odbc is working, installed microsoft driver. Same dead end. If this is a problem in linux too that's not good.

from mssql_ecto.

shdblowers avatar shdblowers commented on May 30, 2024

Thanks for doing some debugging @ssomnoremac

My current thoughts are that the :mssqlex app is not getting started when only adding :mssql_ecto to the list of dependencies.

I will try and investigate this further...

from mssql_ecto.

shdblowers avatar shdblowers commented on May 30, 2024

I can't replicate this bug on my Linux/Ubuntu environment, but my theory is that adding both mssql_ecto and mssqlex to the list of deps will fix the bug.

i.e. (with Elixir 1.4)

applications will look like:

  def application do
    [mod: {Throwaway.Application, []},
     extra_applications: [:logger, :runtime_tools]]
  end

and deps:

  defp deps do
    [{:mssql_ecto, "~> 0.1"},
     {:mssqlex, "~> 0.6"},
     ...]
  end

Could someone with a Mac please confirm?

from mssql_ecto.

RobStallion avatar RobStallion commented on May 30, 2024

@shdblowers I had both mssql_ecto and mssqlex in the list of deps as you have said above but I could not get it to work like that on mac or ubuntu.

Following what @ssomnoremac mentioned is the only way I have ben able to get things working (massive thanks btw to everyone for continuing to look into this and get back to us). Otherwise, I was repeatedly getting the same error mentioned by @katbow when the issue was opened..
[error] Mssqlex.Protocol (#PID<0.3246.0>) failed to connect: ** (Mssqlex.Error) odbc_not_started.

I only needed to add mssqlex to the application list to remove the error. Just thought I would mention that incase it helped clear things up

from mssql_ecto.

RobStallion avatar RobStallion commented on May 30, 2024

@shdblowers Also I have this working on mac (to answer your original question 😄)

from mssql_ecto.

shdblowers avatar shdblowers commented on May 30, 2024

I'm glad you've managed to get this working @RobStallion @katbow.

Thanks for your help @ssomnoremac.

I think this issue can be closed once the readme has been updated to reflect how you managed to get things to work.

I had a look over your mix.exs file on Health Locker here

I think the problem is understanding how application inference works with Elixir 1.4

I will update the readme to show how to get it to work both with and without application inference, as I think this will be a common issue in Elixir until application inference becomes the standard in everyone's mix.exs files.

I think it would also be useful to add to the readme the steps you took to get it working on MacOS and was looking for help on that front.

from mssql_ecto.

katbow avatar katbow commented on May 30, 2024

@ssomnoremac thanks very much!

@shdblowers Oh I see, thanks for that. That's useful to know as it cleans up the config a lot. @RobStallion and I can update the README with instructions for macOS (probably on the weekend, though).

Really appreciate the help everyone!

from mssql_ecto.

ssomnoremac avatar ssomnoremac commented on May 30, 2024

@katbow let me know how it goes. For some reason I'm having issues with my associations. I'm not sure if it's an issue with this library or not, or if it's because my table names are capitalized, or if it's an issue with Absinthe-ecto, or my setup, or what. I'm using an existing Azure db so there's a bit to tackle.

from mssql_ecto.

ssomnoremac avatar ssomnoremac commented on May 30, 2024

actually solved the association issue, had to be careful with plural fields for that.

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.