![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Wed, Dec 23 2020 11:57 PM | Permanent Link |
bpolky | I am new to using client server databases and I am unsure about opening and closing sessions.
The customer is not a large organization and there are less than twenty users in total. There are multiple applications, some which the users have open almost all the time, and some that are opened only when needed. Some applications are specifically for manipulating the data, others access the data only intermittently. Is it best to open a session when the application opens, and then close it when the application closes, or should I open a session when the application needs to access the data, and close the session when the data access is completed? Should I be doing this differently if the application accesses the data in almost every function, compared to an application that access the data only intermittently? |
Thu, Dec 24 2020 12:25 PM | Permanent Link |
Raul ![]() | On 12/23/2020 11:57 PM, bpolky wrote:
> Is it best to open a session when the application opens, and then close it when the application closes, or should I open a session when the application needs to access the data, and close the session when the data access is completed? There are no absolute rules here but some notes below. First of all make sure you follow these guidelines if you are dealing with threading at all : https://www.elevatesoft.com/manual?action=viewtopic&id=edb2&product=rsdelphiwin32&version=10.4&topic=Multi_Threaded_Applications Otherwise IMHO it depends on few factors including your app design and whether you use databound UI controls and such. For example do you use default session for main UI thread or do you create your own ? Do you use transactions ? Are different app sections related at all or are they all relatively independent - in terms of data access and need to track changes across. Finally remote sessions can have hiccups - things like brief network outage or somebody putting computer to sleep etc - so you still need to deal with making sure connection is actually still alive and re-connecting. I have used one session for main UI thread and for forms with databound controls. This session is opened by first form using data and forms can just call global class to manage this (open/re-open) and you can also deal with various sessions events from single point. If code just needs to process something then creating a separate session at that time might be easier since you can handle everything in single block of code - for example errors when connecting session - and then close the session when done. Raul |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |