My question is simple. Is there a property of the Microsoft ODBC Driver 17 for SQL Server (or any version for that matter) to change where it stores the query results?
By default, this driver stores query result data into files under “%USERPROFILE%\AppData\Local\Temp". You can see this generating files as connections are opened and query results are gathered.
The problem is, due to a new behavior in Windows Server 2019, a user's %TEMP% folder is automatically deleted every 7 days. Not cleared out, deleted (and not recreated for some reason). Seems like an oversight from Microsoft, but here we are. This prevents the Microsoft ODBC Driver 17 for SQL Server from being able to provide query results to my application, and any application that relies on accessing %TEMP% no longer functions properly until the user account logs off and back on, or the server is restarted. This makes it very difficult to manage an application that needs to be running 24/7/365. In the article they provide a workaround to remove or delay this cleanup with a registry hack, but this would be difficult to roll out on a global scale for all of my clients.
Here is the article I am referencing: https://learn.microsoft.com/en-us/troubleshoot/windows-server/shell-experience/temp-folder-with-logon-session-id-deleted
So rather than relying on the unreliable Windows temp directory, I'm wondering if I can define my own query result temp directory, any ideas? I'm not seeing any properties of the ODBC to be able to do so.