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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.