Database Interface for Erlang and Elixir using SQLite. For further information check DBI.
To use it, with rebar, you only need to add the dependency to the rebar.config file:
{deps, [
{dbi_mysql, "0.1.0"}
]}
To use it, with mix, you only need to add the dependency to the mix.exs file:
{:dbi_mysql, "~> 0.1.0"}
The configuration is made in the configuration file (sys.config
or app.config
) so, you can add a new block for config the database connection as follow:
{dbi, [
{mydatabase, [
{type, mysql},
{host, "localhost"},
{user, "root"},
{pass, "root"},
{database, "mydatabase"},
{poolsize, 10}
]}
]}
In case you're using Elixir, you can define the configuration for your project in this way:
confg :dbi, mydatabase: [
type: :mysql,
host: 'localhost',
user: 'root',
pass: 'root',
database: 'mydatabase',
poolsize: 10
Enjoy!