New Connection on nested calls?

  • Thread starter Thread starter Krista Lemieux
  • Start date Start date
K

Krista Lemieux

Hello,

I have a question about the way ADO handles connections
to the database. Let say method foo1() in ObjectA opens a
connection to a database and before closing the
connection it calls a method foo2() in ObjectB which also
opens a connection (to the same database), and before
closing it it calls a method foo3() in ObjectC, etc....
So it's sorta recursive. My question is if it opens
separate connection for each of those objects, thus using
up my resources?

Thank you in advance for your help,

Merci,
Krista Lemieux
 
What is your question exactly?

Opening up more connections, does use up more resources, if that is what you
are asking.
 
Sorry.... Should have mentioned that I read something
about connection pooling by ADO.NET.
So the question is basically does it open up N separate
connections to the same database?

And basically where does connection pooling come in, and
how does it apply to my issue. Does it recognize that
this, whatever I'm doing can be done through the same
connection as other objects are using (Thus not consuming
so many resources)?

Merci,
Krista Lemieux
 
Connection pooling refers to when you open and close connections. Those
connections are drawn from the pool.

But opening up N separate connections, will take N connections from the
pool. The connection pooling does not come into the picture here, other
then those N connections will all be taken from the pool - but are not
pooled in your program once they are open.
 
Hi Marina,

Thank you for clearing that up for me. At first I was a
bit confused about the connection pooling. To me it
seemed to be doing something different (from my
understanding). But after you mentioned that to me, I
looked it up again, and now it makes perfect sense.

Thank you for your help Marina


Merci,
Krista Lemieux
 
Back
Top