How to duplicate another instance of COM in the same server?

Posted on 2002-04-09
Medium Priority
Last Modified: 2011-09-20
I have a com dll used in a website.
It is used to communicate with the database.
It stores the connection string...etc

now I need to reuse this com dll in another website to connect to another database.
the website is in the same server.

I make another copy of the source code and change the sql connection string. when I try to register the dll in component services, it return "The object is already registered"

How do I duplicate another copy of the dll? The com class name must remain the same otherwise I have to recode the asp files that calls this com.
Question by:stl

Accepted Solution

pkreddy earned 600 total points
ID: 6930811
Probably you can try this...
 Make a copy of the source code, change its CLSID & Prog-id. You can generate new CLSID using 'guidgen.exe' and replace the old CLSID. Make necessary changes required by you and recompile and use it with new Prog-id & CLSID.

Expert Comment

ID: 6931087
I think U can use the same component.
U can add functions for setting
Database , Password and UserName to the interface.
So after creating the com through ASP U can call set function with required Database before calling other functions .

Simply U can avoid the code duplication. If the code are same.

If I misunderstood Ur comment sorry for that.



Author Comment

ID: 6932887
I have tried changin CLSID before, it will not work.
May be changing prog-id will work but does that mean that I have to change all my asp code that creates the object?

this means that I have to change all existing asp code.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Expert Comment

ID: 6933346
I don't think much change needed on asp.

add one function with three parameters

HRESLUT Setparams( BSTR Database , BSTR Password , BSTR UserName);

Need to call one additional  function for
setting Database , Password and UserName to the interface

Object.SetParams( DatabseName, DBUserName, DBPassword )

I think better to try this.
LVL 22

Expert Comment

ID: 6941184
If your component uses COM+, its better to support Consrtuctor String by implementing a single interface ICOnstructString. This lets your component be administered thru the management console and you can later change the Connection string without needing to change even a single line of code.

For other platforms or reasons, and as mentioned above you can pass the Connection String from the ASP pages. This way again your component will not need be re-written or duplicated.

I guess this is far better than duplicating and managing two different components that differ only in the way they connect to the database.
LVL 11

Expert Comment

ID: 7012017
Dear stl

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept


comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/


Featured Post

Industry Leaders: 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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

609 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