Available on crate feature
odbc
only.Expand description
ODBC database driver (via odbc-api
).
§Connection Strings
When using the Any
connection type, SQLx accepts standard ODBC connection strings:
// DSN-based connection
DSN=MyDataSource;UID=myuser;PWD=mypassword
// Driver-based connection
Driver={ODBC Driver 17 for SQL Server};Server=localhost;Database=test
// File DSN
FILEDSN=/path/to/myfile.dsn
The odbc:
URL scheme prefix is optional but still supported for backward compatibility:
odbc:DSN=MyDataSource
§Buffer Configuration
You can configure buffer settings for performance tuning:
use std::str::FromStr;
use sqlx_core_oldapi::odbc::{OdbcConnectOptions, OdbcBufferSettings};
let mut opts = OdbcConnectOptions::from_str("DSN=MyDataSource")?;
// Configure for high-throughput buffered mode
opts.buffer_settings(OdbcBufferSettings {
batch_size: 256, // Fetch 256 rows at once
max_column_size: Some(2048), // Limit text columns to 2048 chars
});
// Configure for unbuffered mode (no truncation, row-by-row processing)
opts.buffer_settings(OdbcBufferSettings {
batch_size: 128, // batch_size ignored in unbuffered mode
max_column_size: None, // Enable unbuffered mode
});
// Or configure individual settings
opts.batch_size(512)
.max_column_size(Some(1024));
// Switch to unbuffered mode
opts.max_column_size(None);
Modules§
Structs§
- Column
Data - Container for column data with type information
- Odbc
- Odbc
Arguments - Odbc
Batch - Odbc
Buffer Settings - Configuration for ODBC buffer settings that control memory usage and performance characteristics.
- Odbc
Column - Odbc
Connect Options - Odbc
Connection - A connection to an ODBC-accessible database.
- Odbc
Query Result - OdbcRow
- Odbc
Statement - Odbc
Statement Metadata - Odbc
Transaction Manager - Odbc
Type Info - Type information for an ODBC type.
- Odbc
Value - Odbc
Value Ref
Enums§
- Odbc
Argument Value - Odbc
Value Type - Individual ODBC value type
- Odbc
Value Vec - Enum containing owned column data for all supported ODBC types
Traits§
- Data
Type Ext - Extension trait for DataType with helper methods
- Odbc
Executor - An alias for
Executor<'_, Database = Odbc>
.
Type Aliases§
- Odbc
Pool - An alias for
Pool
, specialized for ODBC. - Odbc
Pool Options - An alias for
PoolOptions
, specialized for ODBC.