Setting the Connection Profile in Configuration->Connection Profiles for a specific project in TDM Portal, applies to all the projects. This functionality, causes the published generator to fail because it attempts to use the last connection profile that was set at a project level in Configuration->Connection Profiles.
TDM Portal 4.9.1+
The functionality is by design.
The setting in Configurations-->Connection Profiles shown in the Portal are from Datamaker, and it will be applicable to all the projects, by design, not just a specific project.
The recommendation is to make the specific configuration Active in the Generator, as shown below:
Don't set anything in the Configuration-->Connection Profiles. This way, the publish job will pick the connection profile from the Generator-->Configurations instead of the Configuration-->Connection Profiles as shown below.