Bugs item #1153554, was opened at 2005-02-28 09:32 Message generated for change (Comment added) made by mkb137 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=474851&aid=1153554&group_id=54790
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Tasks Group: 0.85 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Ashley Moran (ashleymoran) Assigned to: Nobody/Anonymous (nobody) Summary: sql task leaves db connection open Initial Comment: I'm trying to use the sql task to update a test database on SQL Server 2000. The procedure is: 1) backup current database 2) restore backup database 3) run scripts to create latest procs, functions etc on fail: 4) restore current database (backup made in step 1) But the sql task leaves a conecction open (visible in the Current Activity / Process Info EM screen) after updating the procs, so if one fails the database can't be restored. Is this a bug or could I be doing something wrong? ---------------------------------------------------------------------- Comment By: Mike K. Bennett (mkb137) Date: 2007-08-16 16:08 Message: Logged In: YES user_id=294751 Originator: NO I second this bug. On Oracle, this causes a cursor to be left open to the database resulting in a "Too many cursors" error. The problem is in SqlHelper. The "Execute" method creates a command but never closes it or disposes of it. I've changed it myself so that SqlHelper stores the command it created as private OleDbCommand _command = null; Then added : /// <summary> /// Dispose of the command /// </summary> public void DisposeCommand() { if ( null != _command ) { _command.Dispose(); _command = null; } } which is called by SqlTask's ExecuteStatements and ExecuteStatementsInBatch in those tasks' "finally" clauses. I won't claim this is the perfect solution, since I'm not sure what other tasks may be using SqlHelper. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=474851&aid=1153554&group_id=54790 ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ NAntContrib-Developer mailing list NAntContrib-Developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer