There are 2 recommended ways to connect to databases from Workers, depending on your database type: Hyperdrive or API via client library.
Traditional SQL databases (like traditional Postgres) should be connected to with Hyperdrive to ensure the connection works well and you don't exhaust your connection limits.
Many newer database vendors also offer access to execute database queries via a client library ('API via client library' in the column), which doesn't require Hyperdrive.
If you are adding the integration from the Cloudflare Workers page in the dashboard, those integrations don't require setting up Hyperdrive either.