Adding logic to point to correct database host(not tested the change)