note 88040 modified in class.com by danbrown
| From: | danbrown@php.net | Date: | Thu, 08 Jan 2009 15:49:18 +0000 |
| Subject: | note 88040 modified in class.com by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148955@lists.php.net to get a copy of this message | ||
If you're using COM to create a DSN Less connection to an MS Access 2007 database, you'll
find through Googling that you need to use an updated version of Jet, so the connection string
I've found looks like this:
<?php
$databaselocation = "C:\Path\to\db.accdb";
$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
$conn->Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=$databaselocation") or
die('Cannot start with Jet;);
?>
However, on my setup (WinVista, Access 2007, PHP526) I found that it always 'dies' with
"Cannot start with Jet", even if the connection was successful ($conn->State reads
"1").
I figured to just drop the die() command on $conn->Open(). If something catastrophic happens with
the ADO connection then it's own error handling engine passes stack traces, etc back to the
console/standard output.
Therefore, my Open() command looks like this:
<?php
$conn->Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=$databaselocation");
?>
--was--
If you're using COM to create a DSN Less connection to an MS Access 2007 database, you'll
find through Googling that you need to use an updated version of Jet, so the connection string
I've found looks like this:
$databaselocation = "C:\Path\to\db.accdb";
$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
$conn->Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=$databaselocation") or
die('Cannot start with Jet;);
However, on my setup (WinVista, Access 2007, PHP526) I found that it always 'dies' with
"Cannot start with Jet", even if the connection was successful ($conn->State reads
"1").
I figured to just drop the die() command on $conn->Open(). If something catastrophic happens with
the ADO connection then it's own error handling engine passes stack traces, etc back to the
console/standard output.
Therefore, my Open() command looks like this:
$conn->Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=$databaselocation");
http://php.net/manual/en/class.com.php