Jump to content

ODBC Connections Not Closing


kickstart

Recommended Posts

Hi

 

Have an issue with a script that connects to multiple Access databases to extract data.

 

There is one master database and then numerous small databases (I take no responsibility for the design!). The master is opened and then the sub databases are looped around, opened process and closed in turn.

 

However after about 20 connections I get the error [ODBC Microsoft Access Driver] Too many client tasks for any new connections. It is related to the number of connections rather than the number of operations on databases (ie, if I comment out one of the pieces of SQL run on each database it makes no difference).

 

I am closing the connection and unsetting the variable that stores the connection. As such there shouldn't be an excess of connections open at any one time.

 

Any suggestions?

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/214721-odbc-connections-not-closing/
Share on other sites

Hi

 

Bit of further info (and a partial but messy solution).

 

I changed the coding to take the contents of the master db and store it in an array, then did a foreach around this array to access the individual databases. Instead of using odbc_close() I then used odbc_close_all(). This prevented the problem.

 

Down side of this method is that it is closing all the odbc database connections each time rather than just the one I have finished with. Not a major problem in this case though.

 

All the best

 

Keith

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.