EDBI is intended as a database independence and connection pooling library for erlang programs.
- dummy
edbi_dummy
A dummy driver for EDBI testing that just writes SASL logs on startup- pgsql
pgsql
The Process One Postgresql driver modified for use with EDBI.- mysql
mysql
The Process One MySQL driver modifed for use with EDBI. [1]
[1] | Note that this driver isn't tested yet. |
Build the source using rebar:
./rebar compile
Or use it as dependency in the rebar.config
of your erlang application:
- {deps, [
- {edbi, "0.1.2",
- {git, "git://github.com/bharendt/edbi.git", {tag, "v0.1.3"}}}
]}.
EDBI uses OTP application configuration, so you can just put:
{edbi, [{pools, pools()}]}.
in your system.config
file.
The syntax of the pools env value is described in edoc type format as follows:
pools() = [pool(),...]. pool() = {PoolName::term(), Driver::atom(), Options::term(), Count::integer()}.
- PoolName
- the term used to identify and refer to the pool.
- Driver
- the name of the backend to use in the pool.
- Options
- a proplist of options to pass to the backend.
- Count
- the number of connections to maintain to the database.
A pool called dummy_pool of 10 dummy drivers.:
{dummy_pool, dummy, [], 10}
A pool (mydb
) of 10 connections to the local postgres database
mydb
as myuser
.:
{mydb, pgsql, [{database, "mydb"}, {host, "localhost"}, {user, "myuser"}, {password, ""}], 10}
Currently the API is extremely basic and only allows you to retreive connection PIDs to use with the driver backend.:
1> ConnectionPid = edbi:connection(PoolName), 1> pgsql:squery(ConnectionPid, "select 1"). {ok,[{"SELECT",[{"?column?",text,0,23,4,-1,0}],[["1"]]}]}