473,616 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ 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 localSqlConnect ion. 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 1842
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
2403
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 visitors to my Web site can access my database through my Web site at one time? Or does this mean that in my code I can only use 50 connections? and like
1
4165
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 co-located server, and our former host was nice enough to send us a backup of our old SQL2000 database (about 5MB). I went into Enterprise Manager, created an empty database with the same name
11
2422
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 database through Connection.open() method, and I do not use Connection.close() method, will garbage collector collect the connection object just because i am not using it any more. 2) I am using a dataset, in which i make some modifications to the...
3
2475
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 removed the try/catch part as it is not important for my question: // This function opens a connection to the database. public static SqlConnection dbOpen() { // Create a SqlConnection object and pass in our connection string
14
4801
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 connection open all the time (as it's single user, this shouldn't be a problem). There is logic in the code to ensure that the connection is
7
2463
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 the database(Does not really matter but, in case you need to know, either MSSQL or ODBC ones) a few times when it loads to do the CURD things. How there's 3 ways proposed to do so:
3
10287
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 I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
35
4828
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 string in the web.config. I created a class with a static database connection and the class opens and closes the database.
22
60215
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 provided the following as a quick example of how to retrieve data from a database. In order to connect to a SQL Server Database using .NET you will need to import the System.Data.SqlClient package into your program. If you are not connecting to a...
1
27078
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 of using databases very well and is prerequisite reading for this article. Frinny’s article explains how to use a SQL Server in your program, but there are other databases as well. Some of them provide .NET connectors, but for those that don’t,...
0
8145
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8642
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8592
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8294
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8448
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6097
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4060
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4140
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1439
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.