intellectualmoron Posted May 6, 2008 Share Posted May 6, 2008 hey again, 3 posts in 1 day Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] ODBC--connection to 'rc_cc800_ccm' failed., SQL state S1000 in SQLExecDirect in C:\CCURE800\wgui\v1\test.php on line 58 Firstly, I understand what is happening to a point. The connection to the database is exceeding and telling php to bugger off and leave it alone. Thus, if i restart apache, the error myteriously disaperes for another 500 odd queries to take place. obvious? close the conenction maybe, odbc_close($link); and also tried odbc_close_all(); but the error still persists...is tehre another way of closing/killing the link between database and webserver? System DSN: ccure_php (odbc connection to Microsoft Access File MDB, no username/password required) $link = odbc_connect('ccure_php', '',''); $sql = "SELECT * FROM TABLES"; $row = odbc_exec($link, $sql); if(odbc_num_rows($row)){ while ($r = odbc_fetch_array($row)) { $personID = $r['PERSONID']; $firstName = $r['FIRSTNAME']; $lastName = $r['LASTNAME']; $cardNum = $r['CARDNUM']; $doorName = $r['Door_Name']; $dateTime = $r['Local_DT']; $temptime = DateAdd('s',$dateTime,'01/01/1990 00:00:00'); $temptime = DateAdd('y', 20, $temptime); echo "$personID $firstName $lastName $cardNum $doorName " .strftime('%H:%M:%S %A %d %b',$temptime). "<br>"; } } //here are a few things (that i jnow of - to close the connection down) odbc_close($link); odbc_close_all(); Link to comment https://forums.phpfreaks.com/topic/104390-solved-odbc_close-killing-sesion-between-db-and-web-server/ Share on other sites More sharing options...
blackcell Posted May 6, 2008 Share Posted May 6, 2008 Where is your line 58? Also, I'm not totally familiar with ODBC though I have worked with it some. It might be a problem with providing the username and password to access the db? Link to comment https://forums.phpfreaks.com/topic/104390-solved-odbc_close-killing-sesion-between-db-and-web-server/#findComment-534680 Share on other sites More sharing options...
intellectualmoron Posted May 7, 2008 Author Share Posted May 7, 2008 link 58: $row = odbc_exec($link, $sql); i dont think its credential related because it returns results and if i restart apache the error goes away. isn't this the correct process: connect query exec connection/query get results close connection ? Link to comment https://forums.phpfreaks.com/topic/104390-solved-odbc_close-killing-sesion-between-db-and-web-server/#findComment-535040 Share on other sites More sharing options...
intellectualmoron Posted May 7, 2008 Author Share Posted May 7, 2008 die(); at the end of my code seems to be working for now - will let you know! Link to comment https://forums.phpfreaks.com/topic/104390-solved-odbc_close-killing-sesion-between-db-and-web-server/#findComment-535101 Share on other sites More sharing options...
blackcell Posted May 7, 2008 Share Posted May 7, 2008 So you are getting results from the query? Link to comment https://forums.phpfreaks.com/topic/104390-solved-odbc_close-killing-sesion-between-db-and-web-server/#findComment-535125 Share on other sites More sharing options...
intellectualmoron Posted May 7, 2008 Author Share Posted May 7, 2008 yes. results coming through just as I need them i've had no problem since adding die(); to the end of the code. Link to comment https://forums.phpfreaks.com/topic/104390-solved-odbc_close-killing-sesion-between-db-and-web-server/#findComment-535284 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.