# \#db\_connection

**URL:** https://forum.elixirforum.com/tag/db-connection/526.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [Duckex - a client library for DuckDB](https://forum.elixirforum.com/t/duckex-a-client-library-for-duckdb/73202)

<div class="topic-metadata">

**Author:** [@hauleth](https://forum.elixirforum.com/u/hauleth)\
**Replies:** 3\
**Last updated:** [November 10, 2025, 9:28am UTC](https://forum.elixirforum.com/t/duckex-a-client-library-for-duckdb/73202 "2025-11-10T09:28:25Z")

</div>

It is library created by me and @abc3. It is simple client for DuckDB, but with small twist when compared with other libraries out there - instead of using NIFs it uses port instead. That provides greater stability (as i…

---

## [Seeking guidance implementing DbConnection](https://forum.elixirforum.com/t/seeking-guidance-implementing-dbconnection/70644)

<div class="topic-metadata">

**Author:** [@eileennoonan](https://forum.elixirforum.com/u/eileennoonan)\
**Replies:** 24\
**Last updated:** [May 3, 2025, 5:39am UTC](https://forum.elixirforum.com/t/seeking-guidance-implementing-dbconnection/70644 "2025-05-03T05:39:35Z")

</div>

I’m working on an Elixir client for LanceDB (sqlite for vector storage) called ElixirLanceDB. Most of this work so far has comprised of writing Rustler NIFs over the LanceDB rust client. I’ve got enough of the library im…

---

## [Is it possible to debug which processes and code places are using the DB pool when using Ecto?](https://forum.elixirforum.com/t/is-it-possible-to-debug-which-processes-and-code-places-are-using-the-db-pool-when-using-ecto/69373)

<div class="topic-metadata">

**Author:** [@quatermain](https://forum.elixirforum.com/u/quatermain)\
**Replies:** 12\
**Last updated:** [February 14, 2025, 2:47pm UTC](https://forum.elixirforum.com/t/is-it-possible-to-debug-which-processes-and-code-places-are-using-the-db-pool-when-using-ecto/69373 "2025-02-14T14:47:12Z")

</div>

Hi, We have a regular Phoenix project using Ecto and Postgresql. But recently we are seeing a lot of connection timeouts or idle/closed connections. All looks like problem that DB pool is exhausted. Traffic has been pr…

---

## [Gracefully handling Tds connection errors](https://forum.elixirforum.com/t/gracefully-handling-tds-connection-errors/64119)

<div class="topic-metadata">

**Author:** [@rypa](https://forum.elixirforum.com/u/rypa)\
**Replies:** 2\
**Last updated:** [June 13, 2024, 7:34am UTC](https://forum.elixirforum.com/t/gracefully-handling-tds-connection-errors/64119 "2024-06-13T07:34:54Z")

</div>

Hey all, I’ve an Oban worker making a connection to a remote MSSQL DB to run a query and then process the results. We’re using Tds to manage this and it works great when everything’s set up correctly. Every now and ag…

---

## [DBConnection Implementation via HTTP ](https://forum.elixirforum.com/t/dbconnection-implementation-via-http/64130)

<div class="topic-metadata">

**Author:** [@zackattackz](https://forum.elixirforum.com/u/zackattackz)\
**Replies:** 5\
**Last updated:** [June 11, 2024, 1:27pm UTC](https://forum.elixirforum.com/t/dbconnection-implementation-via-http/64130 "2024-06-11T13:27:54Z")

</div>

Hello! I am currently working on an implementation of an Ecto Adapter for XTDB v2.x. 2.x is not a production-ready version, but I just wanted to try to make this project as a way to learn more about Elixir and XTDB as w…

---

## [DB Connection Pooling – Connecting on demand instead of holding connections open](https://forum.elixirforum.com/t/db-connection-pooling-connecting-on-demand-instead-of-holding-connections-open/54918)

<div class="topic-metadata">

**Author:** [@mbklein](https://forum.elixirforum.com/u/mbklein)\
**Replies:** 6\
**Last updated:** [April 16, 2024, 11:33pm UTC](https://forum.elixirforum.com/t/db-connection-pooling-connecting-on-demand-instead-of-holding-connections-open/54918 "2024-04-16T23:33:51Z")

</div>

I’m using an AWS Aurora PostgreSQL Serverless v2 database cluster with Ecto. It can auto-scale between 0.5 and 16 ACUs (Aurora Capacity Units), and is priced per ACU-hour. I’m currently refactoring my GenServers to avoid…

---

## [Can Ecto or TDS retry queries if TCP connection closes or network error or DBConnection.ConnectionError?](https://forum.elixirforum.com/t/can-ecto-or-tds-retry-queries-if-tcp-connection-closes-or-network-error-or-dbconnection-connectionerror/57961)

<div class="topic-metadata">

**Author:** [@user20230119](https://forum.elixirforum.com/u/user20230119)\
**Replies:** 5\
**Last updated:** [August 31, 2023, 4:05am UTC](https://forum.elixirforum.com/t/can-ecto-or-tds-retry-queries-if-tcp-connection-closes-or-network-error-or-dbconnection-connectionerror/57961 "2023-08-31T04:05:24Z")

</div>

Does Ecto or TDS have a setting to retry SQL queries if the TCP connection closes? Does DBConnection have settings to retry when it fails? Do I have to wrap Repo.one with try catch and handle errors myself? My queries…

---

## [Transaction already started error](https://forum.elixirforum.com/t/transaction-already-started-error/52448)

<div class="topic-metadata">

**Author:** [@0xAX](https://forum.elixirforum.com/u/0xAX)\
**Replies:** 0\
**Last updated:** [December 12, 2022, 12:00pm UTC](https://forum.elixirforum.com/t/transaction-already-started-error/52448 "2022-12-12T12:00:37Z")

</div>

Hello everyone, Time to time I see that database sockets are closed during running my Elixir application. Except pretty terse \<\<"socket closed"\>\> error today I saw transaction is already started error, the full text is: …

---

## [Have Ecto wait for DB to spin up?](https://forum.elixirforum.com/t/have-ecto-wait-for-db-to-spin-up/47342)

<div class="topic-metadata">

**Author:** [@mbklein](https://forum.elixirforum.com/u/mbklein)\
**Replies:** 7\
**Last updated:** [September 29, 2022, 6:29am UTC](https://forum.elixirforum.com/t/have-ecto-wait-for-db-to-spin-up/47342 "2022-09-29T06:29:15Z")

</div>

We’re considering using AWS Aurora Serverless PostgresSQL for our developer environment. I’ve already determined that it will meet our needs as far as Postgres compatibility, but I’m looking for help getting over the las…

---

## [DB(dis)Connection - ERROR: could not serialize access due to concurrent update](https://forum.elixirforum.com/t/db-dis-connection-error-could-not-serialize-access-due-to-concurrent-update/50346)

<div class="topic-metadata">

**Author:** [@nhpip](https://forum.elixirforum.com/u/nhpip)\
**Replies:** 2\
**Last updated:** [September 19, 2022, 2:53pm UTC](https://forum.elixirforum.com/t/db-dis-connection-error-could-not-serialize-access-due-to-concurrent-update/50346 "2022-09-19T14:53:34Z")

</div>

Hi, We are using DBConnection and Ecto with a Postgres DB. Occasionally we get errors like below in the Postgres log: 2022-09-17 12:36:59.478 EDT \[92184\] ERROR: could not serialize access due to concurrent update 2022…

---

## [Ecto transactions, db\_connection Postgres id and exceptions](https://forum.elixirforum.com/t/ecto-transactions-db-connection-postgres-id-and-exceptions/49278)

<div class="topic-metadata">

**Author:** [@nhpip](https://forum.elixirforum.com/u/nhpip)\
**Replies:** 3\
**Last updated:** [August 2, 2022, 1:26pm UTC](https://forum.elixirforum.com/t/ecto-transactions-db-connection-postgres-id-and-exceptions/49278 "2022-08-02T13:26:30Z")

</div>

Hi, A really quick 3 questions: Is there any easy way to get the Postgres connection id so I can put it in my logs? It appears that certain errors (I have mostly seen serialization errors do this) cause Postgres t…

---

## [Set up DBConnection pool with latest postgrex](https://forum.elixirforum.com/t/set-up-dbconnection-pool-with-latest-postgrex/47631)

<div class="topic-metadata">

**Author:** [@mudssrali](https://forum.elixirforum.com/u/mudssrali)\
**Replies:** 1\
**Last updated:** [May 7, 2022, 11:52pm UTC](https://forum.elixirforum.com/t/set-up-dbconnection-pool-with-latest-postgrex/47631 "2022-05-07T23:52:20Z")

</div>

We’re migrated our elixir app to latest version along with dependencies. While upgrading postgrex from 0.13 to 0.16 we’re facing issue to setup pool. Previously we have db\_connection 1.3 which supports DBConnection.Poolb…

---

## [DBConnection logging exception when interacting with Event Store](https://forum.elixirforum.com/t/dbconnection-logging-exception-when-interacting-with-event-store/45293)

<div class="topic-metadata">

**Author:** [@martasd](https://forum.elixirforum.com/u/martasd)\
**Replies:** 6\
**Last updated:** [January 31, 2022, 1:15pm UTC](https://forum.elixirforum.com/t/dbconnection-logging-exception-when-interacting-with-event-store/45293 "2022-01-31T13:15:59Z")

</div>

Hi, I am seeing the following exception in Phoenix server debug log when I execute a mutation to register a new user in my application: \[debug\] Core.ProcessManagers.Registrator has been stopped by event 15 ("fefce8e5-a…

---

## [DBConnection.ConnectionError - requestes are coming in and your connection pool cannot serve them fast enough](https://forum.elixirforum.com/t/dbconnection-connectionerror-requestes-are-coming-in-and-your-connection-pool-cannot-serve-them-fast-enough/44886)

<div class="topic-metadata">

**Author:** [@borybar](https://forum.elixirforum.com/u/borybar)\
**Replies:** 2\
**Last updated:** [December 29, 2021, 10:01am UTC](https://forum.elixirforum.com/t/dbconnection-connectionerror-requestes-are-coming-in-and-your-connection-pool-cannot-serve-them-fast-enough/44886 "2021-12-29T10:01:07Z")

</div>

Hi, I am running tests, and some of them are returning this error → \*\* (DBConnection.ConnectionError) connection not available and request was dropped from queue after 1998ms. This means requests are coming in an…

---

## [\*\* (Tds.Error) tcp connect: econnrefused](https://forum.elixirforum.com/t/tds-error-tcp-connect-econnrefused/44419)

<div class="topic-metadata">

**Author:** [@VincentBlackdot](https://forum.elixirforum.com/u/VincentBlackdot)\
**Replies:** 8\
**Last updated:** [December 11, 2021, 11:10pm UTC](https://forum.elixirforum.com/t/tds-error-tcp-connect-econnrefused/44419 "2021-12-11T23:10:55Z")

</div>

hey guys i cant connect to my db from a new project, when i attempt to create a new db using mix ecto.setup / mix ecto.create i am getting this connection error 01:05:10.426 \[error\] GenServer #PID\<0.284.0\> terminating…

---

## [why transaction/2 raises an exception instead of a return tuple](https://forum.elixirforum.com/t/why-transaction-2-raises-an-exception-instead-of-a-return-tuple/43255)

<div class="topic-metadata">

**Author:** [@madili](https://forum.elixirforum.com/u/madili)\
**Replies:** 12\
**Last updated:** [November 4, 2021, 4:40pm UTC](https://forum.elixirforum.com/t/why-transaction-2-raises-an-exception-instead-of-a-return-tuple/43255 "2021-11-04T16:40:38Z")

</div>

Hi, Looking at the documentation of the transaction/2 function it should return a {:ok, result} or {:error, reason} tuple. However, if I use insert\_all/3 with transaction/2 I don’t get the expected result, but an except…

---

## [DB2/DRDA db\_connection/ecto library](https://forum.elixirforum.com/t/db2-drda-db-connection-ecto-library/43344)

<div class="topic-metadata">

**Author:** [@norpan](https://forum.elixirforum.com/u/norpan)\
**Replies:** 0\
**Last updated:** [October 25, 2021, 1:52pm UTC](https://forum.elixirforum.com/t/db2-drda-db-connection-ecto-library/43344 "2021-10-25T13:52:55Z")

</div>

Hi! I’m integrating with IBM DB2/DRDA and using the odbc driver works, sort of. I’m wondering if anybody has done any work to intergrate this more closely with Ecto, sort of what has been done with TDS (Microsoft SQL Se…

---

## [Telemetry not working with postgrex (\[:db\_connection, :connection\_error\] event)](https://forum.elixirforum.com/t/telemetry-not-working-with-postgrex-db-connection-connection-error-event/42668)

<div class="topic-metadata">

**Author:** [@lkuty](https://forum.elixirforum.com/u/lkuty)\
**Replies:** 1\
**Last updated:** [September 28, 2021, 9:08am UTC](https://forum.elixirforum.com/t/telemetry-not-working-with-postgrex-db-connection-connection-error-event/42668 "2021-09-28T09:08:01Z")

</div>

Hi folks, I cannot make telemetry (version 1.0.0) work with postgrex (version 0.15.11). Per the db\_connection doc (version 2.4.0), a telemetry event is generated when there is a connection error : A \[:db\_connection, …

---

## [DBConnection Compilation Error](https://forum.elixirforum.com/t/dbconnection-compilation-error/41429)

<div class="topic-metadata">

**Author:** [@Starman3787](https://forum.elixirforum.com/u/Starman3787)\
**Replies:** 3\
**Last updated:** [August 3, 2021, 4:31am UTC](https://forum.elixirforum.com/t/dbconnection-compilation-error/41429 "2021-08-03T04:31:37Z")

</div>

hey, i’m new to elixir so am very unfamiliar with how it all works i am trying to connect to a MariaDB database using the mariaex driver i’ve added it to the mix.exs file, as shown: defmodule Backend.MixProject do …

---

## [Lock Not Available - could not obtain lock on row in relation](https://forum.elixirforum.com/t/lock-not-available-could-not-obtain-lock-on-row-in-relation/40860)

<div class="topic-metadata">

**Author:** [@sahilpaudel](https://forum.elixirforum.com/u/sahilpaudel)\
**Replies:** 3\
**Last updated:** [July 7, 2021, 2:34pm UTC](https://forum.elixirforum.com/t/lock-not-available-could-not-obtain-lock-on-row-in-relation/40860 "2021-07-07T14:34:22Z")

</div>

I am frequently getting the below error in the production. (Postgrex.Error) ERROR 55P03 (lock\_not\_available) could not obtain lock on row in relation "snapshots" (ecto\_sql) lib/ecto/adapters/sql.ex:618: Ecto.Adapter…

---

## [How to get the status of a Ecto.Repo pool?](https://forum.elixirforum.com/t/how-to-get-the-status-of-a-ecto-repo-pool/36967)

<div class="topic-metadata">

**Author:** [@itopiz](https://forum.elixirforum.com/u/itopiz)\
**Replies:** 12\
**Last updated:** [May 26, 2021, 10:20am UTC](https://forum.elixirforum.com/t/how-to-get-the-status-of-a-ecto-repo-pool/36967 "2021-05-26T10:20:04Z")

</div>

Hi, I am developing an API that fetches data from multiple remote databases. For each of these databases, an Ecto.Repo is configured at runtime when the application starts. When I am trying to fetch data from a disconn…

---

## [Sharing a DBConnection pool with multiple Ecto Repo's](https://forum.elixirforum.com/t/sharing-a-dbconnection-pool-with-multiple-ecto-repos/13832)

<div class="topic-metadata">

**Author:** [@anthonator](https://forum.elixirforum.com/u/anthonator)\
**Replies:** 5\
**Last updated:** [May 12, 2021, 11:07pm UTC](https://forum.elixirforum.com/t/sharing-a-dbconnection-pool-with-multiple-ecto-repos/13832 "2021-05-12T23:07:34Z")

</div>

Is it possible to create a shared connection pool that can be used across many repos?

---

## [Amazon RDS load balancing with Ecto & DBConnection pool](https://forum.elixirforum.com/t/amazon-rds-load-balancing-with-ecto-dbconnection-pool/26175)

<div class="topic-metadata">

**Author:** [@jvoegele](https://forum.elixirforum.com/u/jvoegele)\
**Replies:** 2\
**Last updated:** [March 31, 2021, 2:43pm UTC](https://forum.elixirforum.com/t/amazon-rds-load-balancing-with-ecto-dbconnection-pool/26175 "2021-03-31T14:43:42Z")

</div>

We have an application hosted on AWS Fargate that uses AWS RDS for a managed database service. We have configured the RDS to use four reader replicas (in addition to the one writer) and we have two Fargate tasks with 40 …

---

## [DBConnection Error(DBConnection.ConnectionError) tcp recv: closed (PGPool)](https://forum.elixirforum.com/t/dbconnection-error-dbconnection-connectionerror-tcp-recv-closed-pgpool/37770)

<div class="topic-metadata">

**Author:** [@mcrunix](https://forum.elixirforum.com/u/mcrunix)\
**Replies:** 7\
**Last updated:** [February 25, 2021, 5:23pm UTC](https://forum.elixirforum.com/t/dbconnection-error-dbconnection-connectionerror-tcp-recv-closed-pgpool/37770 "2021-02-25T17:23:26Z")

</div>

Hi Everyone, I’m trying to use PGPool in front of a PG database and Ecto’s using it but all commands failed. Here are the logs that I figured out. $ mix ecto.create \*\* (Mix) The database for App.Repo couldn't be created…

---

## [Distillery app fails to start randomly, database connection issue?](https://forum.elixirforum.com/t/distillery-app-fails-to-start-randomly-database-connection-issue/35674)

<div class="topic-metadata">

**Author:** [@skosch](https://forum.elixirforum.com/u/skosch)\
**Replies:** 1\
**Last updated:** [December 13, 2020, 2:33am UTC](https://forum.elixirforum.com/t/distillery-app-fails-to-start-randomly-database-connection-issue/35674 "2020-12-13T02:33:44Z")

</div>

New deployment today got me confused. Three instances of the same Elixir app on the same server, Postgres DB on a second machine. App is packaged with Distillery, each instance has its own slightly different config. Fir…

---

## [Count idle/used Ecto repo connections in real-time](https://forum.elixirforum.com/t/count-idle-used-ecto-repo-connections-in-real-time/35593)

<div class="topic-metadata">

**Author:** [@lkananowicz](https://forum.elixirforum.com/u/lkananowicz)\
**Replies:** 2\
**Last updated:** [November 16, 2020, 7:46pm UTC](https://forum.elixirforum.com/t/count-idle-used-ecto-repo-connections-in-real-time/35593 "2020-11-16T19:46:50Z")

</div>

Hi, I wonder if there is a reliable way to count/monitor used database connections for given repo. One of the ideas tried so far was checking Ecto.Repo.Registry :ets table and then extracting size of DBConnection.Connect…

---

## [Cannot acquire DBConnection after 1000 tests run during CircleCI tests while in :shared mode](https://forum.elixirforum.com/t/cannot-acquire-dbconnection-after-1000-tests-run-during-circleci-tests-while-in-shared-mode/33595)

<div class="topic-metadata">

**Author:** [@Nitrodist](https://forum.elixirforum.com/u/Nitrodist)\
**Replies:** 2\
**Last updated:** [August 11, 2020, 9:37pm UTC](https://forum.elixirforum.com/t/cannot-acquire-dbconnection-after-1000-tests-run-during-circleci-tests-while-in-shared-mode/33595 "2020-08-11T21:37:06Z")

</div>

We have our elixir project setup to run a circleci job where it invokes mix test. We are seeing recently and in increasing frequency this type of an error: 19:57:51.320 \[error\] Task #PID\<0.3093.0\> started from #PID\<…

---

## [Ecto & DBConnection logging metadata](https://forum.elixirforum.com/t/ecto-dbconnection-logging-metadata/31353)

<div class="topic-metadata">

**Author:** [@victorolinasc](https://forum.elixirforum.com/u/victorolinasc)\
**Replies:** 0\
**Last updated:** [May 8, 2020, 6:59pm UTC](https://forum.elixirforum.com/t/ecto-dbconnection-logging-metadata/31353 "2020-05-08T18:59:07Z")

</div>

We use Ecto extensively on a very high-load server (think like millions of requests a day). Recently we’ve been having some db\_connection issues and wanted to tune our configuration. We can always resort to dynamic inst…

---

## [Ecto.Adapters.SQL.Sandbox.child\_spec/1 is undefined or private](https://forum.elixirforum.com/t/ecto-adapters-sql-sandbox-child-spec-1-is-undefined-or-private/19934)

<div class="topic-metadata">

**Author:** [@gavares](https://forum.elixirforum.com/u/gavares)\
**Replies:** 10\
**Last updated:** [March 9, 2020, 2:15pm UTC](https://forum.elixirforum.com/t/ecto-adapters-sql-sandbox-child-spec-1-is-undefined-or-private/19934 "2020-03-09T14:15:26Z")

</div>

I’m trying to use Commanded with Phoenix to create an eventsourced application. I’ve pieced things together from the conduit repo and the commanded docs but I’m getting a failure and stacktrace when I try to run my tests…

---

## [Strange cow\_boy timeout error](https://forum.elixirforum.com/t/strange-cow-boy-timeout-error/28464)

<div class="topic-metadata">

**Author:** [@chungwong](https://forum.elixirforum.com/u/chungwong)\
**Replies:** 2\
**Last updated:** [January 22, 2020, 11:22pm UTC](https://forum.elixirforum.com/t/strange-cow-boy-timeout-error/28464 "2020-01-22T23:22:22Z")

</div>

Since upgraded to Debian 10, I am facing a very strange error on DB connection. from time to time, I would see an error \[error\] #PID\<0.21892.0\> running AuroraWeb.Endpoint (cowboy\_protocol) terminated Server: localhost:…

[Next page](https://forum.elixirforum.com/tag/db-connection/526.md?match_all_tags=true&page=1&tags%5B%5D=db_connection)
