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

Posted on 2002-04-09
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 200 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.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


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:


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

821 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