SQL Server Compatibility
Tiberius — Recommended Rust Driver
| Property | Value |
|---|---|
| Repository | prisma/tiberius |
| Version | 0.12.x |
| Type | Pure Rust TDS protocol implementation |
| Maintained by | Prisma team |
TDS Protocol Support
- TDS 7.2 (SQL Server 2008)
- TDS 7.3 (SQL Server 2008 R2)
- TDS 7.4 (SQL Server 2012+)
Features
- Pure Rust (no C dependencies)
- Async-only (Tokio)
- Cross-platform (macOS, Linux, Windows)
- Active maintenance
TLS/SSL Compatibility
SQL Server 2008 R2 uses TLS 1.0/1.1 which is disabled by default in modern systems. Rust’s rustls does not support these deprecated protocols.
Solution: Disable Encryption
For internal network access, disable TLS encryption:
#![allow(unused)]
fn main() {
let mut config = Config::new();
config.host("your_host");
config.port(1433);
config.authentication(AuthMethod::sql_server("user", "password"));
config.database("your_database");
config.trust_cert();
config.encryption(EncryptionLevel::NotSupported);
}
This is the same approach as Python’s Encrypt=no connection string option.
Alternative: Use native-tls Backend
[dependencies]
tiberius = { version = "0.12", default-features = false, features = ["tds73", "native-tls"] }
Then configure OpenSSL to allow legacy TLS:
export OPENSSL_CONF=/path/to/openssl-legacy.cnf
Comparison with Python (pyodbc)
| Feature | Rust (tiberius) | Python (pyodbc) |
|---|---|---|
| SQL Server Support | TDS 7.2-7.4 | Via ODBC driver |
| TLS 1.0 Workaround | EncryptionLevel::NotSupported | Encrypt=no |
| Performance | ~5-7x faster | Baseline |
| Memory | ~10 MB | ~50 MB |
| Dependencies | Pure Rust | Python + ODBC driver |
| Async | Native (Tokio) | No native async |
| Type Safety | Compile-time | Runtime (Pydantic) |
| Deployment | Single binary | Complex |
Current Configuration
[dependencies]
tiberius = { version = "0.12", features = ["tds73", "chrono", "rust_decimal"] }
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7", features = ["compat"] }
Migration Path
When migrating to modern SQL Server (2016+) or PostgreSQL, full TLS 1.2+ encryption can be enabled.