Qlik Sense app loading data from an ODBC connection to SQL Server with "Single Sign-On" option checked (for example SSO connection to MS SQL Server following article
How to set up Single Sign-On ODBC Connection to SQL Server from Qlik Sense)
When reloading in Qlik Sense Hub, the reload works and the connector picks up credentials of the currently logging in Qlik Sense user as expected.
However, reload task on the same app fails with errors similar to
ODBC connection failed, although Qlik Sense service account does have access to the database
As of the latest version of Qlik Sense (November 2018), it is a known behavior that SSO connections always use the "current user":
- When doing reload via Qlik Sense Hub, current user is the logged in user.
- When doing reload from a task, current user is INTERNAL\SA_SCHEDULER. This is an internal user of Qlik Sense, not a valid domain or database user.
There is an on-going feature request to use Qlik Sense service account instead of INTERNAL\SA_SCHEDULER for SSO connection in scheduled reload. The request is under R&D's consideration for future releases of the product.
While waiting for the feature, a work-around solution is to create 2 connections: a SSO connection for developers, and a non-SSO one for scheduled reloads. In the reload script, you can check current user with OSUser() function to decide which connection to use. For example:
Let vCurrentUser = SubField(OSUser(),'=',3);
If vCurrentUser = 'sa_scheduler' then // Scheduled reload - use non-SSO connection
LIB CONNECT TO 'connector_without_sso';
Else // User reload - use SSO connection
LIB CONNECT TO 'connector_with_sso';
Endif