Edit

Share via


Connect to ODBC data sources with PolyBase on SQL Server on Linux

Applies to: SQL Server 2025 (17.x) Preview

This article describes how you can use PolyBase services with SQL Server on Linux.

Beginning with SQL Server 2025 (17.x) Preview, deployments on Linux can use ODBC data sources for PolyBase. This allows you to bring your own driver (BYOD). On Linux, this feature works similarly to how it works on Windows. For more information, see Configure PolyBase to access external data with ODBC generic types.

Caution

The bring-your-own-driver (BYOD) model involves risks that are the responsibility of the customer and the driver provider. Microsoft isn't responsible for any issues the third-party driver could cause.

Examples

Install on Linux

The following example demonstrates the SQL ODBC driver on Ubuntu.

  1. Add the Microsoft repository:

    1. Import the Microsoft GPG key

      curl https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
      
    2. Add the Microsoft repository to your system

      curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
      
  2. Update the package list

    sudo apt update
    
  3. Install the ODBC Driver

    Install the latest version of the ODBC driver. The following example installs version 18.

    sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
    

Installation creates the following files:

File Description
/etc/odbcinst.ini Driver name, description, and version information.
/etc/odbc.ini DNS name, encryption, and other specifications.

You need to create the odbc.ini file based on the driver's properties and specifications. Multiple drivers share the same odbc.ini and odbcinst.ini files, with multiple entries.

Example files

Example odbc.ini

In this example, driver_name must match the name from odbcinst.ini.

[MyDSN]
Driver = driver_name
Server = your_server_name
Database = your_database_name
Trusted_Connection = yes

Sybase example odbcinst.ini

[ODBC Drivers]
Devart ODBC Driver for ASE=installed
[Devart ODBC Driver for ASE]
Driver=/usr/share/devart/odbcase/libdevartodbcase.3.5.0.so

Sybase example odbc.ini

[ODBC Data Sources]
DEVART_ASE=Devart ODBC Driver for ASE
[DEVART_ASE]
Driver=Devart ODBC Driver for ASE
Data Source=database_server_ip
Port=5000
Database=master
QuotedIdentifier=1

For the full list of supported parameters check the driver's provider documentation.

Example queries

Once the driver setup is complete, you can use database scoped credential, external data source, and other PolyBase.

For example:

CREATE DATABASE SCOPED CREDENTIAL dsc_Sybase
    WITH IDENTITY = '<user>', SECRET = '<password>';
GO

CREATE EXTERNAL DATA SOURCE EDS_Sybase
WITH (
    LOCATION = 'odbc://<servername>:<port>',
    PUSHDOWN = ON, --- optional
    CONNECTION_OPTIONS = 'DSN=DEVART_ASE;DRIVER=Devart ODBC Driver for ASE',
    CREDENTIAL = dsc_Sybase
);
GO

CREATE EXTERNAL TABLE T_EXT
(
    C1 INT
)
WITH (
    DATA_SOURCE = [EDS_SYBASE],
    LOCATION = N'TEST.DBO.T'
);
GO

SELECT * FROM T_EXT;
GO

Limitations

PolyBase for SQL Server on Linux uses an external service to safely isolate and load the drivers. This service is started by default when the PolyBase package (mssql-server-polybase) is installed.

The service uses the default port number 25100. If this port is in use, it fails with the following message:

Failed to bind port "127.0.0.1:25100"

You can find this message in PolyBase's log file, located at: /var/opt/mssql-polybase-ees/log/

To fix, customize the service to use an available port and restart.

  1. Find and edit the /var/opt/mssql/binn/PolyBase/DMs.exe.config file. Locate the key entry EESPort, and assign the new port.

  2. Find and edit the /var/opt/mssql/binn/PolyBase/DWEngineService.exe.config file. Locate the key entry EESPort, and assign the new port.

  3. Run the following command to restart the service informing the new port:

    sudo /opt/mssql/lib/dotnet6/dotnet/opt/mssql/lib/ExternalExecutionService.dll -port <newportnumber>