Asked  7 Months ago    Answers:  5   Viewed   38 times

I'm trying to connect from php to Azure DB by

$connectionInfo = array("UID" => "xxx@xxx", "pwd" => "xxx", "Database" => "xxx");
$serverName = ",1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);

But it gives me

Fatal error: Call to undefined function sqlsrv_connect() in C:wampwww...index.php on line 19



you have to use the SQL Server native driver for php at first place, then you can do something like:

$serverName = ", 1433";

$connectionOptions = array("Database" => "sampleInit", 

                           "UID" => "sampleUsr@sample",

                           "PWD" => "samplePass",

                           "MultipleActiveResultSets" => false);

$conn = sqlsrv_connect($serverName, $connectionOptions);

if($conn === false)


     die(print_r(sqlsrv_errors(), true));


You can read more on PHP and SQL Azure at following blog post:

Wednesday, March 31, 2021
answered 7 Months ago

You dont have a function named assign(), but a method with this name. PHP is not Java and in PHP you have to make clear, if you want to call a function


or a method


In your case the call to the function resides inside another method. $this always refers to the object, in which a method exists, itself.

Wednesday, March 31, 2021
answered 7 Months ago

In CI framework, if you are running a prod application, we can set pconnect to true in config/database.php to use a persistent connection to database. Which can reduce latency on initial connection.

By the way, if you are running a test or dev application, we need to treat carefully with this setting, because it may cause several unexpected issues. You can refer to the answer of Advantages / Disadvantages of pconnect option in CodeIgniter to get more info.

Saturday, May 29, 2021
answered 5 Months ago

I get a org.jivesoftware.smack.SmackException$ConnectionException and that's it.

No, it's not. If you look at the javadoc for ConnectionException:

ConnectionException is thrown if Smack is unable to connect to all hosts of a given XMPP service. The failed hosts can be retrieved with getFailedAddresses(), which will have the exception causing the connection failure set and retrievable with HostAddress.getException().

So call ConnectionException.getFailedAddresses() to retrieve the list and check with HostAddress.getException() what caused Smack to be unable to connect to the host.

Wednesday, July 7, 2021
answered 4 Months ago

You can create an elastic pool in the same server as your databases, through portal using instructions here -

Once you have created a pool, you can add existing databases to the pool using instructions here -

Let us know if you have any further questions here.

-- srini

Saturday, September 11, 2021
answered 1 Month ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :