public function getConnection($name = null)
    {
        if ($name === null) {
            reset($this->config);
            $name = key($this->config);
        }

        if (!isset($this->config[$name])) {
            throw new \Exception('Configuration name does not exists !');
        }

        if (!isset($this->config[$name]['engine'])) {
            throw new \Exception('Engine not specified in configuration !');
        }

        $engine = $this->config[$name]['engine'];

        if (!isset($this->connections[$engine][$name])) {
            $method = 'get' . $engine;
            if (!method_exists($this, $method)) {
                throw new \Exception('Engine does not exists ! (engine: ' . $engine . ')');
            }

            $this->connections[$engine][$name] = $this->$method($name);
        }

        return $this->connections[$engine][$name];
    }