Can I connect to a database without Ecto?

I am new to the elixir world, and I am learning some paradigms of language. I searched a lot, but I found nothing in relation to connecting to the database only with what the language gives me, without libraries, frameworks or something like that. Is there such a possibility? If so, how do I connect to the database without ecto or anything like that

1 Like

There’s an ODBC module in Erlang, Erlang -- odbc

Other than that it would probably require a library of some sort.


Yes, you can connect ODBC from Elrng distribution, provided you also install the appropriate ODBC driver. So, if you want to use PostgreSQL this way, you need to have installed etc.

This probably is going to work but how good I don’t know. The majority and a big majority of community in that caes will use postgrex, because Ecto uses it under the hood. So, in case of PostgreSQL this will be the most supported way, likely. Same will go with MySQL.

You may need to use ODBC and it’s driver if you want to connect to more exotic databases, however. For example this library provided Ecto support for MySQL (don’t know if this is still the preferred way) and it’d use ODBC MSSQL driver under the hood: