Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Database connection pool thr application

Database connection pool thr application

Scheduled Pinned Locked Moved C#
questiondatabaseoracle
13 Posts 3 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A anishkannan

    Hi... In my web application, we are using oracle database. my question is connection pool based on web application. Our application end user around 500. for these which connection is better i) create new connection for every request of user. ii) single connection pool via singleton object of the class iii) session based connection pool ( each user has separate connection pool) which principle is using for web application? can please give suggestion or valuable link to me --Thanks

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    I think you would get a better response by posting this in the Database forum; there is nothing in your question about C#.

    Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

    L 1 Reply Last reply
    0
    • A anishkannan

      Hi... In my web application, we are using oracle database. my question is connection pool based on web application. Our application end user around 500. for these which connection is better i) create new connection for every request of user. ii) single connection pool via singleton object of the class iii) session based connection pool ( each user has separate connection pool) which principle is using for web application? can please give suggestion or valuable link to me --Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #3

      anishkannan wrote:

      i) create new connection for every request of user.

      That's what I'm doing; no problems with connections that are still open/closed/busy. Works quite fast, since connection-objects are returned to the pool. Create a connection, create a command, execute.

      anishkannan wrote:

      ii) single connection pool via singleton object of the class

      Huh?

      anishkannan wrote:

      iii) session based connection pool ( each user has separate connection pool)

      I don't think that every user needs a pool of connections.

      Bastard Programmer from Hell :suss:

      A 1 Reply Last reply
      0
      • L Lost User

        I think you would get a better response by posting this in the Database forum; there is nothing in your question about C#.

        Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        It already in the WebDevelopment[^] forum. Do we really need yet another copy of the question? :-\

        Bastard Programmer from Hell :suss:

        L 1 Reply Last reply
        0
        • L Lost User

          anishkannan wrote:

          i) create new connection for every request of user.

          That's what I'm doing; no problems with connections that are still open/closed/busy. Works quite fast, since connection-objects are returned to the pool. Create a connection, create a command, execute.

          anishkannan wrote:

          ii) single connection pool via singleton object of the class

          Huh?

          anishkannan wrote:

          iii) session based connection pool ( each user has separate connection pool)

          I don't think that every user needs a pool of connections.

          Bastard Programmer from Hell :suss:

          A Offline
          A Offline
          anishkannan
          wrote on last edited by
          #5

          Thanks for reply... Your suggested option is the open statement execution then close; In Case, the single web request has multiple open and close; it have any problem? i face this : If access multiple user in many days, some times got exception as maximum pool reached in database side... Singleton : i mean that, single open at the time of first ; all statement execution then close

          P L 2 Replies Last reply
          0
          • A anishkannan

            Thanks for reply... Your suggested option is the open statement execution then close; In Case, the single web request has multiple open and close; it have any problem? i face this : If access multiple user in many days, some times got exception as maximum pool reached in database side... Singleton : i mean that, single open at the time of first ; all statement execution then close

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #6

            If you're using the ODP.NET libraries, you could be hitting the maximum pool issue because you have unclosed connections - make sure you dispose of your connections as early as possible. Basically, the standard technique is to open the connection as late as possible and dispose of it as early as possible. We had a system with a 1000 users all hitting the Oracle server, and we never needed more than 10 connections in the pool to service them because of this simple mantra.

            *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

            My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

            A 1 Reply Last reply
            0
            • P Pete OHanlon

              If you're using the ODP.NET libraries, you could be hitting the maximum pool issue because you have unclosed connections - make sure you dispose of your connections as early as possible. Basically, the standard technique is to open the connection as late as possible and dispose of it as early as possible. We had a system with a 1000 users all hitting the Oracle server, and we never needed more than 10 connections in the pool to service them because of this simple mantra.

              *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

              My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

              A Offline
              A Offline
              anishkannan
              wrote on last edited by
              #7

              We are using our own data access layer. which has

              public DataSet ExecuteProcedure(string strProcedure, Hashtable hashTableParameters, string tableName, ref DataSet datasetToFill)
              {
              try
              {
              Open();// objConnection = new OracleConnection(strConnection);
              // Procedure Execution
              // data fill to dataset
              }
              catch (OracleException ex)
              {
              throw ex;
              }
              catch (Exception e)
              {

                      }
                      finally
                      {
                          Close(); // objConnection.Close();
                      }
              
                      return datasetToFill;
                  }
              

              Please tell me. if anything wrong in this ( i need correct in this code if has any mistaken ) we are using oracle sql developer client software. how check the connection pool in oracle db.

              L P 2 Replies Last reply
              0
              • A anishkannan

                Thanks for reply... Your suggested option is the open statement execution then close; In Case, the single web request has multiple open and close; it have any problem? i face this : If access multiple user in many days, some times got exception as maximum pool reached in database side... Singleton : i mean that, single open at the time of first ; all statement execution then close

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                anishkannan wrote:

                In Case, the single web request has multiple open and close; it have any problem?

                Not that I know of; I have an application that's opening and closing connections at a high rate, and it simply works as advertised.

                anishkannan wrote:

                Singleton : i mean that, single open at the time of first ; all statement execution then close

                That would keep the connection alive for longer than it's required, hogging the amount of available connection-objects.

                anishkannan wrote:

                i face this : If access multiple user in many days, some times got exception as maximum pool reached in database side...

                How long do you keep the connection "open"? If you keep the connection around too long, the pool will be empty quite fast.

                Bastard Programmer from Hell :suss:

                1 Reply Last reply
                0
                • A anishkannan

                  We are using our own data access layer. which has

                  public DataSet ExecuteProcedure(string strProcedure, Hashtable hashTableParameters, string tableName, ref DataSet datasetToFill)
                  {
                  try
                  {
                  Open();// objConnection = new OracleConnection(strConnection);
                  // Procedure Execution
                  // data fill to dataset
                  }
                  catch (OracleException ex)
                  {
                  throw ex;
                  }
                  catch (Exception e)
                  {

                          }
                          finally
                          {
                              Close(); // objConnection.Close();
                          }
                  
                          return datasetToFill;
                      }
                  

                  Please tell me. if anything wrong in this ( i need correct in this code if has any mistaken ) we are using oracle sql developer client software. how check the connection pool in oracle db.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  using (objConnection = new OracleConnection(strConnection))
                  {
                  // do your stuff here
                  using (objCommand = objConnection.CreateCommand())
                  {
                  }
                  }
                  // no need to close or dispose.

                  Bastard Programmer from Hell :suss:

                  A 1 Reply Last reply
                  0
                  • L Lost User

                    using (objConnection = new OracleConnection(strConnection))
                    {
                    // do your stuff here
                    using (objCommand = objConnection.CreateCommand())
                    {
                    }
                    }
                    // no need to close or dispose.

                    Bastard Programmer from Hell :suss:

                    A Offline
                    A Offline
                    anishkannan
                    wrote on last edited by
                    #10

                    Okay thanks!!!

                    L 1 Reply Last reply
                    0
                    • A anishkannan

                      Okay thanks!!!

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #11

                      My pleasure :)

                      1 Reply Last reply
                      0
                      • A anishkannan

                        We are using our own data access layer. which has

                        public DataSet ExecuteProcedure(string strProcedure, Hashtable hashTableParameters, string tableName, ref DataSet datasetToFill)
                        {
                        try
                        {
                        Open();// objConnection = new OracleConnection(strConnection);
                        // Procedure Execution
                        // data fill to dataset
                        }
                        catch (OracleException ex)
                        {
                        throw ex;
                        }
                        catch (Exception e)
                        {

                                }
                                finally
                                {
                                    Close(); // objConnection.Close();
                                }
                        
                                return datasetToFill;
                            }
                        

                        Please tell me. if anything wrong in this ( i need correct in this code if has any mistaken ) we are using oracle sql developer client software. how check the connection pool in oracle db.

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #12

                        Well, I can point out a couple of things here.

                        anishkannan wrote:

                        catch (OracleException ex) { throw ex; }

                        Completely useless code. Never catch and throw without doing something with it.

                        anishkannan wrote:

                        catch (Exception e) { }

                        You're just consuming the exception here. You have no way of knowing what's going wrong in your code now.

                        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                        My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                        1 Reply Last reply
                        0
                        • L Lost User

                          It already in the WebDevelopment[^] forum. Do we really need yet another copy of the question? :-\

                          Bastard Programmer from Hell :suss:

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #13

                          Put there after my suggestion; check the times.

                          Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups