Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mySQL server connections - leave one open or use multiple?

Status
Not open for further replies.

tommyboyau

Programmer
Feb 7, 2005
47
0
0
AU
Hi guys,
Just a quick question here. What would be the best way to maintain a connection to a mySqlServer in an application?
Lets say this application has 10 users and would be used for 10 hours a day, retreiving and manipulation data all that time.

If i require a connection on different forms throughout the application what is the best way to do it.
- Maintain the same connection from program start till close
- Establish new connections each time data is required?

Thanks for your help.

Tom
 
Establish new connections each time data is required?
I'd nearly always go with that option...in fact I can't think of many situations where the first option would be more beneficial.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I agree - i think the overheads on your server of having a connection open perminantly would be too high. Especially if it expands to have more people using it.

D

----------------------------------------
There are 2 types of computer, the prototype and the obsolete!!
----------------------------------------
No D, just plank - and its not my fault
 
I would have to agree with ca8msm, and Plank - but there is one situation that it might be beneficial, keep in mind that it is a fix for an "error" and it should be a temporary fix.

I've created an app that at first used option two, but I noticed the app was running really slow. I found this attributed to the fact that it was taking quite some time to establish a connection. I changed the app to use just one connection, and while the original connection took a while - the rest of the app ran just fine.

Very rarely should you run into this, as it is most likely caused by some other error.

In my case I believe it was a DSN resolving issue on the server, and it cleared up when I disable MySQL's DSN resolver. I then switch the app back to option two.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top