The general rule of thumb is that connection creation/destruction is the most costly part
of approach #2. However, it is unlikely that each connection needs a dedicated
connection, and therefore memory resources on the server for the entirity of the client's
if your clients are firing off many queries back-to-back, buy a lot of memory for your
server, and go w/ your option #1.
if it's a typical app, where the user queries data, looks through it for a bit, then
queries more, yadda, yadda, yadda, then what you're probably going to want to do is #2.
Without a central 'app server' as such, you can't really take advantage of connection
pooling. The closest you can do is write into your app that if the connection is idle for
x amount of time, then it closes the connection, and reestablishes it upon next data
Hope this helps...
> -----Original Message-----
> From: Director General: NEFACOMP [mailto:dg@stripped]
> Sent: Thursday, September 25, 2003 11:57 AM
> To: myodbc@stripped; mysql@stripped
> Subject: Ideas on creating connections
> Hi groups,
> I need some experienced users to guide me on this issue.
> I am developping an Application that will be accessing a
> MySQL database through MyODBC.
> The application is developped using Visual Basic.
> Since my application will be used simultaneously by more than
> 200 users, I want to know the implication of using one of the
> following methods for connecting to the server:
> 1. At logon, I create a connection to the server and maintain
> it throught the application life. By the application life I
> mean that the connection stays open as long as the
> application is loaded in the memory. So, for a user who is
> online for 3 hours, the connection is on for those three
> hours, even if the user goes out for a coffee.
> 2. I create a connection only when a query is about to be
> sent to the server. That means, I create a connection when I
> want to create an ADO recordset and run a query against the
> server. After running my query, I distroy the connection.
> Currently I am using the first option since I don't exactly
> what it is required (time and resources) to make a connection
> to the server. Will you please tell me how fast is to connect
> to the server. If you advise me that this method is the best,
> I will add functions to reconnect a dead connection.
> Any ideas and advices are highly welcomed
> NZEYIMANA Emery Fabrice
> NEFA Computing Services, Inc.
> P.O. Box 5078 Kigali
> Office Phone: +250-51 11 06
> Office Fax: +250-50 15 19
> Mobile: +250-08517768
> Email: dg@stripped