Parsing DATABASE_URI, use URI#hostname: it's smarter about IPv6

Fixes #15705.