web.config having multilple connection string name with same connection.

Last post 02-01-2008 8:00 AM by Careed. 8 replies.

Sort Posts:

  • web.config having multilple connection string name with same connection.

    01-30-2008, 4:42 PM

    Issue 1:  

    <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/>

     And use Conn1(Read and Write from DB)  All over the application. (for exam: all Data Access Layer).

    Versus

    Issue 2:

    <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/>

    <add name="Conn2" connectionString="Data Source= SID ;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client" />

    And use Conn1(read from DB) and Conn2(write to DB) All over the application(for exam: all Data Access Layer).

    Note: Conn1 and Conn2 has same SID,UserName and Password.

    My Question is Does is make sense that Issue2 will be more faster than Issue1 in performance of website. or is there any other way having Issue2 can be proved to helpful( like looking at session of database and can see info about that connection pool ????

    Please discuss.

    work smarter, Not Harder.

    Bhavesh Patel
  • Re: web.config having multilple connection string name with same connection.

    01-30-2008, 5:05 PM
    • Loading...
    • Careed
    • Joined on 06-24-2002, 3:37 AM
    • Lubbock, TX
    • Posts 785

    I see no reason for Issue2 to be faster than Issue1.  In fact, I could see that it would be slower since you have more ConnectionStrings to deal with (though if this was an issue, it would be infinitesimal).

    All you are doing is reading the ConnectionString from the web.config.  If nothing else is different, I do not see that this would make any difference at all.

    Christopher Reed
    "The oxen are slow, but the earth is patient."
  • Re: web.config having multilple connection string name with same connection.

    01-31-2008, 4:43 AM

    BhaveshPatel:

    Issue 1:  

    <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/>

     And use Conn1(Read and Write from DB)  All over the application. (for exam: all Data Access Layer).

    Versus

    Issue 2: <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/>

    <add name="Conn2" connectionString="Data Source= SID ;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client" />

    And use Conn1(read from DB) and Conn2(write to DB) All over the application(for exam: all Data Access Layer).

    Note: Conn1 and Conn2 has same SID,UserName and Password.

    My Question is Does is make sense that Issue2 will be more faster than Issue1 in performance of website. or is there any other way having Issue2 can be proved to helpful( like looking at session of database and can see info about that connection pool ????

    Please discuss.

    Issue1 would be faster than Issue2 as Issue1 will fetch the connection from the same connection pool whereas for Issue2, two different connection pools would be created.

    -----------------------------------------------------------------

    Please click Mark as Answer if this helped in solving your problem.

    -----------------------------------------------
    Please click Mark as Answer if this helped.
  • Re: web.config having multilple connection string name with same connection.

    01-31-2008, 8:01 AM
    • Loading...
    • Careed
    • Joined on 06-24-2002, 3:37 AM
    • Lubbock, TX
    • Posts 785

    I must disagree.  These are the same ConnectionStrings regardless of how they are named in the web.config.  Thus, they would have the same connection pool since the connection strings themselves are the same.

    A connection pool is created with each unique connection string.  You are using only one connection string, thus you will only have one connection pool.  The web.config conventions are all semantics, not distinct connection strings.

     

    Christopher Reed
    "The oxen are slow, but the earth is patient."
  • Re: web.config having multilple connection string name with same connection.

    01-31-2008, 9:20 AM

    Careed:

    I must disagree.  These are the same ConnectionStrings regardless of how they are named in the web.config.  Thus, they would have the same connection pool since the connection strings themselves are the same.

    A connection pool is created with each unique connection string.  You are using only one connection string, thus you will only have one connection pool.  The web.config conventions are all semantics, not distinct connection strings.

     

     

    Hi Christopher,

    My understanding of Connection Pooling says that the a connection pool depends on the connection object's parameters. In this case, the first case and the second case mentioned have the same parameter's but they differ in name, which is also a parameter. So, isn't two different connection objects are getting created this way, both having a different connection pool of it's own.

    -----------------------------------------------
    Please click Mark as Answer if this helped.
  • Re: web.config having multilple connection string name with same connection.

    01-31-2008, 11:10 PM
    Answer
    • Loading...
    • Careed
    • Joined on 06-24-2002, 3:37 AM
    • Lubbock, TX
    • Posts 785
    The connection pool is only based on the connection string, not on the short-cut method that ASP.NET provides to use the web.config to store the connection string.  The connection string is the actual string used to defined the connection to the database.  In this case, the two strings conn1 and conn2 are exact, thus, they will generate one connection pool.  The issue is how ADO.NET handles the connection pooling, not how the ConnectionStrings element in the web.config is set up.  In other words, do not confuse the ConnectionStrings element with the actual connection string used in the connection process.  It is at the time of the connection that the connection pooling is determined.  At that point in time, the way the connection string will entered into your programming is immaterial.
    Christopher Reed
    "The oxen are slow, but the earth is patient."
  • Re: web.config having multilple connection string name with same connection.

    01-31-2008, 11:34 PM

    Thanks guys!!! It was a good to know about connectionSrtings and Actual connection string used in the connection process.

    do you have any article or and link which gives more detail on above statement? I will appreciate it.

    work smarter, Not Harder.

    Bhavesh Patel
  • Re: web.config having multilple connection string name with same connection.

    02-01-2008, 2:37 AM

    BhaveshPatel:

    Thanks guys!!! It was a good to know about connectionSrtings and Actual connection string used in the connection process.

    do you have any article or and link which gives more detail on above statement? I will appreciate it.

    Visit http://www.15seconds.com/issue/040830.htm

    It provides a good examples and explanation on ADO.NET Connection objects and Connection pooling.

    Aparna.

    ----------------------------------------------------------------------

    Please click Mark as Answer if this helped in solving your problem.

    -----------------------------------------------
    Please click Mark as Answer if this helped.
  • Re: web.config having multilple connection string name with same connection.

    02-01-2008, 8:00 AM
    • Loading...
    • Careed
    • Joined on 06-24-2002, 3:37 AM
    • Lubbock, TX
    • Posts 785
    Christopher Reed
    "The oxen are slow, but the earth is patient."
Page 1 of 1 (9 items)
Microsoft Communities
Page view counter