Re: Connecting to MS Access

From: Date: Wed, 12 Jun 2002 18:25:56 +0000
Subject: Re: Connecting to MS Access
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-14193@lists.php.net to get a copy of this message
All of your errors stem from the first error. You do not have a valid connection resource -- so when you try and run queries and functions, they fail, saying that there's no valid ODBC source. I've not used Access in the past, so i can't say what specific information it's looking for, but go over the documentation again, and try to look for code examples. ** And always check your status vars ** -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- "Bill Hudspeth" <wbhk@unm.edu> wrote in message news:20020612162428.90662.qmail@pb1.pair.com... > I am having problems connecting to an Access database. I am using Windows > 2000, IIS 4, Access 2000, and PHP 4.2.1. I have created a system DSN using > the Access (.mdb) driver, and have a username and password. What's going > on?? Thanks, Bill > > > > The code I have used is as follows: > > > > ************************************************************************ > > > > <?php > > > > //connect to database > > $connectionstring = odbc_connect("meteoritecatalog", "username", > "password"); > > //line 14 is immediately above > > > > //SQL Query > > $query = "SELECT sample, type FROM sample"; > > > > //execute query > > $queryexe = odbc_do($connectionstring, $query); > > //line 20 above > > > > //output results to standard output > > odbc_result_all($queryexe, "BORDER=1"); > > //line 23 above > > > > //disconnect from the database > > odbc_close($connectionstring); > > //line 26 above > > > > ?> > > > > ************************************************************************ > > The error message I get is: > > > > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]General error > Not enough information to connect to this DSN with SQLConnect. Use > SQLDriverConnect., SQL state S1000 in SQLConnect in > C:\inetpub\wwwroot\PHP\data_tap.php on line 14 > > Warning: odbc_do(): supplied argument is not a valid ODBC-Link resource in > C:\inetpub\wwwroot\PHP\data_tap.php on line 20 > > Warning: odbc_result_all(): supplied argument is not a valid ODBC result > resource in C:\inetpub\wwwroot\PHP\data_tap.php on line 23 > > Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource > in C:\inetpub\wwwroot\PHP\data_tap.php on line 26 > > > > > > >

« previous php.windows (#14193) next »