473,490 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Big Database Connection Problem with ASP .NET

eboschi
2 New Member
Hi all, i'm new to .net programming and i have some problems with database connection. I have written two web application. Both of them use ADODB Connection to Sql Server 2000 database. The problem is in second one.

The first application is used for order management. I have defined in Main.aspx page a variable called localSqlConnection. Every time i enter this page (only one time per session) i create connection to local database and then i save this variable in Session object. Whenever i need connection to database in other project aspx page i retrieve connection from db, casting it to SqlConnection class and all works correctly. This first application is used by a little group of users

The second application is used by a greater number of users. It is used for request management. Before starting coding i suspect that connection saved in session is'nt a good solution for large numbers so I modify my code removing the use of Session Obect. In each aspx page i put a method that create/open connection and a method that close connection to database. I call this two method every time Page_Load and Page_Unload event was raised. Each method of Page Class uses my local page variable. It seems to works but something was wrong because a lot of time i receive database connection error !!! When it appens i launch the iisreset command on web server and all restart working, but this is not an acceptable solution.

So, what i can try ? I can't modify all my code for open and close connection every time i have to make a database operation. It's a lot of code.
Is there any solutions ?
Thanks in advance
Emanuele
Jan 3 '08 #1
3 1831
kenobewan
4,871 Recognized Expert Specialist
I believe that this is an application design problem. May help to use your connections from a class or config file. You may want to look at data caching if performance is an issue. HTH.
Jan 3 '08 #2
eboschi
2 New Member
I believe that this is an application design problem. May help to use your connections from a class or config file. You may want to look at data caching if performance is an issue. HTH.
It's seems not to be a performance problem. I have created specific index on my target table. Of course i will look about a new class dedicated to create connection and maintain connection.

The problem, i think, is that connection will be instantiated but, whenever we have delay in result retrieving, all the other connection request are queued and my asp server will not serve them. And when this connection queue became too long no new connection was released. I just put a timeout on my query but it does'nt work anyway.

So what is the right solution ? create and open connection before query and close it immediately after result became availlable ?

Thanks
emanuele
Jan 3 '08 #3
kenobewan
4,871 Recognized Expert Specialist
I was thinking that the large number of connections that end up open was the problem. Is this one of those course assignments that fail to reflect the real world? By all means store the connection variable in a session, but only open it when it is executed and then close immediately. Good luck!
Jan 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2395
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
1
4148
by: Ben M. | last post by:
Greetings all, This should be an easy task, and Im sure it is, but as many times as I have tried, I cant seem to get this to work properly. We changed ISPs recently from a shared host to a...
11
2396
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
3
2471
by: R Reyes | last post by:
Hi, I'm trying to modularize my database connections a little better and get more out of my project with less code. First check out this common dbOpen() function inside class clsDatabase. I...
14
4776
by: Nick Gilbert | last post by:
Hi, I have an asp.net application which runs from a CD-ROM using Cassini. As such, it is single user only. The application connects to an Access database when it is loaded, and keeps the same...
7
2453
by: Lau Lei Cheong | last post by:
Hello, Actually I think I should have had asked it long before, but somehow I haven't. Here's the scenerio: Say we have a few pages in an ASP.NET project, each of them needs to connect to...
3
10270
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
35
4803
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
22
60143
Frinavale
by: Frinavale | last post by:
How To Use A Database In Your Program Many .NET solutions are database driven and so many of us often wonder how to access the database. To help you understand the answer to this question I've...
1
27048
Curtis Rutland
by: Curtis Rutland | last post by:
How To Use A Database In Your Program Part II This article is intended to extend Frinny’s excellent article: How to Use a Database in Your Program. Frinny’s article defines the basic concepts...
0
7108
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.