The database stopped responding. Everything else looked fine. The logs told a different story: a TLS handshake was failing, and the URI was wrong.
Database URIs with TLS configuration are simple until they aren’t. A misplaced parameter. An outdated certificate. A default setting you thought was secure but isn’t. When your connection string is wrong, nothing else matters.
A database URI is more than hostnames and ports. With TLS enabled, it becomes the gateway to encryption in transit, preventing data leaks through sniffed traffic or man-in-the-middle attacks. The structure matters: protocol, credentials, host, port, database name, and query parameters. For TLS, those parameters define trust. They point to certificates, set verification modes, and sometimes force encrypted connections.
For PostgreSQL, ?sslmode=require might be enough to enforce encryption, but production environments demand more. Using verify-full checks the certificate against the hostname and CA. For MySQL, ?ssl-mode=VERIFY_IDENTITY ensures the client confirms the server’s identity. MongoDB URIs can force TLS with ?tls=true and specify CA files with &tlsCAFile=. These small flags change whether your data is actually secure or just looks secure.