You are viewing limited content. For full access, please sign in.

Question

Question

Where does the Data Source Driver list come from in Workflow?

asked on May 10, 2024 Show version history

When configuring a new ODBC data source and selecting the driver, where does the drop-down list come from? I have installed the Microsoft ODBC Driver 18 for SQL Server and expected it to show in the list, but it does not.

We are using Workflow 11.0.2306.898.

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on May 13, 2024 Show version history

This was an interesting rabbit hole to go down. The Workflow Direct Connections Data Source Configuration docs have a section for

See a list of the direct connection data source drivers that Workflow supports.

  • Microsoft Access 2003
  • Microsoft Access 2007/2010
  • CSV
  • CSV 2010
  • Microsoft Excel 2003
  • Microsoft Excel 2007/2010
  • Microsoft FoxPro
  • Informix
  • OracleOdbc
  • OracleODP
  • Pervasive
  • MSSQL
  • MySQL

Which seem to conditionally appear in the dropdown based on if you have Data Source Type of ODBC, OLE, or Direct selected.

What makes these "supported" is that code exists for each that knows how to construct a proper driver connection string with a combination of user-supplied and hardcoded values. Each one appears to check if it's installed.

Here, for example, are some snippets from the FoxPro code:

/// Fox pro odbc driver.   
...
[DataSourceInstallCheckByType("Microsoft Visual FoxPro Driver", "ODBCDriverNotInstalled")]
...
        /// Set the odbc connection string.
        /// Access, Excel, and csv use the same provider, but have slightly different
        /// connection strings
        protected override void InitializeConnectionString()
        {
            string ext = Path.GetExtension(this.DatabaseName).ToUpperInvariant();
            ext = ext.Replace(".", string.Empty);

            if (string.IsNullOrEmpty(ext))
            {
                ext = "DBF";
            }

            this.ConnectionString = "Driver={Microsoft Visual FoxPro Driver};" +
                                "SourceType=" + ext + ";" +
                                "SourceDB=" + this.DatabaseName + ";" +
                                "Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO";
        }
...

 Pay attention to this line:

[DataSourceInstallCheckByType("Microsoft Visual FoxPro Driver", "ODBCDriverNotInstalled")]

That first parameter is the specific name of the ODBC driver Workflow is going to check for.

There is a single "Sql" driver file, much like the FoxPro one above. It starts with:

/// SQL ODBC adapter class.
...
[DataSourceInstallCheckByType("SQL Server", "ODBCDriverNotInstalled")]
....

        protected override void InitializeConnectionString()
        {
            if (this.UseSSPI)
            {
                this.ConnectionString = "Driver={SQL Server};" +
                                    "Server=" + this.Host + ";" +
                                    "Database=" + this.DatabaseName + ";" +
                                    "Trusted_Connection=yes;";
            }
            else
            {
                this.ConnectionString = "Driver={SQL Server};" +
                                    "Server=" + this.Host + ";" +
                                    "Database=" + this.DatabaseName + ";" +
                                    "UID=" + this.User + ";" +
                                    "PWD=" + this.Password + ";";
            }
        }

Again, note the ODBC driver name of "SQL Server". Also note the connection string constructor starting with "Driver={SQL Server};".

To check if the "supported" driver in question is installed, Workflow pulls the available values from the registry. Specifically, it checks the registry key:

\HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers

Which contains a list of registered (?) ODBC drivers and a value indicating if they're installed.

(Note that "SQL Server" is a specific registered ODBC driver, distinct from "ODBC Driver 17/18 for SQL Server")

Then for each "Installed" driver, it loops through and pulls info for the driver-specific subkey:

We see here that the actual "SQL Server" driver is C:\Windows\System32\SQLSVR32.dll.

This turns out to be the first generation ODBC driver for SQL Server that, while ancient, is still supported. From Microsoft's Driver history for Microsoft SQL Server:

ODBC

There are three distinct generations of Microsoft ODBC drivers for SQL Server. The first "SQL Server" ODBC driver still ships as part of Windows Data Access Components. This driver isn't recommended for new development. Starting in SQL Server 2005, the SQL Server Native Client includes an ODBC interface and is the ODBC driver that shipped with SQL Server 2005 through SQL Server 2012. This driver also isn't recommended for new development. After SQL Server 2012, the Microsoft ODBC Driver for SQL Server is the driver that is updated with the most recent server features going forward.

It was updated in 2020 to support TLS 1.2:

Stack Exchange: Can SQLSRV32.DLL broker a TLS 1.2 handshake?

See also: Compatibility of ODBC driver SQLSRV32.dll with SQL Server versions

ConnectionStrings.com shows that this 1st gen "SQL Server" driver is identified as such in connection strings: Microsoft SQL Server ODBC Driver connection strings (Driver={SQL Server};)

Compared to: Microsoft ODBC Driver 17 for SQL Server connection strings (Driver={ODBC Driver 17 for SQL Server};)

So to wrap that up:

  • The Workflow built-in "Sql" driver option uses the 1st gen "SQL Server" ODBC driver. 
  • "ODBC Driver 17 for SQL Server" (or 18, etc.) will not appear in the "Direct connections" built-in list, because the list is hardcoded. 

 

That seems less than ideal and I'll bring it up internally. The core Workflow ODBC code is well over a decade old, and I suspect if this came up in the past, it was a "if it 'ain't broke, don't fix it" sort of thing. 

 

If you want to use the current generation ODBC Driver for SQL Server, you will need to create a System DSN through the ODBC Data Source Administrator and explicitly select the driver version you want to use. Then select that DSN through Workflow's "Windows ODBC" option.

For Data Source Name (DSN) entries, Workflow looks these registry keys for the list and loops through them. System DSNs go under HKEY_LOCAL_MACHINE. Use a System DSN, not a user DSN, unless Workflow is running as an AD service account and you want to specifically restrict access/visibility to that account by creating a User DSN under the service identity.

\HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources

\HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources

1 0
replied on May 13, 2024

Wow Sam! That was a great run down of how it all works. Thank you for taking the time do that.

This entire subject came up because our IT is disabling TLS 1.0 and 1.1 and enabling 1.2 and 1.3. When they did that some of our lookup queries started failing with a "SecDoClientHandshake" error. Even though the documentation says that they added support TLS 1.2 in the standard SQL server driver, something still doesn't work correctly with it.

I just updated the Data Source to use an ODBC System DSN connection instead and it seems to be working correctly now. We will do more testing tomorrow.

1 0
replied on May 14, 2024 Show version history

Welcome =)

I love opportunities like this that give me a reason to go poking around in new places I wouldn't otherwise. Helps to have a problem to solve!

Re:

This entire subject came up because our IT is disabling TLS 1.0 and 1.1 and enabling 1.2 and 1.3. When they did that some of our lookup queries started failing with a "SecDoClientHandshake" error. Even though the documentation says that they added support TLS 1.2 in the standard SQL server driver, something still doesn't work correctly with it.

TLS handshakes have two parts:

  1. Protocol negotiation
  2. Cipher suite negotiation

It's entirely possible the client and server are successfully negotiating TLS 1.2 as the protocol but then failing to negotiate the cipher suite because they don't have a mutually supported one.

As a general example: Windows 11: unable to connect to SQL 2008 [Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error

Which I found linked from this Microsoft Q&A post asking about the exact same error you're seeing: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error

In SSL errors are reported after upgrading to TLS 1.2 Microsoft notes one potential cause as:

  • There are no matching cryptographic algorithms between the client and the server.

See specifically the No matching cipher suites section of the page.

That would be easy to identify with Wireshark if you know how to inspect TLS handshakes. Potentially worth ruling out.

One interesting thing I noticed is that under:

https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/tls-1-2-support-microsoft-sql-server#client-component-downloads

There's one entry in the table for "MDAC Client components (Sqlsrv32.dll and Sqloledb.dll)", which links to Servicing stack update for Windows 10, version 1809: November 10, 2020, which says:

This update applies to the following:

  • ​Windows 10 Version 1809 for 32-bit Systems

  • Windows 10 Version 1809 for ARM64-based Systems

  • Windows 10 Version 1809 for x64-based Systems

  • Windows Server 2019

  • Windows Server 2019 (Server Core installation)

So unclear if that MDAC "SQL Server" driver got the TLS 1.2 update anywhere other than Server 2019. Given that pre-dates Server 2022, I suspect 2022 has the TLS 1.2 version of the driver. But Server 2016 might not. Could be a Microsoft documentation omission, could not have been backported to 2016 and earlier.

I understand the main "downside" of using DSNs is that they're less "portable" for promoting Workflows between environments (etc.) because you have to create one on each server.

1 0
replied on May 20, 2024

Here is what we have ended up doing:

  1. Installed the ODBC Driver 18 for SQL Server on the Workflow servers
  2. Created a DSN for each SQL data source. I used the same name as what was configured in Workflow.
  3. Edited the data source in Workflow Administration Console to use ODBC.
  4. Tested each workflow

 

There were a couple of queries that had errors related to syntax during our tests. We removed the Query Data activities that had this problem and replaced them with a Custom Query activity, and it resolved the issue.

1 0
replied on May 20, 2024

There were a couple of queries that had errors related to syntax during our tests.

Very interested in the details of these. That's the sort of thing we worry about when looking at stuff like "What if we just auto-update the default Workflow SQL ODBC driver for the entire customer base?".

Post publicly if you can to help others who find this (redact sensitive bits of queries, etc.), otherwise you can email me.

0 0
replied on May 21, 2024

Sam,

The errors we were seeing were this error and similar ones:

5/16/2024 8:34:36 AMxxxxxxxERROR [42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Incorrect syntax near '-'.

 

We also had a few custom query activities that had joins that had syntax errors and after reviewing them, the queries did not include the database.dbo.column format. After updating them, they worked as expected.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.