Update FWH programs via SQL-database?

Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Update FWH programs via SQL-database?

Post by Marc Vanzegbroeck »

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
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: Update FWH programs via SQL-database?

Post by Marc Venken »

Marc Venken
Using: FWH 20.08 with Harbour
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Update FWH programs via SQL-database?

Post by Giovany Vecchi »

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
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Post by dutch »

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)
Carlos Mora
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Update FWH programs via SQL-database?

Post by Carlos Mora »

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"
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Post by dutch »

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
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Update FWH programs via SQL-database?

Post by Giovany Vecchi »

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

@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
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Post by dutch »

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)
Carlos Mora
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Update FWH programs via SQL-database?

Post by Carlos Mora »

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"
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Update FWH programs via SQL-database?

Post by Giovany Vecchi »

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.
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Update FWH programs via SQL-database?

Post by Marc Vanzegbroeck »

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
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Post by dutch »

Dear Marc,

I use upx to compress the EXE file. It works well for many years.
http://forums.fivetechsupport.com/viewt ... px#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)
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Update FWH programs via SQL-database?

Post by Marc Vanzegbroeck »

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.
http://forums.fivetechsupport.com/viewt ... px#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
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Post by dutch »

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.
http://forums.fivetechsupport.com/viewt ... px#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: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Update FWH programs via SQL-database?

Post by dutch »

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

@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)
Post Reply