PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → HRestoreBackup
HRestoreBackup
Débuté par Rik, 07 oct. 2017 20:09 - 7 réponses
Posté le 07 octobre 2017 - 20:09
Hello All,

At this moment I am busy developing an automated backup program for my customers.
Till now only the creation of the full backup is accomplished, restoring is still failing. For testing purposes I use the simplified code below:
MyConnection is Connection HCloseConnection(MyConnection) HRestoreBackup(MyConnection,DataPath) But if I try to restore, I get the following error (DESKTOP = my own machine):
Error returned by < Server:4900> server: You cannot restore the < Database> database because the < MyConnection> connection opened from the < DESKTOP> computer for the < admin> user uses this database. It looks like a pretty straightforward issue, as I still have some sort of connection open to the database. But this is certainly not the case, as my code suggests above.
I tried multiple things with disconnecting the connections with HFSQL Control Center, although this had no effect whatsover.

I already looked at the "WD Duplication" example which didnt even require a disconnect.
Any tips or solutions will be appreciated!

Regards,
Rik
Posté le 08 octobre 2017 - 14:15
Hi

Make sure the HFCC program is closed and try again
Posté le 08 octobre 2017 - 16:35
Hello Walter,

Thank you for your fast response.
That was my first test case, but didnt help either.

Regards,
Rik
Posté le 08 octobre 2017 - 23:06
Hi Rik,

it looks like a case of multiple connections inside your application.
You have to understand that:
- each independent HF context creates a duplicate of the connection used at the time of it's creation
- each window CAN use an independent HF context (it's an option)
- each thread uses and independent HF context

and I may be forgetting things...

So, one thing you could do is try to open your restore window with eh USE instruction (that should close everything else), then from there, when the restore is finished, you can do a USE of your main window.

Best regards
Posté le 09 octobre 2017 - 10:44
Hello Fabrice,

Thank you for you response.
The USE instruction is not doing the trick.

With this new insight I can probably try and search for which element is giving these hiccup.
For now even commenting out the HOpenConnection(Thus not connecting at all) is not doing the trick, so the problem is probably somewhere deeper.
Thanks you very much, I will keep you guys updated.

Regards,
Rik
Posté le 09 octobre 2017 - 19:54
Hi again

there is also the possibility of a connection defined in the analysis. If there is one, remove it.

Best regards
Posté le 10 octobre 2017 - 15:34
Hi Fabrice,

There is no connection defined in the project analysis.

Regards,
Rik
Posté le 11 octobre 2017 - 16:23
try

HRestoreBackup(MyBackupConnection,DataPath)


regards