TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Administrator
Tech Writer
2.2k
1.5m
Correct pattern to use connections
Mar 24 2003 10:41 AM
Hi Im trying to figure out what's the best way to connect and disconnect from my database. Im building a web based application. What i'm doing right now is providing a connection in the constructor for every class that will need one. I store the connection in a variable and then use it in whatever methods need the connection. Since I need to specifically close the connection, I do so in the destructor. I figured if I do this, then the db connection closing can be done in the background whenever the object is garbageCollected and save myself a bunch of open-closes, plus I dont have to worry about every method having to open or receive its own connection and then closing it. Is there something flawed in my thoughts? any Ideas? Best Regards JR
Reply
Answers (
2
)
Column description in database
Unusual DataRow error