473,785 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

global connections

I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
recordsets, all global and open all the time so that all the required
procedures can use them. Using C#, would it be best to have a global
connection and datareaders etc, or is it better to put all the db stuff
into a seperate class and make calls to this whenever I need to
read/amend data?

Any advice would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
9 1658
Mike,

Having a connection open all the time to a database is not a good thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
recordsets, all global and open all the time so that all the required
procedures can use them. Using C#, would it be best to have a global
connection and datareaders etc, or is it better to put all the db stuff
into a seperate class and make calls to this whenever I need to
read/amend data?

Any advice would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
I would think that for a client-server app (assuming that's what this VB6 app
is most likely), global connection actually make sense. since you can't
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mike,

Having a connection open all the time to a database is not a good thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
recordsets, all global and open all the time so that all the required
procedures can use them. Using C#, would it be best to have a global
connection and datareaders etc, or is it better to put all the db stuff
into a seperate class and make calls to this whenever I need to
read/amend data?

Any advice would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #3
Daniel,

Why can't you take advantage of connection pooling in this situation?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:02******** *************** ***********@mic rosoft.com...
I would think that for a client-server app (assuming that's what this VB6
app
is most likely), global connection actually make sense. since you can't
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mike,

Having a connection open all the time to a database is not a good
thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around
and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
>I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
> recordsets, all global and open all the time so that all the required
> procedures can use them. Using C#, would it be best to have a global
> connection and datareaders etc, or is it better to put all the db stuff
> into a seperate class and make calls to this whenever I need to
> read/amend data?
>
> Any advice would be really appreciated.
>
>
> Cheers,
>
> Mike
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #4
I would think that for a client-server app (assuming that's what this VB6 app
is most likely), global connection actually make sense. since you can't
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mike,

Having a connection open all the time to a database is not a good thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
recordsets, all global and open all the time so that all the required
procedures can use them. Using C#, would it be best to have a global
connection and datareaders etc, or is it better to put all the db stuff
into a seperate class and make calls to this whenever I need to
read/amend data?

Any advice would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #5
Daniel,

Why can't you take advantage of connection pooling in this situation?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:02******** *************** ***********@mic rosoft.com...
I would think that for a client-server app (assuming that's what this VB6
app
is most likely), global connection actually make sense. since you can't
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mike,

Having a connection open all the time to a database is not a good
thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around
and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
>I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
> recordsets, all global and open all the time so that all the required
> procedures can use them. Using C#, would it be best to have a global
> connection and datareaders etc, or is it better to put all the db stuff
> into a seperate class and make calls to this whenever I need to
> read/amend data?
>
> Any advice would be really appreciated.
>
>
> Cheers,
>
> Mike
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #6
well, unlike a webapp that can service thousands of requests at a given point
in time, a client-server app usually will serve 1 user per machine. I don't
see how much you can gain by going to a connection pool over 1 constant
connection. unless I guess if you use a lot of threading to execute sql
commands concurrently. but that will put more stress on the DB server I
think since all the connections in the pool are kept open over a longer
duration.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Daniel,

Why can't you take advantage of connection pooling in this situation?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:02******** *************** ***********@mic rosoft.com...
I would think that for a client-server app (assuming that's what this VB6
app
is most likely), global connection actually make sense. since you can't
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mike,

Having a connection open all the time to a database is not a good
thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around
and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
>I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
> recordsets, all global and open all the time so that all the required
> procedures can use them. Using C#, would it be best to have a global
> connection and datareaders etc, or is it better to put all the db stuff
> into a seperate class and make calls to this whenever I need to
> read/amend data?
>
> Any advice would be really appreciated.
>
>
> Cheers,
>
> Mike
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #7
well, unlike a webapp that can service thousands of requests at a given point
in time, a client-server app usually will serve 1 user per machine. I don't
see how much you can gain by going to a connection pool over 1 constant
connection. unless I guess if you use a lot of threading to execute sql
commands concurrently. but that will put more stress on the DB server I
think since all the connections in the pool are kept open over a longer
duration.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Daniel,

Why can't you take advantage of connection pooling in this situation?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:02******** *************** ***********@mic rosoft.com...
I would think that for a client-server app (assuming that's what this VB6
app
is most likely), global connection actually make sense. since you can't
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mike,

Having a connection open all the time to a database is not a good
thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around
and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
>I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
> recordsets, all global and open all the time so that all the required
> procedures can use them. Using C#, would it be best to have a global
> connection and datareaders etc, or is it better to put all the db stuff
> into a seperate class and make calls to this whenever I need to
> read/amend data?
>
> Any advice would be really appreciated.
>
>
> Cheers,
>
> Mike
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #8
Daniel,

I would say that it might be questionable whether or not to use
connection pooling then. If the stand alone app is going to perform many
data operations in a short period of time, or it does a lot of transactional
work in COM+, then I think it is warranted. But if it just does the
occasional query, then I wouldn't recommend it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:24******** *************** ***********@mic rosoft.com...
well, unlike a webapp that can service thousands of requests at a given
point
in time, a client-server app usually will serve 1 user per machine. I
don't
see how much you can gain by going to a connection pool over 1 constant
connection. unless I guess if you use a lot of threading to execute sql
commands concurrently. but that will put more stress on the DB server I
think since all the connections in the pool are kept open over a longer
duration.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Daniel,

Why can't you take advantage of connection pooling in this situation?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:02******** *************** ***********@mic rosoft.com...
>I would think that for a client-server app (assuming that's what this
>VB6
>app
> is most likely), global connection actually make sense. since you
> can't
> really take advantage of connection pooling in this situation, and
> opening
> and closing physical connections all the time is too costly.
>
> agree that data access stuff should still be abstracted out regardless.
>
> "Nicholas Paldino [.NET/C# MVP]" wrote:
>
>> Mike,
>>
>> Having a connection open all the time to a database is not a good
>> thing.
>> If anything, you should be opening and closing it when you need it.
>>
>> In general, it would be a good idea to abstract out the data
>> access
>> stuff. This way, you create a single pipe through which all of your
>> data
>> access will flow. This is a good thing, because any changes you have
>> to
>> make will be propogated everywhere (instead of you having to go around
>> and
>> change everything yourself).
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mv*@spam.guard. caspershouse.co m
>>
>> "Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
>> news:ef******** ******@tk2msftn gp13.phx.gbl...
>> >I am converting a VB6 app to C# and the VB6 app has 1 connection and
>> >3
>> > recordsets, all global and open all the time so that all the
>> > required
>> > procedures can use them. Using C#, would it be best to have a
>> > global
>> > connection and datareaders etc, or is it better to put all the db
>> > stuff
>> > into a seperate class and make calls to this whenever I need to
>> > read/amend data?
>> >
>> > Any advice would be really appreciated.
>> >
>> >
>> > Cheers,
>> >
>> > Mike
>> >
>> >
>> >
>> > *** Sent via Developersdex http://www.developersdex.com ***
>> > Don't just participate in USENET...get rewarded for it!
>>
>>
>>


Nov 16 '05 #9
Daniel,

I would say that it might be questionable whether or not to use
connection pooling then. If the stand alone app is going to perform many
data operations in a short period of time, or it does a lot of transactional
work in COM+, then I think it is warranted. But if it just does the
occasional query, then I wouldn't recommend it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:24******** *************** ***********@mic rosoft.com...
well, unlike a webapp that can service thousands of requests at a given
point
in time, a client-server app usually will serve 1 user per machine. I
don't
see how much you can gain by going to a connection pool over 1 constant
connection. unless I guess if you use a lot of threading to execute sql
commands concurrently. but that will put more stress on the DB server I
think since all the connections in the pool are kept open over a longer
duration.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Daniel,

Why can't you take advantage of connection pooling in this situation?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Daniel Jin" <Da*******@disc ussions.microso ft.com> wrote in message
news:02******** *************** ***********@mic rosoft.com...
>I would think that for a client-server app (assuming that's what this
>VB6
>app
> is most likely), global connection actually make sense. since you
> can't
> really take advantage of connection pooling in this situation, and
> opening
> and closing physical connections all the time is too costly.
>
> agree that data access stuff should still be abstracted out regardless.
>
> "Nicholas Paldino [.NET/C# MVP]" wrote:
>
>> Mike,
>>
>> Having a connection open all the time to a database is not a good
>> thing.
>> If anything, you should be opening and closing it when you need it.
>>
>> In general, it would be a good idea to abstract out the data
>> access
>> stuff. This way, you create a single pipe through which all of your
>> data
>> access will flow. This is a good thing, because any changes you have
>> to
>> make will be propogated everywhere (instead of you having to go around
>> and
>> change everything yourself).
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mv*@spam.guard. caspershouse.co m
>>
>> "Mike P" <mr*@telcoelect ronics.co.uk> wrote in message
>> news:ef******** ******@tk2msftn gp13.phx.gbl...
>> >I am converting a VB6 app to C# and the VB6 app has 1 connection and
>> >3
>> > recordsets, all global and open all the time so that all the
>> > required
>> > procedures can use them. Using C#, would it be best to have a
>> > global
>> > connection and datareaders etc, or is it better to put all the db
>> > stuff
>> > into a seperate class and make calls to this whenever I need to
>> > read/amend data?
>> >
>> > Any advice would be really appreciated.
>> >
>> >
>> > Cheers,
>> >
>> > Mike
>> >
>> >
>> >
>> > *** Sent via Developersdex http://www.developersdex.com ***
>> > Don't just participate in USENET...get rewarded for it!
>>
>>
>>


Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6578
by: Matt Calhoon | last post by:
Hi there, How does IIS 6.0 treat the global.asa file? I had the following problem; 1. uploaded a new site to the win3k server 2. had incorrect db connection string in Session_OnStart in global.asa and website caused errors. 3. Changed the global.asa file to include the correct details. Saved the file. Still got the same errors.
3
515
by: Phil Lamey | last post by:
Hi All, I have the following code but for some reason I cannot get the Session_OnEnd event to fire. I am trying to limit the amount of connections a browser session can have. Where the application is a virtual directory. Any ideas? ------------
2
3501
by: Bryan | last post by:
Hello, I'm just starting to develop in asp.net and i have a question about using a database connection globally in my app. I have set up the procedures for getting all my connection string info which each page will use, but my question relates to how to use the database connection i create in all my classes. I have a database class, in a separate namespace and file, i created that handles all the connection opening, executing statements...
7
1773
by: g | last post by:
hello! I wanna use a global variable,witch is the best way(I don't want to use a Singleton for an integer)? I try : #ifndef DUMY_H_ #define DUMY_H_ int connections; #endif /*DUMY_H_*/
4
2369
by: Chris | last post by:
Hi, I want to put the namespaces and the data connection into global.asax like this: <%@ import namespace="System.Data"%> <%@ import namespace="System.Data.OleDb"%> <script runat="server"> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim oConnection As System.Data.OleDb.OleDbConnection oConnection = New System.Data.OleDb.OleDbConnection()
35
4851
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.
4
2662
by: arbpen | last post by:
I am concerned about performance. Usually, in a situation where I am not using a global.asa (shared host, etc), I explicitly close the connection at the bottom of the page in a footer, eg: conn.Close set conn = nothing Now, I am working with a global.asa file, and the following: sub Application_OnStart conString = "driver={sql server}......" Application("conString")=conString set Conn = Server.CreateObject("ADODB.Connection")
37
3988
by: Joshua Ruppert | last post by:
When I'm using FastCGI do I need to code differently than I do when using regular CGI? Because the PHP.exe processes don't go away do global variables stick around from page request to page request, creating the need for better managment / pooling of DB connections? Josh
5
8840
by: Rahul B | last post by:
Hi, I have very little knowledge about creating Procedures/functions in DB2. When i tried to create the test function like CREATE FUNCTION GET_TEST (P_TEST_ID INTEGER, P_SEL_OR_SORT INTEGER,
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10325
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
10148
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
10091
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
9950
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
7499
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
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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...

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.