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§
- Build
Error - Error that can occur when building a connection pool
- Oracle
Connection Manager - Manager for creating and recycling Oracle connections
- Pool
Builder - Builder for creating connection pools with custom configuration
Traits§
- Config
Ext - Extension trait for creating pools directly from Config