For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > September 2005 > can't connect to Access









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author can't connect to Access
chris

2005-09-26, 7:55 am

Hi,

I try to connect to Access with php with te code below. The database and
table are ok.
<?php
include('../adodb/adodb.inc.php');
$db =& ADONewConnection('access');
$dsn = "Driver={Microsoft Access Driver
(*.mdb)};Dbq=newres.mdb;Uid=Admin;Pwd=;";
$db->Connect($dsn);
.....

I get the error:
Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC
Microsoft Access Driver]General error Unable to open registry key 'Temporary
(volatile) Jet DSN for process 0x840 Thread 0x860 DBC 0xb48c3c Jet'., SQL
state S1000 in SQLConnect in
D:\Inetpub\wwwroot\resphp\adodb\drivers\
adodb-odbc.inc.php on line 60
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open
registry key 'Temporary (volatile) Jet DSN for process 0x840 Thread 0x860
DBC 0xb48c3c Jet'.


When using a DSN connection, it works:
<?php
include('../adodb/adodb.inc.php');
$conn = &ADONewConnection('access'); # crée une connexion
$conn->PConnect('phpaccess'); # se connecte à MS-Access

When using OLEDB:
<?php
include('../adodb/adodb.inc.php');
$db =& ADONewConnection('access');
$dsn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=newres.mdb;User
Id=admin;Password=;";
$db->Connect($dsn);

I get this error:
Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC
Driver Manager] Data source name not found and no default driver specified,
SQL state IM002 in SQLConnect in
D:\Inetpub\wwwroot\resphp\adodb\drivers\
adodb-odbc.inc.php on line 60
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified

Any help would be welcome.
Kevin




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com