Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

COM+ question

Posted on 2002-07-02
8
Medium Priority
?
276 Views
Last Modified: 2010-05-02
I have a ActiveX dll installed on a remote server which I am using to connect to SQL Server and access data, passing back to a client app.  When the dll calls the connect function, it appears that it is still the client machine that is connecting to SQL Server, not the dll.  How do I configure it so the transaction server/COM+ server handles the connection and data access rather than the client PC?
0
Comment
Question by:Joeharvey
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:rpai
ID: 7125459
Your client app would be instanciating the Activex DLL which in would establish the connection to the Server. The client would use the type library or custom proxy-stub DLL on the client to use your server application remotely.
0
 
LVL 3

Author Comment

by:Joeharvey
ID: 7127993
I'm not sure what you mean.  What needs to be done in order for the server(middle-tier) to make the actual database connection and return the result set to the client?  Or is this not possible?
0
 
LVL 18

Expert Comment

by:mdougan
ID: 7138901
Well, a couple of things.  First, your COM+ component should be handling all of the ADO calls to open the connection and recordsets etc.  I'd suggest that each method call to the component calls to open the connection and then closes the connection on the way out.  This may sound like a lot of overhead, but I think that connection pooling keeps the overhead down.  On the plus side, it forces you to design Stateless components which is much better for scaleability.

Your code should look pretty normal in the COM+ component.

In the Client, you should be sure to use CreateObject to instantiate your middle-tier component.  I think if you use New, then this invokes the COM interface and not the COM+ interface.  So, if you have a local version of the DLL (which is likely if you are working on your development machine), using New will run the local DLL as opposed to the remote one.

Last thought, you should try not to pass a recordset as in input parm to your middle-tier component.  Passing recordsets across processes has a huge overhead, and, what happens is that the COM+ component really just gets a copy of the recordset anyway (and it's not really a complete copy of the recordset, just the data without all of the property settings of things like .RecordCount, .Filter etc.)

You can return a recordset as the return value of a function, and your client should be able to use it correctly, but this is still somewhat inefficient.  We used to convert the recordset to XML using the Recordset Save option into a Microsoft DOM object, and then would send the DOM object's XML back to the client.  This was very fast.  Then, on the client, you can reload the XML into a recordset if you want, or load it into a DOM and use that to process the data.....
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:Joeharvey
ID: 7140374
mdougan,

  I was creating the component on the client using NEW.  I will try using the CreateObject and let you know what happens.  Thanks for the info.
0
 
LVL 3

Author Comment

by:Joeharvey
ID: 7144149
After installing the DLL on the server, and distributing it to a client pc, I used CreateObject to instantiate the component.  It is still creating the connection from the client pc.  Is there something inside of the dll that I am missing here?  No matter what I try I still get the connection coming from the client.
0
 
LVL 5

Expert Comment

by:rpai
ID: 7144215
I believe the only place you have the code to establish a Database connection is in the DLL component. Is that right?

Now the way COM+ works is, whenever the client app instanciates the Remote DLL (using CreateObject), there is a proxy object (of the DLL on the remote server) created on the client machine. The client would use the type library or custom proxy-stub DLL on the client to establish the DB Connection. (You can imagine as a image of the DLL object being created on the client machine). My guess is, that is the reason why it appears as if the connection is being made by the client.
0
 
LVL 3

Author Comment

by:Joeharvey
ID: 7144253
You are correct rpai.  The only code to make the db connection is in the class.  (Connecting to a SQL Server database).

When I launch the client app, I can go into SQL Server and look at the current connections.  When doing so, I see that the connection (Host name) is coming from the client pc.  


0
 
LVL 5

Accepted Solution

by:
rpai earned 600 total points
ID: 7144312
Yes, because it is the client app that is requesting the DB connection. But the actual DB connection is done by the DLL component.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question