A
Author
a .net 1.1 app has a class whose constructor opens a db connection to
sql svr two thousand. this class has more than a dozen of methods.
most of them don't do db stuff.
I am wondering if this design is going to be a problem, bcoz each time
this class is instantiated, a db conn is open. The worst thing is that
I haven't seen anywhere in the code the db conn is closed.
I write about this bcoz I see that this app leaves more than one
hundred open connections in the db, and the app complains that the
conn pool is full.
I think first of all, each connection needs to be closed. secondly,
I don't think it is a good idea to open a db conn in the constructor
of a class, unless each and every method of the class needs to visit
the db. I would like to hear you OO gurus' opinion. thank you.
-- typed up from my cell phone.
sql svr two thousand. this class has more than a dozen of methods.
most of them don't do db stuff.
I am wondering if this design is going to be a problem, bcoz each time
this class is instantiated, a db conn is open. The worst thing is that
I haven't seen anywhere in the code the db conn is closed.
I write about this bcoz I see that this app leaves more than one
hundred open connections in the db, and the app complains that the
conn pool is full.
I think first of all, each connection needs to be closed. secondly,
I don't think it is a good idea to open a db conn in the constructor
of a class, unless each and every method of the class needs to visit
the db. I would like to hear you OO gurus' opinion. thank you.
-- typed up from my cell phone.