Question

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?

Was it helpful?

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.

OTHER TIPS

I tried like this its getting.

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

But connection not happening. I think latest stable version of Pear is 2.4.1. With that sqlsrv driver not available. sqlsrv driver available only on Pear 2.5 beta version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top