By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,190 Members | 1,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,190 IT Pros & Developers. It's quick & easy.

Handling Connections in ASP.NET

P: n/a
yop
Lads

Am using ASP.NET, Framework 1.1
Creating a web application to read details from a MYSQL
database.
Am using the dbProvider to create connection to the DB.
I am having a lot of issues with connection pooling etc.
Also of late getting an error, "Could not initiate
communication with the server" which is strange.

How do you suggest I handle connections? At the moment I
create a new connection in each function in the .VB files
but these connections are been closed and destroyed as I
leave the function.

Is it possible to create a connection once and share it
across all pages/code files?

Thanks
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
yop
Ravikanth

Thanks for that, I presume that this is in the session
object that I do that

Thanks

-----Original Message-----
Hi

You can open connection in Application_OnStart and can beshared across all pages.

Ravikanth[MVP]

-----Original Message-----
Lads

Am using ASP.NET, Framework 1.1
Creating a web application to read details from a MYSQL
database.
Am using the dbProvider to create connection to the DB.
I am having a lot of issues with connection pooling etc.
Also of late getting an error, "Could not initiate
communication with the server" which is strange.

How do you suggest I handle connections? At the moment Icreate a new connection in each function in the .VB

files
but these connections are been closed and destroyed as Ileave the function.

Is it possible to create a connection once and share it
across all pages/code files?

Thanks
.

.

Nov 17 '05 #2

P: n/a
I have the same problem....

I have a web app (upgraded from a traditional client/server app) with a
dozen or so web forms that will be accessed by about a hundred users
(possibly at one time). The number of transactions may be relatively
extensive (no google, but 1000's of reads and writes to the db per day)

What is the preferred/suggested method for the database connection.

COnnection pooling?
Application_OnStart

Currently, I am opening and closing the connection as needed. It is/can be
inefficient at times.

TIA
E
"Ravikanth[MVP]" <dv*********@hotmail.com> wrote in message
news:08****************************@phx.gbl...
Hi

You can open connection in Application_OnStart and can be
shared across all pages.

Ravikanth[MVP]

-----Original Message-----
Lads

Am using ASP.NET, Framework 1.1
Creating a web application to read details from a MYSQL
database.
Am using the dbProvider to create connection to the DB.
I am having a lot of issues with connection pooling etc.
Also of late getting an error, "Could not initiate
communication with the server" which is strange.

How do you suggest I handle connections? At the moment I
create a new connection in each function in the .VB

files
but these connections are been closed and destroyed as I
leave the function.

Is it possible to create a connection once and share it
across all pages/code files?

Thanks
.

Nov 17 '05 #3

P: n/a
Connection Pooling is built into the .Net Framework. It is best to open and
close Connections as quickly as possible. Connection Pooling will take care
of the rest.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

"Eric Fortin" <em******@comcast.net> wrote in message
news:2UOYa.98094$YN5.69586@sccrnsc01...
I have the same problem....

I have a web app (upgraded from a traditional client/server app) with a
dozen or so web forms that will be accessed by about a hundred users
(possibly at one time). The number of transactions may be relatively
extensive (no google, but 1000's of reads and writes to the db per day)

What is the preferred/suggested method for the database connection.

COnnection pooling?
Application_OnStart

Currently, I am opening and closing the connection as needed. It is/can be inefficient at times.

TIA
E
"Ravikanth[MVP]" <dv*********@hotmail.com> wrote in message
news:08****************************@phx.gbl...
Hi

You can open connection in Application_OnStart and can be
shared across all pages.

Ravikanth[MVP]

-----Original Message-----
Lads

Am using ASP.NET, Framework 1.1
Creating a web application to read details from a MYSQL
database.
Am using the dbProvider to create connection to the DB.
I am having a lot of issues with connection pooling etc.
Also of late getting an error, "Could not initiate
communication with the server" which is strange.

How do you suggest I handle connections? At the moment I
create a new connection in each function in the .VB

files
but these connections are been closed and destroyed as I
leave the function.

Is it possible to create a connection once and share it
across all pages/code files?

Thanks
.


Nov 17 '05 #4

P: n/a
As long as the Connection String is identical the Connection can be reused
from the Pool. You don't have to think about Connection Pooling otherwise,
as it is automatic.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

"Eric Fortin" <em******@comcast.net> wrote in message
news:eyPYa.97940$o%2.43781@sccrnsc02...
Thanks, Kevin. A couple questions then (Probably newbie related):

Note: It's an oracle database, so I'm using the OleDb.... with connection
string: Provider=OraOleDB.Oracle..."

Is there anything I have to do that I'm not doing... (I have not specified connection pooling or anything else...)

Right now, when I need to do database stuff, I create a connection, use the connection, close the connection. The oracle db user/password is always the same.

Am I set up right?
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:uJ*************@TK2MSFTNGP12.phx.gbl...
Connection Pooling is built into the .Net Framework. It is best to open

and
close Connections as quickly as possible. Connection Pooling will take

care
of the rest.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

"Eric Fortin" <em******@comcast.net> wrote in message
news:2UOYa.98094$YN5.69586@sccrnsc01...
I have the same problem....

I have a web app (upgraded from a traditional client/server app) with a dozen or so web forms that will be accessed by about a hundred users
(possibly at one time). The number of transactions may be relatively
extensive (no google, but 1000's of reads and writes to the db per day)
What is the preferred/suggested method for the database connection.

COnnection pooling?
Application_OnStart

Currently, I am opening and closing the connection as needed. It
is/can be
inefficient at times.

TIA
E
"Ravikanth[MVP]" <dv*********@hotmail.com> wrote in message
news:08****************************@phx.gbl...
> Hi
>
> You can open connection in Application_OnStart and can be
> shared across all pages.
>
> Ravikanth[MVP]
>
>
> >-----Original Message-----
> >Lads
> >
> >Am using ASP.NET, Framework 1.1
> >Creating a web application to read details from a MYSQL
> >database.
> >Am using the dbProvider to create connection to the DB.
> >I am having a lot of issues with connection pooling etc.
> >Also of late getting an error, "Could not initiate
> >communication with the server" which is strange.
> >
> >How do you suggest I handle connections? At the moment I
> >create a new connection in each function in the .VB
> files
> >but these connections are been closed and destroyed as I
> >leave the function.
> >
> >Is it possible to create a connection once and share it
> >across all pages/code files?
> >
> >Thanks
> >.
> >



Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.