How to select data via ODBC from Elixir?

There are a couple of things here:

1.) I think you want :odbc.sql_query/2. I built a fairly substantial application last year using ODBC to communicate with SQLServer and I used sql_query pretty much everywhere. I'd share the source but I cannot.

2.) I can't find any documentation on execute_stmt in the official Erlang ODBC docs (v2.11.1) hence I think it may be deprecated. I did find an example that uses execute_stmt but the arity was four not two. And it looks like the version of ODBC involved (judging by the link itself) is rather old--pre v1.0.

3.) In Elixir we tend to shy away from rebuilding things which are already built in Erlang unless there's a compelling need to do so. Since ODBC is already present in Erlang and it works pretty well, I'd guess the general guidance is call the Erlang lib from Elixir. Elixir was designed to make it easy to call Erlang code.

Tags:

Odbc

Elixir