How to get the database name programmatically

use Magento\Framework\Config\ConfigOptionsListConstants;
/** @return string */
function rm_db_name() {
	/** @var string $result */
	static $result;
	if (!$result) {
		/** @var \Magento\Framework\ObjectManagerInterface $om */
		$om = \Magento\Framework\App\ObjectManager::getInstance();		
		/** @var \Magento\Framework\App\DeploymentConfig $config */
		$config = $om->get('Magento\Framework\App\DeploymentConfig');
		/** https://github.com/magento/magento2/issues/2090 */
		$result = $config->get(
			ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT
			. '/' . ConfigOptionsListConstants::KEY_NAME
		);
	}
	return $result;
}

In the same way i want to know the host name and password.

Will you please send code