Databases are used for high-volume storage, data mining, security, and complex querying. Application and session variables are memory-resident objects managed by the web server's runtime environment, not the database. Using a database is an alternative to relying solely on these volatile variables for persistent state management.