Database connection
A database connection is an active communication channel or session through which software sends operations to and receives results from a database system.
Practices of the Python Pro
A database connection is an active communication link through which software sends commands to and receives data from a database.
- How it is used
- Supports the persistence layer by providing the link required to execute SQL statements against stored application data.
- How deep it goes
- Defines creation, cursor execution, context management, and cleanup, then applies connections to CRUD operations.
- Examples
- Uses a SQLite database file, a DatabaseManager class, cursors, and parameterized INSERT, DELETE, and SELECT statements.
- What you can do after
- Operate/configure a SQLite connection and use it to execute parameterized queries through a small database manager.
Read how Practices of the Python Pro explains database connection →
Build Financial Software with Generative AI (From Scratch)
A database connection is a communication session through which an application accesses a database server.
- How it is used
- Stores raw and parsed ACH records so later dashboard views can aggregate ACH data.
- How deep it goes
- Walks through connecting, cursors, Docker host and port errors, inserts, commits, cleanup, and connection injection without detailing database-server internals.
- Examples
- Uses ACH file rows and headers, localhost PostgreSQL, cursor-based inserts, pytest fixtures, and table truncation.
- What you can do after
- Operate/configure it to connect an ACH parser to local PostgreSQL, persist records, and diagnose common hostname or port failures.
Read how Build Financial Software with Generative AI (From Scratch) explains database connection →
Coding with AI
A database connection is an active communication link through which software accesses a database and submits operations.
- How it is used
- Connects a Flask application and its Questions class to SQLite so database data can populate a rendered page.
- How deep it goes
- Demonstrates opening, querying, fetching, passing, and closing connections, but does not develop connection internals.
- Examples
- Uses data/questions.db, a users query, the Questions class, and a Flask route that renders fetched database data.
- What you can do after
- Build it from scratch with sqlite3, integrate the connection into a class, and supply fetched data to a Flask template.
Learn Haskell by Example
A database connection is an object representing an active communication channel to a database.
- How it is used
- Coordinates SQLite setup, queries, updates, inserts, and retrievals across a database-access module.
- How deep it goes
- Defines opening, query execution, transactions, error handling, and module organization without descending into connection internals.
- Examples
- Uses an in-memory SQLite table, parameterized insertion, row retrieval, batch updates, named parameters, and TodoEntry actions.
- What you can do after
- Operate/configure SQLite access by opening a connection and passing it to setup, query, modification, transaction, and retrieval functions.
Read how Learn Haskell by Example explains database connection →
PostgreSQL Mistakes and How to Avoid Them
A database connection is an active communication session between a client and a database server.
- How it is used
- Frames connection limits as a PostgreSQL performance and capacity decision.
- How deep it goes
- Benchmarks concurrency through TPS and latency, but stops short of connection-pool design or session internals.
- Examples
- Uses PostgreSQL configuration values, pgbench commands, and a client-count comparison table.
- What you can do after
- Diagnose excessive concurrency by comparing pgbench throughput and latency across client counts.
Read how PostgreSQL Mistakes and How to Avoid Them explains database connection →
Python Concurrency with asyncio
- How it is used
- Establishes access to Postgres so asynchronous applications can verify connectivity and execute product-database queries.
- How deep it goes
- Explains connection setup, version verification, closure, parameterized inserts, and a concurrent-use failure.
- Examples
- Uses an e-commerce product database, server-version output, and randomized brand, product, and SKU inserts.
- What you can do after
- Operate/configure an asyncpg connection, execute parameterized database operations, verify access, and close the connection.
Read how Python Concurrency with asyncio explains database connection →
Related concepts
- connection poolingused by · Connection pooling is a resource-management technique that maintains a collection of established connections for reuse across multiple operations.
- readiness checkused by · A readiness check is a health probe that determines whether a running service or workload is prepared to receive requests or traffic.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.





