I'm running into a problem connecting to a MSSQL database from PHP.
We've got 2 applications on the same linux-server.
- App A connects to a "simple" MSSQL server+database, and has no problem.
- App B connects to a MSSQL server + INSTANCE + database, and fails to connect.
The fact that the database is within an "instance" of the MSSQL server seems to be the only difference.
The documentation appears not to specify how to connect to a database within an instance.
Example (pseudo) code:
<?php
$host="10.0.0.12";
$instance="specific"
$database="my-database"
$username="username";
$password="password";
$pdo = new PDO("dblib:host=${host}\\${instance};database=${database}", $username, $password);
This fails to connect, most of the time with a very uninformative message like:
SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
I've tried numerous different DSN's to see what might work, but none seem to work.
What DSN might I use to get this working?
Alternative ways to connect from PHP to this database are also welcome as suggestions.