database – $connection->query() returns NULL

I have just upgrade the Drupal Core from 8 to version 9. The Views Custom Table module crashed and it doesn’t work anymore.

I found an issue with the database connection part. In the following code the query result is NULL.

$text_query = new FormattableMarkup('DESCRIBE @table_name', (
  '@table_name' => 'iar_dailystat_chem',
$connection = Database::getConnection('default', $databaseName);
$query = $connection->query($text_query);

The same code works on Drupal 8, so what’s the issue?