Unable to connect to database r2 then r1