Recent

Author Topic: SQLdb or Zeos: Buffered Dataset (cut sometimes connection to server)  (Read 5517 times)

af0815

  • Hero Member
  • *****
  • Posts: 1288
Is it possible to open a query, select the data, transfer it to a buffer, cut the connection, work with the query and data, reconnect and then 'Apply Updates'.

The reson is, the application have to work on some windows tablett pc. Sometimes the WIFI connection is bad and not working. The datastructure is simple and able to be cached. The problem at the apply updates time can be handled by code.

In Delphi 7 times with ADO (so i remember correctly) it was possible if i set the connetion in the query to nil without deactivating. And the connection could be inactive from now. The query was working too. To reconnect, only bind the new reactivated connection back to querry and apply all updates (and handle the problems).

It this possible with Lazarus SQLdb or Zeos ?

Andreas
regards
Andreas

ricardo.consolo

  • New Member
  • *
  • Posts: 17
Re: SQLdb or Zeos: Buffered Dataset (cut sometimes connection to server)
« Reply #1 on: February 16, 2018, 03:05:36 pm »
Hi Andreas.

One way is to rethink your application not to use persistent connections. You can send the inserts and updates via sql sentences that receive its values from your form inside your application. This function can check if the connection is availible, reconnect if the case, and post.

Good luck!

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: SQLdb or Zeos: Buffered Dataset (cut sometimes connection to server)
« Reply #2 on: February 16, 2018, 03:18:55 pm »
I have used now another approach now and store the data always local. One of my problem was to detect a broken connection without rising an exception. And i see, at this time, where the exception is raised, it is to late for me and not recoverable.
So i get all the data local and if i have changes i look with an ping if the server is reachable, build the connection, transfer and close connection. With the SQLdb or Zeos connection it is not possible to detect if the connection is still valid.

*) I found no way to see, if the connection is valid
*) You cannot 'reconnect', you have to close and open the connection. All internal Buffers are reinitialized (you loose the buffers) 

Andreas 

But the Project is running now and i have another more importing things on my radar.
regards
Andreas

mse

  • Sr. Member
  • ****
  • Posts: 286
Re: SQLdb or Zeos: Buffered Dataset (cut sometimes connection to server)
« Reply #3 on: February 16, 2018, 06:26:28 pm »
Is it possible to open a query, select the data, transfer it to a buffer, cut the connection, work with the query and data, reconnect and then 'Apply Updates'.
The MSEgui version of SQLDB supports it, for example with tmsesqlquery.options bdo_offline =  true. It also can write a log file which can be reloaded after application restart in order to write the changes to the database. AFAIK FCL-SQLDB also has such an option now, I did not test it.

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: SQLdb or Zeos: Buffered Dataset (cut sometimes connection to server)
« Reply #4 on: February 17, 2018, 10:17:52 am »
Thx for the information.

MSEgui is no choice for me.

Actually i have a working programm and never change a running system :-) I will store the information for me.

Andreas
regards
Andreas

 

TinyPortal © 2005-2018