diff --git a/Cargo.toml b/Cargo.toml
index 9b4cfdc..327da7f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,6 +32,8 @@ log = "0.4" # Logging facade
rhai = { version = "1.12.0", features = ["sync"] } # Embedded scripting language
rand = "0.8.5" # Random number generation
clap = "2.33" # Command-line argument parsing
+r2d2 = "0.8.10"
+r2d2_postgres = "0.18.2"
# Optional features for specific OS functionality
[target.'cfg(unix)'.dependencies]
diff --git a/src/postgresclient/postgresclient.rs b/src/postgresclient/postgresclient.rs
index a9595c3..b2e4baa 100644
--- a/src/postgresclient/postgresclient.rs
+++ b/src/postgresclient/postgresclient.rs
@@ -1,7 +1,11 @@
use lazy_static::lazy_static;
+use postgres::types::ToSql;
use postgres::{Client, Error as PostgresError, NoTls, Row};
+use r2d2::Pool;
+use r2d2_postgres::PostgresConnectionManager;
use std::env;
use std::sync::{Arc, Mutex, Once};
+use std::time::Duration;
// Helper function to create a PostgreSQL error
fn create_postgres_error(_message: &str) -> PostgresError {
@@ -22,6 +26,8 @@ fn create_postgres_error(_message: &str) -> PostgresError {
// Global PostgreSQL client instance using lazy_static
lazy_static! {
static ref POSTGRES_CLIENT: Mutex