Perhaps I'm missing something, but couldn't you essentially have it both ways. What about allowing your method that initiates the object optionally accept a reference to a DBI object? If a DBI object reference is passed, your object will use that. If one isn't passed, have it open a new connection using DBI. That would give you flexibility for deciding which approach is best for each instance of the object.
One advantage I to multiple connections that I can see is different users and different privileges for different connections. This could allow you to make sure "bad things" are less likely to occur on a grand scale. Duncan ----------------------------------------------- Duncan Salada Titan Systems Corporation 301-925-3222 x375 -----Original Message----- From: Tom Norwood [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2003 10:47 AM To: Paul DuBois Cc: [EMAIL PROTECTED] Subject: RE: multiple simultaneous DBI connections? Paul, I guess I would see the fact that the script would hold the connection to MySQL for a shorter period of time, as the most obvious advantage. As far as OO programming goes the integration of DBI into my object would assure that a connection to the database would be established automatically before the object's methods try to initiate calls to the MySQL server. Also a similar point goes for disconnect()-ing from the server, my object would 'know' that a connection is available if it exists! So no additional coding would be required within my object's methods. Tom Norwood. -----Original Message----- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: 13 March 2003 15:14 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: multiple simultaneous DBI connections? At 14:47 +0000 3/13/03, Tom Norwood wrote: >I am currently looking at building a Perl object to handle data from a >a database. >I'm not really sure if it is best to have one connection to MySQL and >let the object just deal with its own properties. >Or to allow the object to initiate a DBI connection each time an instance >of the object is created, and to disconnect() using garbage disposal. > >Although the object initially would only have one instance per script, >I can't help feeling it is a bad idea. It's difficult to give you an answer each way unless you tell us why you suspect it might be a bad idea. Certainly you'll use somewhat more resources on both the client and server ends if you maintain multiple open connections. What would you see as an advantage to having multiple connections? > >Any thoughts welcome, and greatly appreciated, >Tom Norwood. This email has been scanned for viruses by NetBenefit using Sophos anti-virus technology This email has been scanned for viruses by NetBenefit using Sophos anti-virus technology --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php