Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Mass close db connections?
Date: Thu, 2 Jul 2009 13:27:01 +0000 (UTC)
Organization: Goldman Sachs &#38; Co
Lines: 9
Message-ID: <h2icj5$o9g$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246541221 24880 172.30.248.38 (2 Jul 2009 13:27:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 2 Jul 2009 13:27:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1190606
Xref: news.mathworks.com comp.soft-sys.matlab:552376


Hello,

I have a bunch of code that uses the Database toolbox and creates connections (generically, 'conn') to various databases. I thought I was quite disciplined in my coding and that I would close every connection (close(conn);) once I was done with it but I'm now finding that there are a bunch of connections left hanging (maxing out connections to the server/db).

Does anyone know if there is a way of finding any/all hanging connections all in one fell swoop? I was hoping there might be a 'who*' type of function which might return all my hangning connections but I haven't found any such thing.

In the meantime, I'm going through my code to ensure I have all close(conn) where they should be, but it would be helpful if there were such a utility so that I could just go through and close each connection individually.  My code crawl is likely to take weeks, otherwise.

Any help/advice would be appreciated.