I am getting the following error trying to connect to a mssql express server from linux (mint16x32bit) to a windows 7 pc (firewall disabled atm)
There was a problem. Caught exception: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
I have tried combinations of the username, where have I gone wrong with this?
Thanks in advance, James
Connection String:
<?php
$msdbhost = "192.168.1.10";
$msdbname = "sqlCompanyTables";
$msdbuser = "Jupiter\\James";
$msdbpass = "mypassword";
try {
// database connection
$msconn = new PDO("dblib:host=$msdbhost; dbname=$msdbname", $msdbuser, $msdbpass);
$msconn -> exec('SET CHARACTER SET utf8');
} catch(PDOException $e) {
echo 'There was a problem. Caught exception: ', $e->getMessage(), "\
";
}
?>
Query:
<?php
require "connection.php";
$sql = "SELECT * FROM dbo.Projects_1";
$sth = $msconn -> prepare($sql);
$sth -> execute();
$rows = $sth->fetchAll();
foreach ($rows as $row) {
echo $row['City'] + '<br>';
}
?>