private function connect()
    {
        // Connecting with PDO.
        try {
            switch ($this->dbType) {
                case 'sqlite':
                    $this->dbHandler = @new PDO("sqlite:".$this->dbName, null, null, $this->pdoSettings);
                    break;
                case 'mysql':
                case 'pgsql':
                case 'dblib':
                    $this->dbHandler = @new PDO(
                        $this->dsn,
                        $this->user,
                        $this->pass,
                        $this->pdoSettings
                    );
                    // Execute init commands once connected
                    foreach ($this->dumpSettings['init_commands'] as $stmt) {
                        $this->dbHandler->exec($stmt);
                    }
                    // Store server version
                    $this->version = $this->dbHandler->getAttribute(PDO::ATTR_SERVER_VERSION);
                    break;
                default:
                    throw new Exception("Unsupported database type (".$this->dbType.")");
            }
        } catch (PDOException $e) {
            throw new Exception(
                "Connection to ".$this->dbType." failed with message: ".
                $e->getMessage()
            );
        }

        if (is_null($this->dbHandler)) {
            throw new Exception("Connection to ".$this->dbType."failed");
        }

        $this->dbHandler->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL);
        $this->typeAdapter = TypeAdapterFactory::create($this->dbType, $this->dbHandler, $this->dumpSettings);
    }
private function connect()
    {
        // Connecting with PDO.
        try {
            switch ($this->dbType) {
                case 'sqlite':
                    $this->dbHandler = @new PDO("sqlite:".$this->dbName, null, null, $this->pdoSettings);
                    break;
                case 'mysql':
                case 'pgsql':
                case 'dblib':
                    $this->dbHandler = @new PDO(
                        $this->dsn,
                        $this->user,
                        $this->pass,
                        $this->pdoSettings
                    );
                    // Execute init commands once connected
                    foreach ($this->dumpSettings['init_commands'] as $stmt) {
                        $this->dbHandler->exec($stmt);
                    }
                    // Store server version
                    $this->version = $this->dbHandler->getAttribute(PDO::ATTR_SERVER_VERSION);
                    break;
                default:
                    throw new Exception("Unsupported database type (".$this->dbType.")");
            }
        } catch (PDOException $e) {
            throw new Exception(
                "Connection to ".$this->dbType." failed with message: ".
                $e->getMessage()
            );
        }

        if (is_null($this->dbHandler)) {
            throw new Exception("Connection to ".$this->dbType."failed");
        }

        $this->dbHandler->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL);
        $this->typeAdapter = TypeAdapterFactory::create($this->dbType, $this->dbHandler, $this->dumpSettings);
    }
private function connect ( ) { // Connecting with PDO. try { switch ( $ this -> dbType ) { case 'sqlite' : $ this -> dbHandler = @ new PDO ( "sqlite:" . $ this -> dbName , null , null , $ this -> pdoSettings ) ; break ; case 'mysql' : case 'pgsql' : case 'dblib' : $ this -> dbHandler = @ new PDO ( $ this -> dsn , $ this -> user , $ this -> pass , $ this -> pdoSettings ) ; // Execute init commands once connected foreach ( $ this -> dumpSettings [ 'init_commands' ] as $ stmt ) { $ this -> dbHandler -> exec ( $ stmt ) ; } // Store server version $ this -> version = $ this -> dbHandler -> getAttribute ( PDO :: ATTR_SERVER_VERSION ) ; break ; default : throw new Exception ( "Unsupported database type (" . $ this -> dbType . ")" ) ; } } catch ( PDOException $ e ) { throw new Exception ( "Connection to " . $ this -> dbType . " failed with message: " . $ e -> getMessage ( ) ) ; } if ( is_null ( $ this -> dbHandler ) ) { throw new Exception ( "Connection to " . $ this -> dbType . "failed" ) ; } $ this -> dbHandler -> setAttribute ( PDO :: ATTR_ORACLE_NULLS , PDO :: NULL_NATURAL ) ; $ this -> typeAdapter = TypeAdapterFactory :: create ( $ this -> dbType , $ this -> dbHandler , $ this -> dumpSettings ) ; }
Connect with PDO.

@return null
Connect with PDO .