Using two database connections without specifying a particular one as parameter will always lead to problems and isn’t really a supported use case. May I ask: what is the context for using two databases? Based on which logic would users either be in one or the other connection?
And does your application allow signups? If so, how does the system decide which db connection to store the user in? See the related question (and comments) earlier this week: