class Database extends PDO{
public function __construct() {
try {
$dbh = parent::__construct(DB_TYPE.':host='.DB_HOST.';'.'dbname='.DB_NAME
,DB_USER
,DB_PASS);
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";
exit;
}
$stmt = $dbh->prepare("select name from master..sysdatabases where name = db_name()");
$stmt->execute();
while ($row = $stmt->fetch()) {
print_r($row);
}
unset($dbh); unset($stmt);
}
}
เกิด Error ตามนี้ครับ
Code
Failed to get DB handle: SQLSTATE[01002] Unable to connect: SQL Server is unavailable or does not exist. (severity 9)
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: CRAZY\INTZ in C:\AppServ\www\DAD\config.php on line 19
Unable Connect Server
ลองใช้ทั้ง user "sa" default และ "INTz_" ที่สร้างใหม่ ก็ยังไม่สามารถติดต่อได้