PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 30, 2022

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

 August 30, 2022     azure-connect, azure-sql-database, mdb2, pear, sql-azure-federations     No comments   

Issue

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.



Answered By - Fernando Correia
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing