Re: Help in design/threading

Andrewg <[email protected]> Sun, 28 Jul 2002 17:48:42 +0100
Newsgroups gmane.comp.windows.devel.vbcom
Organization developmentor
Message-ID <[email protected]>
Sorry, it was not my intention to say ‘starter’ – it was meant to be
firstly etc

Connection pooling will still work
GetObject does work – I know because I’ve implemented it!! 
Look at
http://www.devx.com/premier/mgznarch/vbpj/1997/08aug97/bbelt.pdf.
MS say GetObject does not work with monikers as the default creation of
VB objects is not to place them in the ROT. GetObject will work when
getting hold of objects that have already been instantiated within the
same project and for creating new objects. Objects must be registered in
the ROT for singletons that reside in other projects/executables - MS
obviously haven't a clue ;-)

Let me know if you want any further help :-)

A



-----Original Message-----
From: Technical discussion of VBCOM [mailto:[email protected]]
On Behalf Of Alireza Kheyrollahi
Sent: 27 July 2002 12:30
To: [email protected]
Subject: Re: [VBCOM] Help in design/threading

Andy,
 
While I did not like the notion of "starter" very much, I am grateful
that I have received rich answers to my questions, and, I actually do
not mind being called starter by a senior consultant.
 
1. I did see somewhere about windows 98 not supporting connection
pooling and I cannot find it now. But anyway, you are right it comes
with MDAC 1.5 ODBC 3.51. But when we use SQLOLEDB provider, we are
by-passing ODBC. Would it affect connection pooling?
 
2. I found resources and samples for registering object on ROT. MSDN
mentions (in several places) that GetObject will not work with VB
classes and does not tell anything about work arounds available.
 
Thanks
Ali
 
 
----- Original Message ----- 
From: "Andrew Gayter" <[email protected]>
To: <[email protected]>
Sent: Friday, July 26, 2002 3:39 PM
Subject: Re: [VBCOM] Help in design/threading

> Hi,
> 
> For starters connection pooling is available for Windows 98, it's
> actually part of the MDAC protocol stack and isn't platform dependent.
> Secondly, GetObject does work with vb6 objects - infact it works with
> all COM objects. It works in two ways. The creation of new objects and
> the retrieval of objects from what is called the running object table,
> or ROT. In your case you wanting to implement a singleton object that
> hold onto two connections? The object is to be accessible from other
> applications? To do this you will have to manually install your
> singleton into the ROT and then you can use GetObject and a moniker to
> retrieve a reference to the instance. If memory serves there is
example
> code of how to do this @ www.devx.com - search for lightweight COM
> objects
> Alternatively, you can implement the functionality yourself by using
> IRunningObject table and register and revoke - win32API, but I would
> recommend you writing this as a C++ ATL server.
> MS put loads of objects into the ROT e.g. ppt, word docs etc, you can
> view what objects are registered on your machine by using rotviewer.
> 
> I'm somewhat confused by
> 
> >2. Create our database component as single-threaded so that our
clients
> >could share the object.
> 
> How can you share an object that is single threaded? Surely, the
sharing
> of an object would mean that it would be multithreaded with
> synchronization?? If it remains as single-threaded only one client
will
> be able to access functionality in a serialized fashion?
> 
> Create an ActiveX exe and mark it as thread-per object. Design two
> classes, one, say ConnectionManager and another DBConnection. When the
> client first starts up he looks for ConnectionManager in the ROT. If
> it's not there create it and register it in the ROT. Then ask the
> ConnectionManager to create one of the two types of connections for
you,
> which can be the same method, but obviously with different connection
> strings. The connection manager should use CreateObject NOT new to
> create the connection objects.
> 
> This design will give you the behavior that you want i.e. a single
point
> to get hold of connections and connection objects that are running on
> their own threads (inside their own STAs).
> 
> Hope this helps?
> 
> A
> 
> 
> 
> 
> -----Original Message-----
> From: Technical discussion of VBCOM [mailto:[email protected]]
> On Behalf Of kheyrollahi
> Sent: 26 July 2002 10:23
> To: [email protected]
> Subject: [VBCOM] Help in design/threading
> 
> Hi all,
> 
> I have got a problem in designing the lowermost layer. Actually since
we
> are going to deploy our software on windows 98, we cannot have the
> luxury
> of connection sharing (Am I wrong?). And since we wouldn't have more
> than
> 4-5 computers on the network and all of them must be able to work
stand-
> alone in case a netwrok problem occurs or the master computer fails
(and
> our clients usually do not have even the slightest knowledge of
> computer), we have designed a pretty sohpisticated abstratction in
terms
> of connection management and fault tolerance which is done in our
> Database layer so that business layer only receives data services and
> doesn't know much about how it is done on on which connection (local
> database vs. remote database). We have also placed merge replication
> which solves inconsistencies of databases.
> 
> Now we want to create only one object of that class per machine (which
> opens and holds on to two connections one to local database and one to
> remote) and business layer tries to get the object if it is there and
> create it if it is not there, so we wouldn't be opening a new
connection
> per each biz objects. How we could implement it:
> 
> 1. Biz objects try to use GetObject(,"MyComponent.MyClass") which
sadly
> does not work for components written in VB.
> 
> 2. Create our database component as single-threaded so that our
clients
> could share the object.
> 
> 3.I couldn't think of anything else !:)
> Thank you very much for your comments and suggestions, in advance.
> 
> Ali
> 
> You can read messages from the VBCOM archive, unsubscribe from VBCOM,
or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
> 
> You can read messages from the VBCOM archive, unsubscribe from VBCOM,
or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
> 

You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.