Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fork of Will Glozer's erlang postgresql pool server, so it can be maintained and polished.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 ebin
Octocat-spinner-32 src
Octocat-spinner-32 test_ebin
Octocat-spinner-32 test_src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Makefile
Octocat-spinner-32 README
README
Erlang PostgreSQL Connection Pool

* Application

  epgsql_pool will create any pools defined in the application's 'pools' environment
  parameter, which is a list of atoms. Each atom must refer to an environment parameter
  with the same name and value {Size, Opts} where Opts is a property list with the
  following supported options:

  host      - host to connect to, default "localhost".
  port      - port to connect to, default 5432.
  username  - username to authenticate with, default os:getenv("USER").
  password  - password to authenticate with, default "".
  database  - database to connect to, no default.

  .config file example:

    {epgsql_pool,  [{pools, [db1, db2]},
                    {db1, {10, [{database, "db1"}]}},
                    {db2, {10, [{database, "db2"}]}}]}                    
  
* Pool Usage

  {ok, C} = pgsql_pool:get_connection(Pool, Timeout).

  Pool          - Pid or Name of pool.
  Timeout       - Time, in milliseconds, to wait for a free connection.

  ok = pgsql_pool:return_connection(Pool, Connection).

* Details

  epgsql_pool monitors the process which called get_connection and returns the
  allocated connection to the pool if that process dies. If a connection dies,
  a new one is created and added to the pool in its place.
Something went wrong with that request. Please try again.