activerecord-sqlserver-adapter
activerecord-sqlserver-adapter is a Ruby gem that enables Rails applications to use Microsoft SQL Server as their database. It translates Rails' ActiveRecord ORM calls into SQL Server-compatible queries, supporting SQL Server 2012 and later with proper handling of SQL Server-specific features like identity inserts and stored procedures.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | rails-sqlserver/activerecord-sqlserver-adapter |
| Owner | rails-sqlserver |
| Primary language | Ruby |
| License | MIT — OSI-approved |
| Stars | 982 |
| Forks | 556 |
| Open issues | 22 |
| Latest release | Unknown |
| Last updated | 2026-07-04 |
| Source | https://github.com/rails-sqlserver/activerecord-sqlserver-adapter |
What activerecord-sqlserver-adapter is
The adapter implements Rails' AbstractAdapter interface for SQL Server connectivity via TinyTDS and FreeTDS. It supports native SQL Server data types (datetime2, datetimeoffset, time with TDS 7.3+), OUTPUT INSERTED queries for identity retrieval, stored procedure execution, SHOWPLAN explain support, and schema management. Versioning tracks Rails majors (adapter 8.x for Rails 8.x).
Get the activerecord-sqlserver-adapter source
Clone the repository and explore it locally.
git clone https://github.com/rails-sqlserver/activerecord-sqlserver-adapter.gitcd activerecord-sqlserver-adapter# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Rails version must match adapter version exactly (e.g., adapter 8.1.x requires Rails 8.1.x); patch versions do not auto-cross-upgrade.
- TinyTDS and FreeTDS 1.0+ are required; TDS version 7.3 must be explicitly set or defaulted for advanced data types (datetime2, datetimeoffset, time).
- Tables with triggers require explicit adapter configuration (exclude_output_inserted_table_names) to use temporary table workaround instead of simple OUTPUT INSERTED.
- SQL Server schema and user setup may require table_name_prefix configuration (e.g., 'dbo.') depending on permissions and schema naming.
- Stored procedure execution requires custom model methods; no built-in Rails convention support, requiring manual SQL knowledge.
When to avoid it — and what to weigh
- PostgreSQL/MySQL Standardization — If your organization standardizes on open-source databases, SQL Server adds licensing and tooling complexity; consider postgres or mysql adapters instead.
- No SQL Server Infrastructure — Setting up SQL Server solely to use Rails is not cost-effective compared to native-supported databases; adds operational overhead without strategic benefit.
- Cross-Database Portability Required — Applications needing to run on multiple databases will face SQL Server-specific code (triggers, OUTPUT INSERTED workarounds, schema reflection) that complicates portability.
- Minimal Support Budget — SQL Server licensing, TinyTDS/FreeTDS dependency complexity, and smaller community (vs. PostgreSQL) mean less readily available support and slower issue resolution.
License & commercial use
MIT License. Permissive open-source license allowing commercial use, modification, and redistribution with attribution and warranty disclaimer. No additional restrictions on commercial deployment.
MIT License permits unrestricted commercial use. However, SQL Server itself (the database engine) requires licensing from Microsoft unless using Express Edition (limited to 10 GB and 1 CPU core); verify your SQL Server licensing separately. The adapter code carries no commercial restrictions.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
No security vulnerabilities or posture details provided in available data. Standard ActiveRecord SQL injection protections apply (parameterized queries via adapter). Dependent on TinyTDS/FreeTDS security updates; monitor those libraries. SQL Server authentication (Windows vs. SQL Auth) and connection encryption (appname, TLS) are configurable but not enforced by default; review your database.yml and configure_connection patterns for compliance needs.
Alternatives to consider
PostgreSQL with activerecord-postgresql-adapter
Native Rails support, open-source, lower licensing cost, wider ecosystem, better cross-platform portability, and larger community. Choose if SQL Server is not a hard requirement.
MySQL/MariaDB with activerecord-mysql2-adapter
Open-source, ubiquitous hosting, simple setup, lower operational overhead than SQL Server. Trade-off: fewer enterprise features (no native window functions, less mature stored procedure tooling).
Direct ODBC/TDS clients without Rails ORM
For applications requiring deep SQL Server-specific features or performance tuning beyond ORM abstraction, raw SQL via gems like sequel or arel may offer more control but sacrifice Rails conventions.
Build on activerecord-sqlserver-adapter with DEV.co software developers
Assess whether SQL Server aligns with your infrastructure and licensing model. Review TinyTDS/FreeTDS dependencies and version compatibility with your target Rails release before committing.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
activerecord-sqlserver-adapter FAQ
What Rails versions are supported?
Do I need a separate SQL Server license to use this adapter?
What data types are supported?
How do I handle tables with triggers?
Software developers & web developers for hire
From first prototype to production, DEV.co delivers software development services around tools like activerecord-sqlserver-adapter. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source databases and beyond.
Evaluate SQL Server for Your Rails Stack
Assess whether SQL Server aligns with your infrastructure and licensing model. Review TinyTDS/FreeTDS dependencies and version compatibility with your target Rails release before committing.