Επεξεργασία

Microsoft SQL drivers and frameworks

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics SQL database in Microsoft Fabric

Applications use a driver or data provider to connect to Microsoft SQL products. Many applications also use a framework, object-relational mapper (ORM), or other data access library on top of the driver.

  • A driver or provider handles network communication, authentication, commands, transactions, parameters, and results.
  • A framework or data access library uses a driver or provider and adds capabilities such as object mapping, query generation, change tracking, migrations, or integration with an application framework.

Choose the driver or provider for your language and platform first. Then, if your application needs a higher-level programming model, choose a compatible framework or library. A framework doesn't replace the underlying driver.

Support for the driver and support for the framework are separate. Microsoft support for a driver doesn't include support for a third-party framework that uses the driver.

Choose a driver or provider

The following table lists the primary drivers and providers covered in this documentation. Review the linked product documentation for supported operating systems, runtime versions, SQL products, authentication methods, and features.

Language or platform Driver or provider Ownership and support
.NET Microsoft.Data.SqlClient Microsoft provider for new .NET development.
C and C++ Microsoft ODBC Driver for SQL Server Microsoft ODBC driver.
C and C++ Microsoft OLE DB Driver for SQL Server Microsoft OLE DB provider.
Go go-mssqldb Official Microsoft Go driver that implements the standard database/sql interfaces.
Java Microsoft JDBC Driver for SQL Server Microsoft JDBC driver.
Node.js Tedious Community-supported driver. Microsoft contributes to the project, but it doesn't come with Microsoft support.
PHP Microsoft Drivers for PHP for SQL Server Microsoft SQLSRV and PDO_SQLSRV extensions. The extensions use Microsoft ODBC Driver for SQL Server.
Python mssql-python Microsoft Python driver.
Ruby TinyTDS Community-supported driver. Ruby and TinyTDS don't come with Microsoft support.

For Apache Spark, use the built-in Spark JDBC data source with Microsoft JDBC Driver for SQL Server. The Microsoft SQL Spark connector is archived and isn't under active development.

Choose a framework or data access library

The following table lists frameworks and data access libraries that support Microsoft SQL products through a provider, adapter, or database dialect. The list isn't exhaustive.

Language Framework or library Microsoft SQL integration Ownership and support
.NET Entity Framework Core SQL Server provider Microsoft.Data.SqlClient Microsoft-maintained provider in Entity Framework Core.
.NET Entity Framework 6 SQL Server provider Microsoft.Data.SqlClient Microsoft provider for existing Entity Framework 6 applications.
.NET Dapper Extends ADO.NET DbConnection; use with Microsoft.Data.SqlClient. Third-party micro-ORM.
Go GORM go-mssqldb Third-party ORM. The linked article shows how to use its Microsoft SQL dialect.
Go sqlx go-mssqldb Third-party library that extends database/sql with mapping and query helpers.
Java Hibernate ORM Microsoft SQL dialect over JDBC; use with Microsoft JDBC Driver for SQL Server. Third-party ORM.
Node.js and TypeScript Prisma ORM Built-in sqlserver provider; Prisma 7 can use its node-mssql driver adapter. Third-party ORM.
Node.js and TypeScript Sequelize Microsoft SQL dialect based on Tedious. Third-party ORM.
Node.js and TypeScript TypeORM Microsoft SQL data source based on node-mssql and Tedious. Third-party ORM.
PHP Laravel Eloquent Microsoft SQL connection through SQLSRV and PDO_SQLSRV. Third-party web framework and ORM.
PHP Doctrine DBAL and ORM Microsoft SQL connection through the pdo_sqlsrv or sqlsrv driver. Third-party database abstraction layer and ORM.
Python mssql-django mssql-python or pyodbc in mssql-django 2.0. Microsoft Django database backend.
Python SQLAlchemy Depends on the selected Microsoft SQL dialect. Third-party toolkit and ORM. Review the linked integration guidance and its version requirements.
Ruby Active Record SQL Server Adapter Microsoft SQL adapter for Ruby on Rails based on TinyTDS. Community-supported adapter.

When you evaluate a framework or library:

  • Confirm that its provider, adapter, or dialect supports the Microsoft SQL product, authentication method, and features your application needs.
  • Check the framework's maintenance status, release policy, and support channel.
  • For connectivity problems, reproduce the issue with the underlying driver when possible. A direct-driver reproduction helps determine whether the issue belongs to the driver or the higher-level framework.