Disclaimer: never used this ATL/OLE DB, nor C++ in a while but a stab in the dark here. Could the issue be this ATL/OLE DB connection technology doing its own thing under the hood to keep connections alive?
Have you looked into using connection technologies other than ATL/OLE DB and see what happens? such as GitHub - microsoft/VCSamples: Samples for VC++