I'm talking to an SQL server 2005 using PHP's PDO API:
$mssql = new PDO('dblib:host=foohost;dbname=foodb', 'foouser', 'foopassword');
Subsequently, I want to backup the database to a local file as shown in the code below - which then fails.
$query = "
BACKUP DATABASE foodb
TO DISK = 'D:\\migration\\test_backup.bak';
GO
";
$stmt = $mssql->prepare($query);
$stmt->execute();
The error I'm getting is this (result from $stmt->errorInfo()
):
[0] => HY000
[1] => 102
[2] => General SQL Server error: Check messages from the SQL Server [102] (severity 15) [(null)]
[3] => -1
[4] => 15
I've tried to do the same thing using SQL Server Management Studio, and the exact same query works. So - any hints on how I could get this to work (Note: I'm forced to use PHP on a remote linux host, so any local windows tools won't work)