Oracle DB
Oracle Database is a multi-model database management system produced and marketed by Oracle Corporation.
diesel_oci
diesel_oci
⮳ is an OCI database adapter for diesel
⮳. "Oracle Call Interface" is the comprehensive native C language interface to Oracle Database.
// COMING SOON
Connect to an Oracle Database with oracle
oracle
⮳ provides Oracle DB bindings for Rust. This crate provides a safe and ergonomic interface to Oracle databases.
use std::env;
use dotenvy::dotenv;
use oracle::Connection;
use oracle::Error;
// Rust bindings to ODPI-C
// Add to your `.env` file:
// ORACLE_DB_USERNAME=your_username
// ORACLE_DB_PASSWORD=your_password
// ORACLE_DB_URL=your_db_host:port/your_service_name
#[tokio::main]
async fn main() -> Result<(), Error> {
// Load environment variables from a .env file (for secure handling of
// credentials)
dotenv().ok();
// Fetch the connection details from environment variables
let username =
env::var("ORACLE_DB_USERNAME").expect("ORACLE_DB_USERNAME not set");
let password =
env::var("ORACLE_DB_PASSWORD").expect("ORACLE_DB_PASSWORD not set");
let db_url = env::var("ORACLE_DB_URL").expect("ORACLE_DB_URL not set");
// Connect to the Oracle database
let conn = Connection::connect(&username, &password, &db_url)?;
// Query the database (example: retrieve the database name;
// user_tables is a common system table in Oracle)
let sql = "SELECT * FROM user_tables WHERE ROWNUM <= 5";
let mut stmt = conn.statement(sql).build()?;
// Execute the query and fetch results
let rows = stmt.query(&[])?;
// Iterate over the rows and print the results
for row in rows {
let row = row?;
// Print each column's value
// (assuming the result has one column, adjust as needed)
println!("Table: {}", row.get::<_, String>(0)?);
}
conn.close()?;
Ok(())
}
sibyl
sibyl
⮳ offers an OCI-based (synchronous or asynchronous) interface between Rust applications and Oracle databases.
// // COMING SOON