Subject | Re: [firebird-support] Which way of connection is prefered? |
---|---|
Author | Helen Borrie |
Post date | 2008-01-10T03:12:08Z |
At 01:07 PM 10/01/2008, you wrote:
-- If the user's task is just to read a set, do something with it (print a report, update something, delete something) and then to go away for a few hours, then the sensible thing would be for the application to clean up and disconnect as soon as the task is done. That way, server resources are made available to other users. This is a fairly unusual scenario for interactive client/server applications, yet a very common one for programs that perform scheduled operations, like collecting data from instruments or doing data replication.
-- If the user has many tasks to do, or many repetitions of the same task, and needs constant access to the database, then his/her "session" with the database needs to be continuous. You would quickly become an assassin's target if you put users to the inconvenience of having to log on each time they want to perform any task. Each session would involve many tasks, typically the day's workload for the user. Each task would run in its own transaction. If the user is doing other things as well, the connection can lie idle for periods, ready for the next database task s/he wants to do. This is perfectly correct and fine, as long as the application has been written to manage transactions properly.
The "preferred way" is the way that best suits the requirements. Applications can be written to time out and log off automatically if the site has users who carelessly leave a connected application unattended for long periods. Doing this might be especially useful if the server has limited resources, high peak loads and a lot of careless users...
./heLen
>Hello,The question does not make any sense. When a client application connects to a database, it does so for a reason, which is to do one or more tasks involving data in the DB. You will use one way or another way (which might be in combination) to cater for the task and user requirements.
> One is beginning a connection when application starts, and closing it
>when application ends.
> Another one is beginning a connection just when one query starts, and
>closing it after the query ends.
> As I know, on db like oracle or pgsql, long connection (the first way)
>is better. But on db like mssql or mysql, short connection (the second
>way) is better.
> Which is better on FireBird?
-- If the user's task is just to read a set, do something with it (print a report, update something, delete something) and then to go away for a few hours, then the sensible thing would be for the application to clean up and disconnect as soon as the task is done. That way, server resources are made available to other users. This is a fairly unusual scenario for interactive client/server applications, yet a very common one for programs that perform scheduled operations, like collecting data from instruments or doing data replication.
-- If the user has many tasks to do, or many repetitions of the same task, and needs constant access to the database, then his/her "session" with the database needs to be continuous. You would quickly become an assassin's target if you put users to the inconvenience of having to log on each time they want to perform any task. Each session would involve many tasks, typically the day's workload for the user. Each task would run in its own transaction. If the user is doing other things as well, the connection can lie idle for periods, ready for the next database task s/he wants to do. This is perfectly correct and fine, as long as the application has been written to manage transactions properly.
The "preferred way" is the way that best suits the requirements. Applications can be written to time out and log off automatically if the site has users who carelessly leave a connected application unattended for long periods. Doing this might be especially useful if the server has limited resources, high peak loads and a lot of careless users...
./heLen