Fix SAP HANA ADO Connection and DSN Errors in Excel VBA
Question details
Resolve a data source or default driver not found error when attempting to connect to an SAP HANA database using ADO in VBA.

- Product
- Excel
- Device & OS
- Windows
- Scenario
- Running an SAP HANA stored procedure from Excel VBA using an ADO connection and an ODBC DSN.
- Observed behavior
- Excel VBA returns a data source or default driver error and fails to connect, even though the ODBC DSN has already been created.
Check whether your installed version of Microsoft Office is 32-bit or 64-bit, as your ODBC DSN and SAP HANA driver must perfectly match this architecture.
Match ODBC DSN and Driver Architecture with Office
The most common cause for this ADO connection error is using a 32-bit DSN with 64-bit Office, or vice versa. You must configure the DSN using the correct ODBC Administrator tool corresponding to your Office installation.
Windows maintains separate registries and tools for 32-bit and 64-bit ODBC connections. If your Excel application is 32-bit, it cannot detect a 64-bit DSN, leading directly to the 'data source not found' error.
Open Excel, navigate to File > Account, and click on 'About Excel' to confirm whether you are running the 32-bit or 64-bit version.
On 64-bit Windows, press Windows + R. For 64-bit Office, type 'C:\Windows\System32\odbcad32.exe' and press Enter. For 32-bit Office, type 'C:\Windows\SysWOW64\odbcad32.exe' and press Enter.
In the ODBC Data Source Administrator window, create or verify your System DSN. Ensure that the SAP HANA ODBC driver is properly installed for this architecture and selected from the driver list.
Open your VBA editor and check your ADO connection string. Ensure that the DSN name specified exactly matches the name you just configured in the ODBC Administrator tool.

Experience Seamless Spreadsheet Processing with WPS Office
If you frequently encounter complex driver issues, architecture limitations, or sluggish performance in Microsoft Office, consider trying WPS Office. It provides a lightweight, highly compatible environment for advanced data processing, macro execution, and daily spreadsheet tasks without the bloat.

Frequently Asked Questions
Why do I get a data source not found error when my DSN is already created?
This typically occurs due to an architecture mismatch. If you configured a 64-bit DSN but are running a 32-bit version of Excel, VBA will not be able to locate the 64-bit DSN and will throw a 'data source not found' error.
How can I fix the SAP HANA ODBC driver error in my connection string?
Ensure that the SAP HANA ODBC driver is properly installed for your specific Office bitness (32-bit or 64-bit). Additionally, verify that the driver name specified in your VBA connection string matches the exact installed driver's name character-for-character.
Can splitting my ADO connection string across multiple lines cause connection errors?
No. Writing the connection string as one logical string by concatenating components with VBA operators (like '&' and '_') is valid syntax. It will not cause ODBC driver errors as long as the finalized string contains the correct parameters.




