Should Implement Connection Pooling Scheme?
Jul 12, 2010Should I write my own connection pooling scheme?
(Question rewritten again so I can upvote peoples answers)
Should I write my own connection pooling scheme?
(Question rewritten again so I can upvote peoples answers)
In my DAL i have more than 100 methods/Function, each and every method am opening the sqlconnection and closing the connection, this is taking too much of time to establish the connection at every time. So what i expect is one common class will create the SqlConnection that will check if the connection is Broken or Closed then create the connection again else return the connection, how to do this(Also i would like to apply ConnectionPooling).
View 7 RepliesWe're trying to get connection pooling working with uodotnet and currently failing miserably. When we turn connection pooling off everything works as expected, but when we turn it on we often get timeouts or errors with one of the following trace outputs:
2011-03-28T15:09:28 System.Exception: Non-negative number required.
[Code]....
Not all the requests fail (for example, when run through a load testing tool, 7/20 requests failed with the timeout problem).
It seems that the sessions are remaining in the pool and new attempts to create a session are repeating until the timeout limit is reached (30 seconds). We're using uodotnet.dll version 2.1.1.7196 and UniVerse version 10.3. running on an HP-UX server. We've got a single license on the dev machine we're testing on with 10 connections available in the pool (theoretically!). We're writing an ASP.Net web site, and we create a new session in the Page_Load() event which is passed to all UniVerse routines and then call close on the session in Page_Unload()/Page_Error().
to what we're doing wrong? We expected that connection pooling would improve performance, falling back on the standard mechanism if the pool was full, but whereas the non-pooled version works fine with 20 simultaneous requests, the pooled version regularly fails. We've set the connection pooling on in the application's web.config, setting MinPoolSize to 1 and MaxPoolSize to 10, leaving everything else at the defaults.
If I open a connection and don't close it after query execution completes, store it somewhere, and use it next time a request comes in, isn't it something similar to what .net does? Is it possible to maintain a pool of connections according to our requirements without depending on ADO.NET's internal mechanism? In case of ODBC, I read somewhere that connection pooling will have to be enabled from ODBC datasources and that it cannot be set from within .net. What if I open a few ODB connections, leave them open and
use those whenever a request comes in and close all of them when I know that I dont need them anymore. How is it different from connection pooling?
I am designing an ASP.NET (3.5) web application that connects to a Rocket Software UniVerse database.
I am shooting for a RESTful design and a MVC pattern. Rocket provides a .NET library called UniObjects.NET which handles everything for connecting and retrieving information from the database.
What would be the best way to in general to log my users into the database, then use that session via connection pooling? I see that in 3.5 there is the ASP.NET Routing Infrastructure and that looks promising am I in the right direction on this? Also does C# support decorators like Python and Java?
How does .NET maintain the Connection Pooling internally?
Where it is stored for different kind of aplication(WebApplication,Console)?
Can we configure the IIS for Connection Pooling?
Some one can explain me the behaviour i am observing is correct..?
[Code]....
and here is the connection string:
<add name="SecurityDB" connectionString="Data Source=xyz,8000;Initial Catalog=abcd;User ID=abcd;Password=defg" providerName="System.Data.SqlClient"></add>
i expect it to fail at 101 iteration as the default max pool size is 100 and i am not releasing any connection after i open(ie., Not closing or Disposing). But the strange behaviour is i can go up to 230 iterations and then it gives me a timeout error, can not acquire new connection.
When i look in SQL Database for number of connections created it is only 100.
My question is : When connection is not released, how is it able to re-use the previously opened connection.
I am using microsoft enterprise libarary to connect to mysql using mysql .net connector (latest version 6.2.3)
But i am facing a problem of too many connections and connection pool reached maximum limit issue.
As connection is disposed by enterprise library iteself so i dont close the connection anywhere.
So after two or three hours i found i have 100 mysql connections in sleep mode which are doing nothing and are not being reused from the code .
So i want to ask is there any issue with my code or is there any issue with mysql connector
How to check/confirm that whether SQL connection pooling is enabled for a sharepoint 2007 web-application ?
View 1 RepliesI read that I need to turn the validation to version of 2.0 to make the validateRequest="false" attribute working. Well, but how to allow requests containing html in 4.0? How can I keep the 4.0 validation scheme and allow such request to come in, say for particular web page?
I don't understand why I should lower the security of other requests like web services . So what's the 4.0 way of doing that, really?
Does anyone have a recommendation of a link(s) that provides a variety of color schemes either to be set manually or through a file for VS.NET 2008? For example instead of the default, white background with blue and black letters (VB.NET), etc. I want to see some contrasting black background color schemes or other combinations?
View 3 RepliesI am getting following error in the Test which is in the same Box but IIS requires Https to view the Page. I have change Web.Config to accept https. I was able to add the Service References without any problem but while call the method I get The HTTP request was forbidden with client authentication scheme 'Anonymous'. this error message. I am trying to use userNameAuthentication.
<bindings>
<wsHttpBinding>
<binding name="Binding1">
[code]...
I'm using a WCF with windows authentication.
I also use custom binding:
[Code]....
While trying to access the service without specifing the user credentials everything work's ok and the current user(Thread.CurrentPrincipal.Identity.Name) at service is the logged in user.
When I try to set user credentials this way:
[Code]....
The service just ignores them.
When I try it this way:
[Code]....
I'm getting this error: "The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'."
I'm not having much fun with connection pooling. The website I've written does dip into the SQL server all the time and quite a lot of times per page. Every time I nip into the SQL Server to get or set something I open a connection...
comGeneral.Connection.Open()
... do or get what I need and then close it. From what I've read any of the following should close the connection and return "one connection" (?) to the pool (top one, only if reading)....
rdrGeneral = comGeneral.ExecuteReader(Data.CommandBehavior.CloseConnection)
comGeneral.Connection.Dispose()
comGeneral.Connection.Close()
... but that's not really working for me and I keep hitting the default max 100 open pools. So I've been doing all 3 of the above (again, top one, only if reading). But alas, still the stupid thing (Yes, I am aware I'm the stupid one) keeps hitting the max.
My new plan is to set pooling to false (pooling = false ?) across the entire website and take the performance hit which wont be terrible because I don't really do anything too demanding. Trouble is I don't know how, other than setting Pooling = False, but where exactly in the webconfig would this bit of code go?
I'm using Visual Studio 2008, and my database is SQL Server 2000.
I want to add a connection to the Server Explorer in VS. The Data source is Microsoft SQL Server (SqlClient). After entering in all my information and I click Test Connection, it is successful.
But when I click OK, I get the error:
Unable to add data connection. ExecuteScalar requires an open and available connection. The connection's current state is closed.
My project use asp.net web form, and I code it with masterpage, page and mutil webcontrol to render a web page. A problem, request it slowly. I want to increase performace. I use webservice to request data, whole web control has code to request data from webservice.
I review code, and I think if my web used webservice pooling to render a webpage. But I haven't know how to code better, remove all webcontrol, and move their code to create a web page like asp web page (not asp.net)! using only one webservice to request data...
I'm currently experiencing and issue on whether to say a connection has been left open due to my code or if it's left open due to ADO.NET pooling. Here's a sample of my code:
Public Function ExecuteDataTable(ByVal strStoredProc As String, Optional ByVal objParams As SqlParameter() = Nothing, Optional ByVal cmdType As CommandType = CommandType.StoredProcedure) As DataTable
Dim objDt As New DataTable
Dim objAdapt As New SqlDataAdapter
Dim objParam As SqlParameter
Try
OpenDb()
If Not IsNothing(objParams) Then
AddParams(objParams)
End If
objAdapt.SelectCommand = New SqlCommand
With objAdapt.SelectCommand
[Code].....
Then when I go to open up the SQL Mgmt Studio, I look into the processes and the particular connection that has ran with the SQL that my function runs appears to remain open. So to me, it looks like ADO.NET is performing some kind of pooling. Is it safe to make that conclusion? How would I be able to tell if the connection is available to be used again by the ADO.NET pool?
Recently I bumped a problem with an asp.net application where seemingly random errors were thrown, although they were all related to the use of a connection object. Coming from Classic ASP, I wrote my pages by creating a connection object at the top of the page, and using that connection throughout the page. The connection object was opened whenever something had to be done with the database and closed immediately after.
Connectionstring:
"Data Source=<server>;Initial Catalog=<catalog>;Integrated Security=false;user=<user>;password=<password>;Pooling=False;"
So pooling=false.
just for my testing purpose i know i can define both the connection's outside in a single web config file by different name's and access them in my front end according to it but what if i want to have seprate for both connection's web.config situation is like this see image so i want to access my connections from second web config file how i can do that.
[Code]...
i tired this but its giving error
[Code]....
I previously used a datasource and a connection string to connect to my database on sql server and all orked fine. The connection string was saved in my web.config file and is: ....
View 1 RepliesI am using VS2008 and oracle 10g ODP.Net. The oracle database that I used in the connection is working and tested it using sql plus.The connection string when used in a GriDView works perfectly. Now when I created a new listview control with the same connection it gives an error.Database schema could not be retrieved for this connection. Please make sure connection settings are correct and the database is online
Object reference not set to an instance of an object at VSDataObjectSupport (478,6)
In my application there are 4 connection strings...from that i want one connectionstring should be default connection string.How to do ?
View 1 RepliesI have VS 2010 professional. I am trying to open "ASP.Net Configuration" through Project -> ASP.Net Configuration.
It pops up the Notification about the ASP.Net Development Server localhost but doesn't open ASP.Net Configuration in the default browser.I clicked on the Root Url (by double clicking on the 'development server' at the right bottom from Notification Manager).
It throws following error
"An error was encountered. Please return to the previous page and try again."
Clicking on "How do i use this tool".It opened page with error.
Tool Has Timed Out
I am preparing for an Access2007 db conversion at the beginning of the year and would like to know what the best process would be for connecting to the sqlserver2005 database. I have read about adding the connection string to the web.config file. I have also read about using ADO.NET and put the connection information into a class and not the web.config file.
I would like to hear from others as to what you have used, are using, or plan on using for a webapp (vs2010), and why so I can get an understanding.
I am new in Asp.net with Oracle and not build proper connection in it.
View 2 Replies