azure-sql-databasepearmdb2azure-connectsql-azure-federations

How to create Pear MDB2 sqlsrv connection for windows sql azure?


I want to connect with windows sql azure database using PEAR MDB2 sqlsrv driver.

I can able to connect non federated database using this

sqlsrv://username@server:password@server.database.windows.net:1433/mydatabase

but with federated database I need to set

"MultipleActiveResultSets" => false

this also with connection string..

How can I pass this extra param.. Please help me


sqlsrv://username@server:password@server.database.windows.net:1433/mydatabase?op‌​tions="MultipleActiveResultSets=false"

is this correct way to send extra values?


Solution

  • MDB2 DSN documentation states that:

    option: Additional connection options in URI query string format. options get separated by &.

    The string format of the supplied DSN is in its fullest form:

    phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value

    So the options should be passed as

    sqlsrv://username@server:password@server.database.windows.net:1433/mydatabase?MultipleActiveResultSets=false
    

    Unfortunately looking at MDB2 sqlsrv.php code, the _doConnect() function doesn't appear to take any other options except for host, username, password and database. So it may not be possible to disable MARS when connecting.

    For additional information about the 2.5 beta version of MDB2 see this answer.