Steve Dawson wrote:
Craig Cardimon wrote:
I am using Win32::ODBC. I thought create and destroy was the way to
go. Perhaps it isn't. I make several different ODBC connections due to
the nature of the script and how the data gets munged. Perhaps I
should create them all at the beginning and keep them open for the
duration of the script. Is there a limit to the number of ODBC
connections that can be open at the same time?
I've got a couple of scripts which start out with a primary connection
which stays open for the life of the script (can be several weeks if the
SQL box stays up that long :-)). I previously opened and closed odbc
objects whenever I cross referenced other datasets, but eventually found
that they were leaking away my memory just like the main connection.
I have run a couple of utility scripts since then that open and close as
required as the connections go in and out of scope, but for volume or
anything I intend to leave running for an extended period of time, I use
a fixed set of connections and cache the data in a perl structure if I
need to cross-ref datasets.I've only ever opened five or six
simultaneous connections.
I've had very few problems since going to long-term connections even
though most of them go dormant overnight or on weekends when the users
go home. I couldn't actually find anything in the Win32::ODBC docs that
suggested you needed to connect and disconnect repeatedly. I think I
just inferred it from the examples.
If I had the time, I'd rewrite the scripts to use DBI::ODBC but I'd
invested a lot of time in Win32::ODBC before I found the memory leak.
I'll probably stick with it until something else breaks.
Cheers
Steve
---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 0537-0, 09/12/2005
Tested on: 9/13/2005 8:08:34 AM
avast! - copyright (c) 1988-2004 ALWIL Software.
http://www.avast.com
Thanks, Steve. I appreciate the help.
-- Craig
--
Craig Cardimon
AUS INC.
(Knowledge Express Data Systems; 1-800-529-5337, ext. 24)
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0537-0, 09/12/2005
Tested on: 9/13/2005 8:15:05 AM
avast! - copyright (c) 1988-2004 ALWIL Software.
http://www.avast.com
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs