How do you manage database connections and ensure transaction safety in a high-concurrency environment?