The treat model is that your container gets owned.

The password should only exist in the process memory for the few lines of code to open that database connection, and then wiped after you got the handle.

Ideally, homomorphic encryption should be used instead.

https://en.wikipedia.org/wiki/Homomorphic_encryption