Core/Database/Connections/MSSQLConnection.php
public function connect()
    {
        try {
            // Make string containing database settings
            $database = 'sqlsrv:Server=' . $this->host . ';Database=' . $this->database;

            // Make connection.
            $conn = new \PDO($database, $this->username, $this->password);

            // Set attributes from parameters
            $conn->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, $this->fetch);
            $conn->setAttribute(\PDO::ATTR_ERRMODE, $this->error);

            return $conn;
        } catch (\PDOException $ex) {
            throw new \InvalidArgumentException('Error! Cannot connect to database ' . $ex->getMessage());
        }
    }
public function connect()
    {
        try {
            // Make string containing database settings
            $database = 'sqlsrv:Server=' . $this->host . ';Database=' . $this->database;

            // Make connection.
            $conn = new \PDO($database, $this->username, $this->password);

            // Set attributes from parameters
            $conn->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, $this->fetch);
            $conn->setAttribute(\PDO::ATTR_ERRMODE, $this->error);

            return $conn;
        } catch (\PDOException $ex) {
            throw new \InvalidArgumentException('Error! Cannot connect to database ' . $ex->getMessage());
        }
    }
public function connect ( ) { try { // Make string containing database settings $ database = 'sqlsrv:Server=' . $ this -> host . ';Database=' . $ this -> database ; // Make connection. $ conn = new \ PDO ( $ database , $ this -> username , $ this -> password ) ; // Set attributes from parameters $ conn -> setAttribute ( \ PDO :: ATTR_DEFAULT_FETCH_MODE , $ this -> fetch ) ; $ conn -> setAttribute ( \ PDO :: ATTR_ERRMODE , $ this -> error ) ; return $ conn ; } catch ( \ PDOException $ ex ) { throw new \ InvalidArgumentException ( 'Error! Cannot connect to database ' . $ ex -> getMessage ( ) ) ; } }
Connect to database with using settings
defined in class.

@return \PDO
@throws \PDOException
@throws \InvalidArgumentException
Connect to database with using settings defined in class .