Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » How to manage the access to a Db on an unstable connection
How to manage the access to a Db on an unstable connection [message #50398] Tue, 16 October 2018 11:51 Go to previous message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi there,
I have developed an application used in the shop floor of a manufacturing company. Some clients collect production data and save them on a PostGresql DB. Initially, clients were wired to the LAN and there were no performance issues. The connection to the DB is managed in GUI_APP_MAIN: the connection is established and then I use the global SqlSession variable SQL throughout the whole application. Recently, some clients were added and connected through a wireless connection, as it was difficult to have cables running all over the shop floor. The wireless connection is unstable by definition, so it happens frequently that the connection is lost. Basically, there are two scenarios, when the connection is lost:

1. The user is just on a "view" status (a SqlTable filled with data) without issuing any sql statement.
2. The user is performing an action that requires an insert/update/select statement to be issued.

In the first scenario, if the client can restore the connection in a reasonable time, the user does not notice anything; otherwise everything on the SqlTable disappears: the user can cleanly exit the application and after restarting it usually everything works.

In the second scenario the application seems "freezed" (it is waiting for the DB server to respond, so it "hangs"). Sometime the "freeze" lasts only few seconds so the user just waits. In other cases the "freeze" lasts for more time (either because the connection with the db is completely lost, or because it takes sometime to the client to get back online), so the user kill the application.

For the above reasons, I have to rethink the way my application connects to the database, but I am a bit confused because is the first time I am in such a situation.

Basically I think the flow should be as follows:
-the application starts and connect to the db;
-after the initial select statements (to fill in all the necessary data) the application disconnects from the db;
-any time an operation that requires a db connection is performed (e.g. adding new data, when the SqlTable runs the Query() method, etc.) the application connects and - after the operation is performed - it disconnects;
-during each connection, an appropriate timeout is set and if the connection is failed the user is informed (so the user does not thing that he has to kill the application);
-if possible, the global SQL variable is used in the connection/disconnection actions.

So that is my idea, but I would be really happy if anyone want to share is ideas and experiences in developing a DB application in an environment where the connection is unstable.

Regards,
gio

 
Read Message
Read Message
Read Message
Previous Topic: [SOLVED] How to use aliases with SqlExp?
Next Topic: SQL statements timeout in Linux (bug?)
Goto Forum:
  


Current Time: Fri Mar 29 13:27:23 CET 2024

Total time taken to generate the page: 0.01821 seconds