Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2003

Tip: Looking for answers? Try searching our database.

Question on Component Lifetime

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barry Lance - 25 Sep 2003 16:41 GMT
I've always thought that storing handles for reuse at different times was a
bad thing, but I though I would bounce this idea off this group and see what
everyone else here thought.  I have a COM+ DLL I wrote in VS.NET 2K3 that
exposes itself as a COM object for use on an NT4 (SP6a) Database server
running SQL Server 2000.  I use this component in a couple database
triggers.  It's purpose is to validate a couple business rules and mirror a
copy of the data.  Whenever a user inserts or updates a record on the SQL
server it connects to a DB2 Database running on an AS400 and validates the
customer and unit data.  In addition to this validation, it also mirrors any
data changes (insert, update, delete) in a mirror DB stored on this AS400.
The problem I run into is that my component is very expensive in terms up
initiation time because it has to connect to the iSeries build the
connection and actually open it.  This instantiation time takes anywhere
between 5 and 10 seconds each time and becomes a serious burden on the app
due to heavy data modifications by end users.  So what I was considering was
creating a table in tempdb (a database that is destroyed and recreated each
time the server starts up) and store the object ID (COM object name), the
caller ID (proc id) and the COM handle to an instance for this combination
of Object and Caller ID's).  In other words, each trigger would have a
defined caller id and it's own instance of my object.  If an instance
doesn't exist for this combination, one is created, stored in this table
upon request and the handle returned to the caller.  However, if there is an
active instance, it's handle is returned,  Likewise, when a request is made
to destroy an instance, the instance is destroyed and removed from this
table.  And since the DLL runs in the same address space as the SQL server,
all active instances would be destroyed as well as the table in the tempdb
whenver the server was started.

Is this a BIG NO-NO to store these handles like this or should I look in a
different direction like obkect pooling?  If pooling is the way to go can
someone point me in the direction to some doc on how to code this technique.
Please advise if this is a question I should ask in the SQL server group
rather than here in interop.

Thanks

Barry Lance
Barry Lance - 26 Sep 2003 01:13 GMT
Well I tried coding this today for fun to see how it would work.  What I
learned is that it won't.  Time to read up on Object pooling I guess.

Barry

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.