Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A global connection object and cloning it
Message
From
10/01/2007 02:00:59
 
 
To
All
General information
Forum:
ASP.NET
Category:
Databases
Title:
A global connection object and cloning it
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01184072
Message ID:
01184072
Views:
69
Recently, to resolve the issue about the VFPOleDb data provider, I have adjusted the design of the framework to issue a global connection object that is created when the application starts. So, when the application starts, the connection Open() is also done. This has increased consideraly the performance of the application and it works well. When I ran my stress test, I was not able to have any error. This has also been confirmed by another member. Having all hits to use the same connection object has eliminated the weird reactions caused by the VFPOleDb data provider.

However, recently, at one occurence, I got an error on a SQL exec command about an "Object reference not set to an instance of an object.". That has been reported on a command that is executed at every hit. So, I started to investigate as to know why this has been happening at one occurence. When I looked at the log, I found that two simultaneous hit were launched against the server. What surprised me is that I was not able to simulate any problem like that during the stress test. My guess is that if I would let the stress application run for hours, I may have ended up with one error. That is probably what happened here. There is still a chance of getting an error but very, very, very rarely.

So, I started to think again about enhancing that design so I would avoid such situation. When the ASP.NET site receives a hit, I have an oProcess object created for it. To oProcess, I tie oApp. So, oApp becomes available during the hit such as oProcess.oApp. Right now, I am using oProcess.oApp.aConnection(1) to get the open connection of the array 1. If I have only one connection string defined in Main.ini, thus, the array will have a length of 1. So, to avoid such collision, I was thinking of cloning oProcess.oApp.aConnection at the oProcess level. So, at every hit, once oProcess is created, if I have a property oProcess.aConnection, I could do oProcess.aConnection=oProcess.oApp.aConnection.Clone. Thus, I figure I would avoid such collision as I would have an isolated connection available for every hit, thus at the oProcess level.

I am wondering if I can clone such an object if it is open. Is there anyone who already tried that? Also, will there be some performance issue of cloning such an object at every hit. Or, is it that cloning is something that is extremly fast within the .NET infrastructure?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform