note 88040 added to class.com
| From: | james dot m dot love at gmail dot com | Date: | Wed, 07 Jan 2009 11:27:16 +0000 |
| Subject: | note 88040 added to class.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148916@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:
$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");
----
Server IP: 92.48.74.199
Probable Submitter: 82.69.127.200
----
Manual Page -- http://www.php.net/manual/en/class.com.php
Edit -- https://master.php.net/note/edit/88040
Del: integrated -- https://master.php.net/note/delete/88040/integrated
Del: useless -- https://master.php.net/note/delete/88040/useless
Del: bad code -- https://master.php.net/note/delete/88040/bad+code
Del: spam -- https://master.php.net/note/delete/88040/spam
Del: non-english -- https://master.php.net/note/delete/88040/non-english
Del: in docs -- https://master.php.net/note/delete/88040/in+docs
Del: other reasons-- https://master.php.net/note/delete/88040
Reject -- https://master.php.net/note/reject/88040
Search -- https://master.php.net/manage/user-notes.php