public function connect()
 {
     if ($this->pdo instanceof \PDO) {
         return true;
     }
     try {
         $this->pdo = new \PDO($this->dsn->getConnectionString(), $this->dsn->user, $this->dsn->pass, $this->dsn->options);
         $this->pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
         $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
         // always use exceptions
         $this->setCharacterSet($this->getOption('charset', 'UTF8'), $this->getOption('collation'));
     } catch (\PDOException $e) {
         throw new ConnectionException($e->getMessage(), $e->getCode(), $e);
     }
     return true;
 }