Crate deadpool_oracle

Crate deadpool_oracle 

Source
Expand description

Deadpool connection pool for Oracle databases

This crate provides a connection pool for the oracle-rs driver using the deadpool async pool library.

§Example

use oracle_rs::Config;
use deadpool_oracle::{Pool, PoolBuilder};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create connection config
    let config = Config::new("localhost", 1521, "FREEPDB1", "user", "password");

    // Create pool
    let pool = PoolBuilder::new(config)
        .max_size(10)
        .build()?;

    // Get a connection from the pool
    let conn = pool.get().await?;

    // Use the connection
    let result = conn.query("SELECT * FROM users", &[]).await?;
    println!("Found {} rows", result.row_count());

    // Connection is automatically returned to the pool when dropped
    Ok(())
}

Structs§

BuildError
Error that can occur when building a connection pool
OracleConnectionManager
Manager for creating and recycling Oracle connections
PoolBuilder
Builder for creating connection pools with custom configuration

Traits§

ConfigExt
Extension trait for creating pools directly from Config

Type Aliases§

Object
Type alias for a pooled connection
Pool
Type alias for the connection pool
PoolError
Error that can occur when getting a connection from the pool