Avatar of taverny
taverny

asked on 

Trying to connect php to an access 2003 and 2007 database from windows Vista

hi,
I am trying to create a webpage that pulls data from an Access Database.
I am currently trying to pull from Access 2007 (.accdb) and then I will try to pull from access 97 (.mdb)

my problem is my connection to my database for some reason I can't open it. attach is the section of my connection string, I can't figure out how to connect.
I keep getting an error :
Here is the output of my code


This is a test txt
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft JET Database Engine<br/><b>Description:</b> Unrecognized database format 'C:\inetpub\wwwroot\PshincNew2.accdb'.' in C:\inetpub\wwwroot\Test.php:21 Stack trace: #0 C:\inetpub\wwwroot\Test.php(21): com->Open('Provider=Micros...') #1 {main} thrown in C:\inetpub\wwwroot\Test.php on line 21


Thanks
<?php
echo 'This is a test txt';
//$conn=odbc_connect('MyAccess','','');
$conn = new COM('ADODB.Connection') or die('Cannot start ADO'); 
 
//Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\dpelerin\Desktop\TEST1.accdb;Persist Security Info=False;
 
// Microsoft Access connection string.
//$conn->Open("DRIVER={Microsoft Access Driver (*.accdb)}; DBQ=C:\inetpub\wwwroot\PshincNew2");
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\inetpub\wwwroot\PshincNew2.accdb");
 
 
?>

Open in new window

PHP

Avatar of undefined
Last Comment
taverny

8/22/2022 - Mon