I doubt checking for a message string is the way to go here. This feels unsafe and "hackish" IMO. Also you should import `\Doctrine\DBAL\DBALException` in a use statement at the beginning (affects the other drivers you modified, too).