# DBConnection

> Database connection behaviour and connection pool for Elixir database drivers

Source: https://talira.ai/catalog/dbconnection-arq1yp23
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / databases / connection pools](https://talira.ai/categories/libraries/databases/connection-pools), [languages / elixir](https://talira.ai/categories/languages/elixir)
- Licence: Apache-2.0[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [James Fish](https://talira.ai/orgs/james-fish.md)

DBConnection is an [Elixir](https://talira.ai/catalog/elixir-edq5dfnt.md) library that gives database drivers a connection behaviour and a connection pool, handling transactions, prepare and execute, cursors and the client process's describe, encode and decode steps. It keeps the socket in a holder the client works on directly, so query data isn't copied between processes, shuts down a connection a client fails to check back in, and queues checkouts with the CoDel algorithm to reject requests under overload. Its README links a series of articles on building a database adapter with DBConnection and [Ecto](https://talira.ai/catalog/ecto-dq6bsaxc.md), and it includes an ownership pool used mainly in tests.

## Links

- GitHub: https://github.com/elixir-ecto/db_connection
- Docs: https://hexdocs.pm/db_connection/DBConnection.html

## Problems it solves

- write a database driver for Elixir with connection pooling
- pool database connections in an Elixir app under load
- reject database requests cleanly when an Elixir connection pool is overloaded

## Features

- Connection behaviour for transactions, prepare/execute and cursors
- Connection pool that queues checkouts with the CoDel algorithm
- Avoids copying query data by letting the client work on the socket directly
- Deadlines that terminate connections held too long
- Ownership pool for tests

## Trust

Overall: 0.46 out of 1.
Signals: maintenance 0.64, adoption 0.51, momentum 0.17, community 0.71, backing 0.30, extensibility 0.00.

- last commit 5 days ago
- 6 commits in the last 90 days
- 352 GitHub stars
- 58 contributors
- backed by James Fish

## Related

- Works with [Ecto](https://talira.ai/catalog/ecto-dq6bsaxc.md)

## Sources

[^1]: https://github.com/elixir-ecto/db_connection (checked 28 Nov 2026)
