Issue #20842: Can't connect to external database with Qt5.

Issue #20842: Can't connect to external database with Qt5 - fix for all protocols.