Page 1 of 1

ODBC and MS Access

Posted: Wed Aug 20, 2003 10:23 am
by Johnm
Hi all,
Does anyone know how to solve this error?

Code: Select all

Warning: SQL error: , SQL state 00000 in SQLConnect in D:\Inetpub\wwwroot\mis\jm\index.php on line 4
Here is the code for connecting to the db.

Code: Select all

<?php
    putenv('TEMP=c:\\temp');
    $odbc_conn=odbc_connect('Driver={Microsoft Access Driver (*.mdb)};','PhoneMaster_local','admin','*****');
    if (! $odbc_conn)
    {
        echo "Failed to connect";
        echo odbc_errormsg();
    }

?>
Thanks,

John M

Posted: Wed Aug 20, 2003 10:04 pm
by fractalvibes
Odd - I don't see any sqlcode, and would think a sqlstate of 0 is good!
Is the *.mdb local to the machine and in same directory? ODBC DNS set up on machine?

This site is for ADO connections, but might be useful:

http://www.able-consulting.com/ADO_Conn.htm

as is this one:
http://www.connectionstrings.com/

Access is a little flakey when trying use anywhere other than very local to the application.

fv

Posted: Thu Aug 21, 2003 8:38 am
by Johnm
I resolved this by using oledb.

Thanks,
John M