Simple interaction with a database

The easiest way to interact with a database is to create a single connection directly to the database. Simple interaction is a straightforward database connection that doesn't use connection pools or other abstractions to maximize performance.

To connect to a PostgreSQL database, we can use two crates: postgres or r2d2_postgres. The first is a generic connection driver. The second, r2d2_postgres, is a crate for the r2d2 connection pools crate. We will start by using the postgres crate directly, without a pool from the r2d2 crate, and work on a simple utility to create a table, before adding commands to manipulate the data in that table.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.171.51