Com+ Error

I am using Com+ object pooling in my application .I specified the attribute for connection string using

< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

[Transaction(TransactionOption.Required),ObjectPooling(MinPoolSize=-1,MaxPoolSize=3),

      JustInTimeActivation(true),SecurityRole("Authorized Users",false),

      ConstructionEnabled(Default="Provider=OraOLEDB.Oracle;data source=DBOracle;uid=XXX;password=XXXXXX")]

 

 

Then later on I modified it to

[Transaction(TransactionOption.Required),ObjectPooling(MinPoolSize=-1,MaxPoolSize=3),

      JustInTimeActivation(true),SecurityRole("Authorized Users",false),

      ConstructionEnabled(Default="SERVER=ps2900;database=DotNet;uid=XXX;password=XXXXXX")]

 

Then I compiled my application into a dll and referenced it another application.But when I try to invoke the method connecting to the back end it gives me an exception stating

 

Unknown connectionoption in connection string provider


Answer this question

Com+ Error

  • Rabtok

    You should read up about object pools in COM+ in MSDN as it is a complex topic.  But effectively it means that you can have multiple instances of your COM+ object in memory at the same time.  COM+ will use one of the objects in the pool instead of creating a new instance.  This is normally done for objects that are expensive to create or that are used frequently.  In your case I don't think the object pool is gaining you much unless your objects are invoked frequently but since it is going to a DB I don't think performance is that much of an issue.

    Nonetheless given your original posting the problem is that "uid" in your connection string is not a valid SQL parameter.  Change it to "user id" and it should work.

    Michael Taylor - 10/19/05

  • Kinetic Media

    In this case I don't think the COM+ attributes you are specifying is the important part of the code.  Your ConstructionEnabled(Default=...) is just specifying the options to pass to the constructor of the underlying class.  You should post your constructor code so we can see how you are creating the DB. 

    Taking a shot at what I see I notice that you were originally connecting to Oracle and you have since switched to SQL   Did your constructor get updated to use SqlConnection instead of OracleConnection.  If not then the problem would be that your connection string is invalid for an Oracle DB.  I don't think uid is valid for SQL.  I believe it is "User Id".

    There is a little VBScript floating around the web called GetConnString that I use to generate connection strings.  Basically it invokes the ODBC tool to generate a standard connection string and then dumps it to the console.  You could use it to generate a correct connection string instead of trying to guess the params.  Unfortunately conn strings are standard across the board.

    Hope this helps,
    Michael Taylor - 10/18/05

  • SunilKannan

    I have changed the parameter uid in the connection string but it does not solve the problem.My connectin string is (i still get the runtime exception stating Unknown connection option in connection string :Provider)
    [Transaction(TransactionOption.Required),ObjectPooling(MinPoolSize=-1,MaxPoolSize=3),

    JustInTimeActivation(true),SecurityRole("Authorized Users",false),

    ConstructionEnabled(Default="SERVER=ps2900;database=DotNet;user id=XX;password=XXXXXX")]
    Thanks and regards
    Rohit



  • _Raj_

    This is the code which i am  using

    namespace
    Library_Com

    {

    [Transaction(TransactionOption.Required),ObjectPooling(MinPoolSize=-1,MaxPoolSize=3),

    JustInTimeActivation(true),SecurityRole("Authorized Users",false),

    ConstructionEnabled(Default="SERVER=ps2900;database=DotNet;uid=sa;password=s86/219thst")]

    public class Library:ServicedComponent

    {

    public SqlConnection o_conn=new SqlConnection();

    private string Connectionstring;

    public Library(){}

    protected override void Construct(string construct_string)

    {Connectionstring=construct_string;}

    [AutoComplete()]

    public void FetchDeparment(string S_name,string S_status)

    {

    string command_text="insert into Student_1 values(" + S_name + "," + S_status+")";

    SqlCommand o_comm=new SqlCommand();

    o_comm.CommandText=command_text;

    o_comm.Connection=o_conn;

    if(o_conn.State==ConnectionState.Closed)

    o_conn.ConnectionString=Connectionstring;

    o_conn.Open();

    SqlDataAdapter o_adapter=new SqlDataAdapter(o_comm);

    o_comm.ExecuteNonQuery();

    o_conn.Close();

    }//end of method fetchDepartment

    }//end of class Library

    }//end of namespace

    (2)I had read somewhere that object pools using Com+ persist beyond the life of the applications that actually created those pools.Can you please let me know how this happens internally
    Thanks and regards
    Rohit



  • Doc Glazer

    Did you verify that when the object was reregistered with COM+ that the new settings were applied   It seems like your connstring has a Provider specified (like the original version you had) but you can't specify provider when you are using a specific version (like SqlConnection).

    Michael Taylor - 10/20/05


  • Com+ Error