Sometimes code exist but there is no db connection string on settings.php, so we can't connect to database. We need to consider this case and return environment default connection info.