public function connect($id, array $params)
    {
        $returnValue = null;
        $this->params = $params;
        $driver = $params['driver'];
        $dbLogin = $params['user'];
        $dbpass = $params['password'];
        //remove pdo to add UpperCase ClassName

    		$connLimit = 3; // Max connection attempts.
            $counter = 0; // Connection attemps counter.
    		
            while (true){
                $dsn = $this->getDSN();
                $options = array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_BOTH,
                    PDO::ATTR_PERSISTENT => false,
                    PDO::ATTR_EMULATE_PREPARES => false);
                
                 
                foreach ($this->getExtraConfiguration() as $k => $v){
                    $options[$k] = $v;
                }
                
                try{
                    $this->dbConnector = @new PDO($dsn, $dbLogin, $dbpass, $options);
                    $this->afterConnect();
                   
                   
                    // We are connected. Get out of the loop.
                    break;
                }
                catch (PDOException $e){
                    $this->dbConnector = null;
                    $counter++;
                
                    if ($counter == $connLimit){
                        // Connection attempts exceeded.
                        throw $e;
                    }
                }
            }
            
            $returnValue =  new common_persistence_SqlPersistence($params,$this);;

        return $returnValue;
    }