Update FWH programs via SQL-database?

Update FWH programs via SQL-database?

Postby Marc Vanzegbroeck » Wed Aug 15, 2018 8:39 am

Hello,

I have SQL-programmas installed on servers or NAS.
The exe-files are installed on a shared directory on de server. So each time I do an update, all users have the new version.

The only problem is when someone use the database remotly, I have to installed the programm to that PC localy.
The programm is installed on that PC, and via the correct IP-adres and PORT-forwarding, it connect to the database.

I can olso use a VPN-connection, but only to use that, I don't want to do this.

Now I had an idea to read the exe-file in a blob-field of a table in the database, and when the user is connected, the program check's if this is a new version, and write it to the PC.
I only hve to install it one time on the pc, then the updates are automaticly.
Is this a goed idea? Does anyone allready try this?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Update FWH programs via SQL-database?

Postby Marc Venken » Wed Aug 15, 2018 12:15 pm

Interesting approuch...

This link seems to save exe to blob.

https://osandamalith.com/2016/06/24/sto ... ide-mysql/

viewtopic.php?f=6&t=30337&hilit=blob+data

viewtopic.php?f=3&t=30715&hilit=blob+data

Maybe it is a help.

Groetjes,
Marc
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Update FWH programs via SQL-database?

Postby Giovany Vecchi » Thu Aug 16, 2018 3:46 am

Since 2012 I work this way.
My programs connect to my server database and check for new versions. If it does, the program downloads the package from a BLOB / BINARY field '
I use the ADS for this.
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Update FWH programs via SQL-database?

Postby dutch » Fri Aug 17, 2018 11:24 am

Dear Giovany,

Giovany Vecchi wrote:Since 2012 I work this way.
My programs connect to my server database and check for new versions. If it does, the program downloads the package from a BLOB / BINARY field '
I use the ADS for this.

How can you download the program? Because you will know the new version, when you run the program. How do you download to override the opening program?

Thanks for any idea.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Postby Carlos Mora » Mon Aug 20, 2018 10:12 am

Hi Dutch,

Let's start with your outdated exe, and let's call it Current.Exe. At start, via ftp/sql or whatever you want to use, find a new version and download that file as NewVersion.exe. At this point we need to call a third program, Updater.exe that will do:
- First, check that NewVersion.exe Exists. If posible, do a checksum validation if possible.
- Rename Current.exe to something else like OldExe+CurDate()
- Rename NewVersion.exe to Current.exe
- Launch Current.exe and finish

You should add extra steps to revert the situation in case sth fails.
KR,
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Update FWH programs via SQL-database?

Postby dutch » Mon Aug 20, 2018 11:33 am

Dear Carlos,

It means, we must have 2 exe files (1 program/ 1 check update) to check new version.

Thanks so much,
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Postby Giovany Vecchi » Mon Aug 20, 2018 2:15 pm

It uses the same executable, downloads a zip file, unzipped into a folder and the program itself creates a .BAT file, and closes the program after it executes the .BAT file.

.BAT
Code: Select all  Expand view

@ECHO OFF
cls
ECHO AGUARDE A ATUALIZAÇÃO DO PROGRAMA
:APAGA
CHOICE /T 1 /C y /CS /D y
ATTRIB -R -S -H CARTORIO.EXE
DEL CARTORIO.EXE
IF EXIST CARTORIO.EXE GOTO APAGA
COPY C:\SISTEMAS\PROTWIN\TEMP\UPDATE\CARTORIO.EXE
ECHO ARQUIVO DE ATUALIZACAO PROCESSADO
 
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Update FWH programs via SQL-database?

Postby dutch » Tue Aug 21, 2018 3:09 am

Dear Giovany,

Thank you, I got it.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Postby Carlos Mora » Tue Aug 21, 2018 6:25 am

Hi Giovany,

I don't delete the former exe because sth can fail and i don't want to leave the user without the app. And renaming is allowed in case the exe is being executed, but deleting is not always an option.

If possible, add some kind of binary validation to the download, like checking the md5 on the new file. Security is never enough!

KR
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Update FWH programs via SQL-database?

Postby Giovany Vecchi » Wed Aug 22, 2018 1:48 am

The running program will check the downloaded files first. After unpacking, the package in addition to the main executable can contain sql script, another executable to run before the upgrade, or perform processes for database actuation when finalizing the program in exclusive mode. All this is you who have to plan to avoid problems.
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Update FWH programs via SQL-database?

Postby Marc Vanzegbroeck » Wed Aug 22, 2018 8:08 am

Hi,

I also check for the new version in the exe-file.
Than save it with an temporary name to the PC.
Than create a bat-file that delete de original file, rename the new file and call the program again.
The bat-file is called when exiting the exe-file.
Until now I download the file from a website.
Now I wanted to save in in the SQL-database.
The only problem is that the exe-file is to large (8Mb) to save in the blob-file. Do I do some settings in the server?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Update FWH programs via SQL-database?

Postby dutch » Wed Aug 22, 2018 8:59 am

Dear Marc,

I use upx to compress the EXE file. It works well for many years.
viewtopic.php?f=3&t=35841&hilit=upx#p213562

Marc Vanzegbroeck wrote:Hi,

I also check for the new version in the exe-file.
Than save it with an temporary name to the PC.
Than create a bat-file that delete de original file, rename the new file and call the program again.
The bat-file is called when exiting the exe-file.
Until now I download the file from a website.
Now I wanted to save in in the SQL-database.
The only problem is that the exe-file is to large (8Mb) to save in the blob-file. Do I do some settings in the server?
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Postby Marc Vanzegbroeck » Wed Aug 22, 2018 9:03 am

Dutch,

I'm also using upx to compress the exe-files, but than I'm also getting the message that the file is too big.


dutch wrote:Dear Marc,

I use upx to compress the EXE file. It works well for many years.
viewtopic.php?f=3&t=35841&hilit=upx#p213562

Marc Vanzegbroeck wrote:Hi,

I also check for the new version in the exe-file.
Than save it with an temporary name to the PC.
Than create a bat-file that delete de original file, rename the new file and call the program again.
The bat-file is called when exiting the exe-file.
Until now I download the file from a website.
Now I wanted to save in in the SQL-database.
The only problem is that the exe-file is to large (8Mb) to save in the blob-file. Do I do some settings in the server?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Update FWH programs via SQL-database?

Postby dutch » Wed Aug 22, 2018 11:08 am

Marc,

Can you try Mediumblob columns instead of Blob?
Marc Vanzegbroeck wrote:Dutch,

I'm also using upx to compress the exe-files, but than I'm also getting the message that the file is too big.


dutch wrote:Dear Marc,

I use upx to compress the EXE file. It works well for many years.
viewtopic.php?f=3&t=35841&hilit=upx#p213562

Marc Vanzegbroeck wrote:Hi,

I also check for the new version in the exe-file.
Than save it with an temporary name to the PC.
Than create a bat-file that delete de original file, rename the new file and call the program again.
The bat-file is called when exiting the exe-file.
Until now I download the file from a website.
Now I wanted to save in in the SQL-database.
The only problem is that the exe-file is to large (8Mb) to save in the blob-file. Do I do some settings in the server?
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Postby dutch » Thu Jan 24, 2019 12:00 pm

Hi Giovany,

How do you call BATCH file from the main program and keep it still run after the main program end?

I try ShellExecute() but it doesn't run.

Giovany Vecchi wrote:It uses the same executable, downloads a zip file, unzipped into a folder and the program itself creates a .BAT file, and closes the program after it executes the .BAT file.

.BAT
Code: Select all  Expand view

@ECHO OFF
cls
ECHO AGUARDE A ATUALIZAÇÃO DO PROGRAMA
:APAGA
CHOICE /T 1 /C y /CS /D y
ATTRIB -R -S -H CARTORIO.EXE
DEL CARTORIO.EXE
IF EXIST CARTORIO.EXE GOTO APAGA
COPY C:\SISTEMAS\PROTWIN\TEMP\UPDATE\CARTORIO.EXE
ECHO ARQUIVO DE ATUALIZACAO PROCESSADO
 
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests