buildDsn example

class DatabaseFactory
{
    /** * @throws Exception * @throws PDOException * * @return PDO */
    public function createPDOConnection(DatabaseConnectionInformation $info)
    {
        $conn = new PDO(
            $this->buildDsn($info),
            $info->username,
            $info->password,
            [
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
                PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
            ]
        );

        $this->setNonStrictSQLMode($conn);

        
Home | Imprint | This part of the site doesn't use cookies.