{"id":34683374,"url":"https://github.com/praxiomlabs/rust-mssql-driver","last_synced_at":"2026-04-08T01:02:04.110Z","repository":{"id":329175053,"uuid":"1114563920","full_name":"praxiomlabs/rust-mssql-driver","owner":"praxiomlabs","description":"Async SQL Server driver for Rust — TDS 8.0, built-in pooling, type-state safety, Tokio-native","archived":false,"fork":false,"pushed_at":"2026-04-07T23:11:07.000Z","size":1550,"stargazers_count":13,"open_issues_count":10,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-07T23:19:50.190Z","etag":null,"topics":["async","azure-sql","database","driver","mssql","rust","sql-server","tds","tokio"],"latest_commit_sha":null,"homepage":"https://docs.rs/mssql-client","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/praxiomlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["praxiomlabs"]}},"created_at":"2025-12-11T14:55:34.000Z","updated_at":"2026-04-07T22:58:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/praxiomlabs/rust-mssql-driver","commit_stats":null,"previous_names":["praxiomlabs/rust-mssql-driver"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/praxiomlabs/rust-mssql-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praxiomlabs%2Frust-mssql-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praxiomlabs%2Frust-mssql-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praxiomlabs%2Frust-mssql-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praxiomlabs%2Frust-mssql-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praxiomlabs","download_url":"https://codeload.github.com/praxiomlabs/rust-mssql-driver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praxiomlabs%2Frust-mssql-driver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31535203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","azure-sql","database","driver","mssql","rust","sql-server","tds","tokio"],"created_at":"2025-12-24T21:36:24.290Z","updated_at":"2026-04-08T01:02:04.105Z","avatar_url":"https://github.com/praxiomlabs.png","language":"Rust","funding_links":["https://github.com/sponsors/praxiomlabs"],"categories":[],"sub_categories":[],"readme":"# rust-mssql-driver\n\nA high-performance, async Microsoft SQL Server driver for Rust.\n\n[![Crates.io](https://img.shields.io/crates/v/mssql-client.svg)](https://crates.io/crates/mssql-client)\n[![Documentation](https://docs.rs/mssql-client/badge.svg)](https://docs.rs/mssql-client)\n[![License](https://img.shields.io/crates/l/mssql-client.svg)](LICENSE-MIT)\n[![MSRV](https://img.shields.io/badge/MSRV-1.88-blue.svg)](https://blog.rust-lang.org/2025/06/26/Rust-1.88.0/)\n\n## Features\n\n- **TDS 7.3 – 8.0 Support** - SQL Server 2008+ legacy support through SQL Server 2022+ strict encryption\n- **Tokio-Native** - Designed for the Tokio async runtime with no compatibility layers\n- **Type-State Connections** - Compile-time enforcement of valid connection states\n- **Built-in Connection Pooling** - No external pooling crate required\n- **Reduced-Copy Architecture** - `Arc\u003cBytes\u003e` pattern minimizes allocation overhead\n- **Pure Rust TLS** - Uses rustls, no OpenSSL dependency\n- **Modern Rust** - 2024 Edition, MSRV 1.88\n\n### Feature Status (v0.7.x)\n\n| Feature | Status | Notes |\n|---------|--------|-------|\n| SQL Authentication | ✅ | Username/password |\n| Azure AD Token | ✅ | Pre-acquired tokens |\n| Queries \u0026 Parameters | ✅ | Full support |\n| Transactions | ✅ | Commit, rollback, savepoints |\n| Connection Pooling | ✅ | Built-in via `mssql-driver-pool` |\n| Bulk Insert | ✅ | High-performance batch loading |\n| `#[derive(FromRow)]` | ✅ | Row-to-struct mapping |\n| TDS 7.3 (Legacy) | ✅ | SQL Server 2008/2008 R2 |\n| TDS 8.0 Strict Mode | ✅ | SQL Server 2022+ |\n| Azure Managed Identity | ✅ | Via `azure-identity` |\n| Kerberos/GSSAPI | ✅ | Unix via `libgssapi` |\n| Windows SSPI | ✅ | Via `sspi-auth` feature |\n| Table-Valued Parameters | ✅ | Via `Tvp` type |\n| OpenTelemetry Metrics | ✅ | Via `otel` feature |\n| Always Encrypted | ✅ | Full support with Azure Key Vault and Windows CertStore providers |\n| Query Cancellation | ✅ | ATTENTION signal support |\n| Collation-Aware Decoding | ✅ | 14+ character encodings |\n\n## Installation\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\nmssql-client = \"0.7\"\ntokio = { version = \"1.48\", features = [\"full\"] }\n```\n\n## Quick Start\n\n```rust\nuse mssql_client::{Client, Config};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), mssql_client::Error\u003e {\n    // Connect using a connection string\n    let config = Config::from_connection_string(\n        \"Server=localhost;Database=mydb;User Id=sa;Password=Password123!;TrustServerCertificate=true\"\n    )?;\n\n    let mut client = Client::connect(config).await?;\n\n    // Execute a query\n    let rows = client.query(\"SELECT id, name FROM users WHERE active = @p1\", \u0026[\u0026true]).await?;\n\n    for result in rows {\n        let row = result?;\n        let id: i32 = row.get(0)?;\n        let name: String = row.get(1)?;\n        println!(\"{}: {}\", id, name);\n    }\n\n    client.close().await?;\n    Ok(())\n}\n```\n\n## Connection String Format\n\nThe driver supports ADO.NET-compatible connection strings:\n\n```\nServer=hostname,port;Database=dbname;User Id=user;Password=pass;Encrypt=strict;\n```\n\n### Supported Keywords\n\n| Keyword | Aliases | Description |\n|---------|---------|-------------|\n| `Server` | `Data Source`, `Address` | Host and optional port (e.g., `localhost,1433`) |\n| `Database` | `Initial Catalog` | Database name |\n| `User Id` | `UID`, `User` | SQL authentication username |\n| `Password` | `PWD` | SQL authentication password |\n| `Encrypt` | | `true`, `false`, `strict`, `no_tls` |\n| `TrustServerCertificate` | | Skip certificate validation (dev only) |\n| `TDSVersion` | `ProtocolVersion` | TDS protocol version: `7.3`, `7.3A`, `7.3B`, `7.4`, `8.0` |\n| `Application Name` | | Application identifier |\n| `Connect Timeout` | | Connection timeout in seconds |\n| `Command Timeout` | | Default command timeout |\n\n## Connection Pooling\n\nUse the built-in connection pool for production applications:\n\n```rust\nuse mssql_driver_pool::{Pool, PoolConfig};\nuse mssql_client::Config;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let config = Config::from_connection_string(\"...\")?;\n\n    let pool = Pool::builder()\n        .max_size(10)\n        .min_size(2)\n        .build(config)\n        .await?;\n\n    // Get a connection from the pool\n    let mut conn = pool.get().await?;\n\n    let rows = conn.query(\"SELECT 1\", \u0026[]).await?;\n    // Connection returned to pool when dropped\n\n    Ok(())\n}\n```\n\n## Transactions\n\n```rust\nuse mssql_client::{Client, Config, IsolationLevel};\n\nasync fn transfer_funds(client: \u0026mut Client) -\u003e Result\u003c(), mssql_client::Error\u003e {\n    // Begin transaction with isolation level\n    let mut tx = client.begin_transaction()\n        .isolation_level(IsolationLevel::Serializable)\n        .await?;\n\n    tx.execute(\"UPDATE accounts SET balance = balance - 100 WHERE id = @p1\", \u0026[\u00261i32]).await?;\n    tx.execute(\"UPDATE accounts SET balance = balance + 100 WHERE id = @p1\", \u0026[\u00262i32]).await?;\n\n    // Commit (returns the client)\n    tx.commit().await?;\n\n    Ok(())\n}\n```\n\n### Savepoints\n\n```rust\nlet mut tx = client.begin_transaction().await?;\n\ntx.execute(\"INSERT INTO orders ...\", \u0026[]).await?;\n\n// Create a savepoint\nlet sp = tx.save_point(\"before_items\").await?;\n\ntx.execute(\"INSERT INTO order_items ...\", \u0026[]).await?;\n\n// Rollback to savepoint if needed\ntx.rollback_to(\u0026sp).await?;\n\ntx.commit().await?;\n```\n\n## Derive Macros\n\nMap rows to structs automatically:\n\n```rust\nuse mssql_derive::FromRow;\n\n#[derive(FromRow)]\nstruct User {\n    id: i32,\n    #[mssql(rename = \"user_name\")]\n    name: String,\n    #[mssql(default)]\n    email: Option\u003cString\u003e,\n}\n\nlet rows = client.query(\"SELECT id, user_name, email FROM users\", \u0026[]).await?;\nfor result in rows {\n    let user: User = result?.try_into()?;\n    println!(\"{}: {}\", user.id, user.name);\n}\n```\n\n## Feature Flags\n\n| Feature | Default | Description |\n|---------|---------|-------------|\n| `chrono` | Yes | Date/time type support via chrono |\n| `uuid` | Yes | UUID type support |\n| `decimal` | Yes | Decimal type support via rust_decimal |\n| `encoding` | Yes | Collation-aware VARCHAR decoding |\n| `json` | No | JSON type support via serde_json |\n| `tls` | Yes | TLS/SSL encryption via rustls (disable for `Encrypt=no_tls` environments) |\n| `otel` | No | OpenTelemetry tracing and metrics |\n| `zeroize` | No | Secure credential wiping |\n\n### Authentication Features (mssql-auth crate)\n\n| Feature | Description |\n|---------|-------------|\n| `azure-identity` | Azure Managed Identity and Service Principal |\n| `integrated-auth` | Kerberos/GSSAPI (Linux/macOS) |\n| `sspi-auth` | Windows SSPI (cross-platform via sspi-rs) |\n| `cert-auth` | Client certificate authentication |\n| `zeroize` | Secure credential wiping from memory |\n| `always-encrypted` | Client-side encryption with key providers |\n\nEnable optional features:\n\n```toml\n[dependencies]\nmssql-client = { version = \"0.7\", features = [\"otel\"] }\nmssql-auth = { version = \"0.7\", features = [\"sspi-auth\"] }\n```\n\n## SQL Server Compatibility\n\n| SQL Server Version | Supported | TDS Version | Notes |\n|-------------------|-----------|-------------|-------|\n| 2008 | ✅ | 7.3A | Legacy support |\n| 2008 R2 | ✅ | 7.3B | Legacy support |\n| 2012 | ✅ | 7.4 | |\n| 2014 | ✅ | 7.4 | |\n| 2016 | ✅ | 7.4 | |\n| 2017 | ✅ | 7.4 | Full TLS support |\n| 2019 | ✅ | 7.4 | |\n| 2022+ | ✅ | 8.0 | Strict TLS mode |\n| Azure SQL Database | ✅ | 7.4/8.0 | |\n| Azure SQL Managed Instance | ✅ | 7.4/8.0 | |\n\n**Legacy Support (SQL Server 2008-2016):** Use `Encrypt=no_tls` for servers that don't support TLS 1.2. See [LIMITATIONS.md](LIMITATIONS.md) and [docs/SQL_SERVER_COMPATIBILITY.md](docs/SQL_SERVER_COMPATIBILITY.md) for details.\n\n## API Stability\n\nThis project follows [Semantic Versioning](https://semver.org/).\n\n- **0.x.y**: API may change between minor versions\n- **1.0.0+**: Stable API with backward compatibility guarantees\n\nSee [STABILITY.md](STABILITY.md) for details on what's considered stable.\n\n## Comparison with Tiberius\n\n| Feature | rust-mssql-driver | tiberius |\n|---------|-------------------|----------|\n| TDS 7.3 (SQL 2008) | Configurable | Supported |\n| TDS 8.0 (strict mode) | First-class | Not supported |\n| Connection pooling | Built-in | External (bb8/deadpool) |\n| Runtime | Tokio-native | Runtime agnostic |\n| Prepared statement cache | Automatic LRU | Per-execution |\n| Azure SQL redirects | Automatic | Manual handling |\n| Type-state connections | Yes | No |\n\n## Examples\n\nSee the [`examples/`](crates/mssql-client/examples/) directory:\n\n- [`basic.rs`](crates/mssql-client/examples/basic.rs) - Connection and queries\n- [`transactions.rs`](crates/mssql-client/examples/transactions.rs) - Transaction handling\n- [`streaming.rs`](crates/mssql-client/examples/streaming.rs) - Streaming large results\n- [`bulk_insert.rs`](crates/mssql-client/examples/bulk_insert.rs) - Bulk data loading\n- [`derive_macros.rs`](crates/mssql-client/examples/derive_macros.rs) - Row mapping macros\n\n## Documentation\n\n### API \u0026 Reference\n\n- [API Documentation](https://docs.rs/mssql-client) - Full API reference on docs.rs\n- [ARCHITECTURE.md](ARCHITECTURE.md) - Design decisions, ADRs, and internals\n- [CHANGELOG.md](CHANGELOG.md) - Version history and release notes\n\n### Guides \u0026 Policies\n\n- [STABILITY.md](STABILITY.md) - API stability guarantees and versioning policy\n- [SECURITY.md](SECURITY.md) - Security policy, threat model, and best practices\n- [LIMITATIONS.md](LIMITATIONS.md) - Known limitations and explicit non-goals\n- [PRODUCTION_READINESS.md](PRODUCTION_READINESS.md) - Production readiness checklist\n\n### Operational Docs\n\n- [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) - Production deployment guide\n- [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) - Common issues and solutions\n- [docs/CONNECTION_RECOVERY.md](docs/CONNECTION_RECOVERY.md) - Connection recovery and resilience\n- [docs/ERRORS.md](docs/ERRORS.md) - Error codes and handling\n- [docs/RETRY_STRATEGY.md](docs/RETRY_STRATEGY.md) - Retry policies and backoff\n- [docs/TIMEOUTS.md](docs/TIMEOUTS.md) - Timeout configuration\n- [docs/POOL_METRICS.md](docs/POOL_METRICS.md) - Pool metrics and monitoring\n- [docs/MIGRATION_FROM_TIBERIUS.md](docs/MIGRATION_FROM_TIBERIUS.md) - Migration guide\n\n### Crate-Specific Documentation\n\nEach crate has its own README with crate-specific documentation:\n\n| Crate | Description |\n|-------|-------------|\n| [`mssql-client`](crates/mssql-client/README.md) | Main client API |\n| [`mssql-driver-pool`](crates/mssql-pool/README.md) | Connection pooling |\n| [`mssql-derive`](crates/mssql-derive/README.md) | Derive macros |\n| [`mssql-types`](crates/mssql-types/README.md) | Type conversions |\n| [`mssql-auth`](crates/mssql-auth/README.md) | Authentication providers |\n| [`mssql-tls`](crates/mssql-tls/README.md) | TLS negotiation |\n| [`tds-protocol`](crates/tds-protocol/README.md) | TDS protocol layer |\n| [`mssql-codec`](crates/mssql-codec/README.md) | Async framing |\n| [`mssql-testing`](crates/mssql-testing/README.md) | Test infrastructure |\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nLicensed under either of:\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Acknowledgments\n\nThis project builds on learnings from [tiberius](https://github.com/prisma/tiberius) and the [MS-TDS protocol specification](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraxiomlabs%2Frust-mssql-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraxiomlabs%2Frust-mssql-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraxiomlabs%2Frust-mssql-driver/lists"}