Monday, March 19, 2012

Database server connection

I am trying to using sqlserver as back-end for an application(web) running
on the window 2X, one thing I am not sure is that once I establish the
connection between database server and application, should I keep this
connection open while application is running, or only open it when
there is a requet to qury records from database?

Thanks for your help."Leon" <penghao98@.hotmail.com> wrote in message
news:89a0a7de.0409221926.6c394129@.posting.google.c om...
>I am trying to using sqlserver as back-end for an application(web) running
> on the window 2X, one thing I am not sure is that once I establish the
> connection between database server and application, should I keep this
> connection open while application is running, or only open it when
> there is a requet to qury records from database?
> Thanks for your help.

I believe the usual approach is to leave the connection open, to avoid the
overhead associated with opening and closing the connection again and again.
This is one reason for using connection pooling, for example.

You might want to post in a forum for your client library (eg ADO, JDBC) or
development environment (eg ASP, PHP) to see if there are any specific
considerations for your application.

Simon|||penghao98@.hotmail.com (Leon) wrote in message news:<89a0a7de.0409221926.6c394129@.posting.google.com>...
> I am trying to using sqlserver as back-end for an application(web) running
> on the window 2X, one thing I am not sure is that once I establish the
> connection between database server and application, should I keep this
> connection open while application is running, or only open it when
> there is a requet to qury records from database?
> Thanks for your help.

Hi,
This is question basically regarding connection pooling.
Which technology you are using for database acess? like ADO,JDO, JDBc
etc..?
In all these you can create a pool of connections and maintain it. So
the best thing which I feel is ,during boot up of your application
create a pool of connections, store it and use the connection when
needed.
This is purely dependent on your application also.

Some technologies like ADO and JDBC now support disconnected rowsets
also like CachedRowset in Java where internally it will(means
driver/proider) handle reconnecting to the server when a request
comes.

But from performance point of view, better to create connections
during start up.

How many connections? etc depending on the usage of your application
Regards
Zunil
Cordys

No comments:

Post a Comment