pub struct Database { /* private fields */ }Expand description
ADBC Database connection factory.
The Database type represents a database connection configuration and
serves as a factory for creating Connection instances. It encapsulates
the connection parameters and provides methods to establish connections.
§Example
Implementations§
Source§impl Database
impl Database
Sourcepub fn new(params: ConnectionParams) -> Self
pub fn new(params: ConnectionParams) -> Self
Sourcepub fn params(&self) -> &ConnectionParams
pub fn params(&self) -> &ConnectionParams
Sourcepub fn connection_string(&self) -> &str
pub fn connection_string(&self) -> &str
Get the connection string (without password).
§Returns
A safe display version of the connection string.
Sourcepub async fn connect(&self) -> Result<Connection, ConnectionError>
pub async fn connect(&self) -> Result<Connection, ConnectionError>
Sourcepub async fn test_connection(&self) -> Result<(), ConnectionError>
pub async fn test_connection(&self) -> Result<(), ConnectionError>
Test the connection without establishing a persistent connection.
This attempts to connect to the database and immediately closes the connection, verifying that the connection parameters are valid.
§Returns
Ok(()) if the connection test succeeds.
§Errors
Returns ConnectionError if the connection test fails.
§Example
Trait Implementations§
Source§impl FromStr for Database
impl FromStr for Database
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parse a connection string to create a Database instance.
§Arguments
s- Connection string in the format:exasol://[username[:password]@]host[:port][/schema][?param=value&...]
§Returns
A Database instance configured with the parsed parameters.
§Errors
Returns ConnectionError if the connection string is invalid.