Fix 'DataSource.Error: OLE DB or ODBC error' in Power Query When Connecting to a Database

intermediateπŸ“Š Microsoft Excel2026-05-05| Microsoft Excel 2016/2019/2021/Microsoft 365, Power Query, Windows 10/11 (32-bit and 64-bit)

Error Message

DataSource.Error: OLE DB or ODBC error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
#power-query#odbc#ole-db#data-source#excel

TL;DR

Power Query can't find your ODBC data source. Either the DSN (Data Source Name) doesn't exist on this machine, the driver isn't installed, or there's a 32-bit vs 64-bit mismatch. Open ODBC Data Sources from Control Panel, check the DSN under the correct architecture, and install the matching driver if it's missing.

What triggers this error

The full error message in Power Query:

DataSource.Error: OLE DB or ODBC error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

Windows ODBC Driver Manager received a connection request β€” and came up empty. No matching data source, no matching driver. Three culprits:

  • The DSN doesn't exist here β€” someone set it up on their own machine and never replicated it to yours.
  • The driver is missing β€” SQL Server, MySQL, Oracle β€” whichever driver you need isn't installed.
  • Architecture mismatch β€” 64-bit Excel is looking in the 64-bit ODBC registry, but the DSN was registered in the 32-bit one. Or the other way around.

Fix 1: Check and create the DSN

First, open the right ODBC manager. This depends on which Excel you have:

  • 64-bit Excel: Run %SystemRoot%\System32\odbcad32.exe, or search ODBC Data Sources (64-bit) in Start.
  • 32-bit Excel: Run %SystemRoot%\SysWOW64\odbcad32.exe instead.

Go to the System DSN tab. If your DSN isn't there, click Add and create it β€” fill in the driver, server address, and database name.

Important: Always use System DSN for Power Query. User DSN breaks the moment a service account or a different Windows user tries to refresh the query. That's a painful bug to track down on a Monday morning.

Fix 2: Install the missing ODBC driver

No drivers showing up in the Create New Data Source list? That's your answer right there β€” install the driver first.

  • SQL Server: Microsoft ODBC Driver 17 or 18 for SQL Server
  • MySQL: MySQL Connector/ODBC 8.0
  • PostgreSQL: psqlODBC
  • Oracle: Oracle Instant Client + ODBC driver

Install the same bitness as your Excel β€” 64-bit Excel needs the 64-bit driver. After installation, reopen ODBC Data Sources and confirm the driver now appears in the list before creating a DSN.

Fix 3: Resolve the 32-bit / 64-bit mismatch

This one trips up a lot of people. The DSN exists β€” just in the wrong place.

Windows stores DSNs in two separate registry locations:

  • 64-bit apps: HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
  • 32-bit apps: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI

To check your Excel version: File β†’ Account β†’ About Excel. If it's 32-bit, the title bar says (32-bit). 64-bit shows nothing extra.

Once you know which you're running, open the matching ODBC manager and check if the DSN is there. If it's only registered in the wrong manager, recreate it in the correct one. Takes about two minutes.

Fix 4: Switch to a DSN-less connection string

Here's a cleaner long-term solution: skip the DSN entirely. Embed the connection string directly in Power Query's M code. The workbook becomes portable β€” no DSN setup required on each machine.

// In Power Query Advanced Editor:
let
    Source = Odbc.DataSource(
        "Driver={ODBC Driver 17 for SQL Server};Server=myserver;Database=mydb;Trusted_Connection=yes;",
        [HierarchicalNavigation = true]
    )
in
    Source

For MySQL on a specific IP:

Odbc.DataSource(
    "Driver={MySQL ODBC 8.0 Unicode Driver};Server=192.168.1.10;Database=mydb;UID=user;PWD=password;"
)

For OLE DB (Access, Excel files, or SQL Server via OLE DB):

OleDb.DataSource(
    "Provider=SQLOLEDB;Data Source=myserver;Initial Catalog=mydb;Integrated Security=SSPI;"
)

As long as the driver is installed on the machine, this just works. No DSN registry entries to maintain, no architecture confusion.

Fix 5: Check Power Query's formula firewall

Occasionally this error isn't about the DSN at all β€” it's Power Query's formula firewall blocking a cross-source query. Go to File β†’ Options and Settings β†’ Query Options β†’ Privacy and set the level to Ignore Privacy Levels. Only do this in trusted internal environments. Then refresh the query and see if it clears.

Verify the fix

  • Open ODBC Data Sources (correct bitness) β†’ confirm DSN exists under System DSN.
  • Select the DSN β†’ click Configure β†’ Test. It should say Connection successful.
  • Back in Excel: Data β†’ Queries & Connections, right-click your query β†’ Refresh.
  • Using a DSN-less string? Paste the M code into Advanced Editor, click Done β€” the preview pane should load data with no errors.

Quick diagnostic checklist

  • Excel bitness matches ODBC driver bitness? βœ“
  • DSN exists under System DSN (not just User DSN)? βœ“
  • Driver appears in the ODBC drivers list? βœ“
  • DSN test passes from ODBC manager? βœ“
  • Firewall/network allows connection to the DB host and port (e.g., 1433 for SQL Server, 3306 for MySQL)? βœ“

Further reading

  • Microsoft Docs: Odbc.DataSource M function reference
  • Microsoft ODBC Driver for SQL Server β€” download page
  • Power Query privacy levels and formula firewall explained

Related Error Notes