-
Oct 1st, 2024, 10:53 PM
#1
Thread Starter
Junior Member
VB6 Exe Inside MySql
I found this article but it doesn't work. It generates the dmp file with 1 kB and downloads the file with 1 KB.
Does anyone have a solution to make the system automatically update (.exe)?
-
Oct 2nd, 2024, 01:49 AM
#2
Re: VB6 Exe Inside MySql
Can you explain what you are trying to do?
An EXE is just a collection of bytes. To dump a collection of bytes in a database table you would use a 'blob'
For using 'blobs' in MySQL: https://www.basedash.com/blog/storin...ge-binary-data
-
Oct 2nd, 2024, 03:54 AM
#3
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
Does anyone have a solution to make the system automatically update (.exe)?
What system? Your application?
I'm not sure how your database figures in this.
This is most often done with a separately-installed installation service or, in very simple cases, using a "bootstrapper" program. The "bootstrapper" is a separate program with the ability to overwrite the existing application (executable) with a new version. What you cannot do is to have a running application update (overwrite) itself.
You'd have to run the application, extract the executable, store it somewhere (hoping that your virus-checker doesn't get upset with it), then launch the "bootstrapper", immediately shut down the main application, allow the "bootstrapper" to overwrite the main application and then restart it (and hope that nothing goes wrong, because then your User has no application at all!).
If anything more than that is required (say, other libraries or controls that might need "Registering" on a Windows box), then you would have to go down the installation service route.
Regards, Phill W.
-
Oct 2nd, 2024, 04:44 AM
#4
Hyperactive Member
Re: VB6 Exe Inside MySql
I think as suggested explain what you are trying to do. Blob is the way to go not varchar
-
Oct 2nd, 2024, 10:14 AM
#5
Re: VB6 Exe Inside MySql
Yep, I'll also vote for a blob field/column. I've stuff all kinds of stuff into blobs in all kinds of databases in the past. As previously stated, everything (including an EXE) on our computers is just bits-and-bytes, and that's precisely what a blob is designed to hold without caring what those bits-bytes represent.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Oct 2nd, 2024, 01:00 PM
#6
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
I have a Visual Basic system.
I need to access the client's machine all the time to make updates.
I discovered that it would be possible to place the executable inside the database, so the client could make the update in a practical way.
The only tutorial I found was this one https://osandamalith.com/2016/06/24/...-inside-mysql/ , but it didn't work.
-
Oct 2nd, 2024, 01:03 PM
#7
Lively Member
Re: VB6 Exe Inside MySql
Originally Posted by Phill.W
What system? Your application?
I'm not sure how your database figures in this.
This is most often done with a separately-installed installation service or, in very simple cases, using a "bootstrapper" program. The "bootstrapper" is a separate program with the ability to overwrite the existing application (executable) with a new version. What you cannot do is to have a running application update (overwrite) itself.
You'd have to run the application, extract the executable, store it somewhere (hoping that your virus-checker doesn't get upset with it), then launch the "bootstrapper", immediately shut down the main application, allow the "bootstrapper" to overwrite the main application and then restart it (and hope that nothing goes wrong, because then your User has no application at all!).
If anything more than that is required (say, other libraries or controls that might need "Registering" on a Windows box), then you would have to go down the installation service route.
Regards, Phill W.
+1
I always create a "release" directory under the root and a launcher exe, it search for the latest exe in /relase (I use just a numerical name) and launch that version (also delete the exes that are not in use if it's a network app). Also have a version that downloads latest version from a url, put it in the release directory, etc. Easy and it works.
-
Oct 2nd, 2024, 02:12 PM
#8
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
I have a Visual Basic system.
I need to access the client's machine all the time to make updates.
I discovered that it would be possible to place the executable inside the database, so the client could make the update in a practical way.
The only tutorial I found was this one https://osandamalith.com/2016/06/24/...-inside-mysql/ , but it didn't work.
This is a very strange requirement.
You absolutely don’t need access to the client’s computer all the time.
And how would storing an update of an application in a database solve this requirement?
Read post #3 by Phill again and study it.
Also you don’t have a Visual Basic System, you have an application developed with Visual Basic
The link you posted is about storing an application in a local mysql database.
A local database will not have an update of your application.
You download an update from a website or other online storage system
-
Oct 2nd, 2024, 08:02 PM
#9
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
Originally Posted by Arnoutdv
This is a very strange requirement.
You absolutely don’t need access to the client’s computer all the time.
And how would storing an update of an application in a database solve this requirement?
Read post #3 by Phill again and study it.
Also you don’t have a Visual Basic System, you have an application developed with Visual Basic
The link you posted is about storing an application in a local mysql database.
A local database will not have an update of your application.
You download an update from a website or other online storage system
I have a system under development. I need to update two clients all the time. I don't have a place on the internet to store the .exe file and do the update.
For this reason, I thought about storing the .exe file inside the Mysql database so that clients can download it.
I already have a module that does the update, first shutting down the main system, downloading it and starting it again. But I don't have anywhere to store these executables.
I had never heard of this "Setup Bootstrap for Visual Basic Setup Toolkit"
-
Oct 2nd, 2024, 08:09 PM
#10
Re: VB6 Exe Inside MySql
Originally Posted by Phill.W
This is most often done with a separately-installed installation service or, in very simple cases, using a "bootstrapper" program. The "bootstrapper" is a separate program with the ability to overwrite the existing application (executable) with a new version. What you cannot do is to have a running application update (overwrite) itself.
You don't need a separate "bootstrapper" like you call it. An app can overwrite itself by shelling a simple Copy command with a 1 second delay so that it has time to terminate.
-
Oct 3rd, 2024, 01:06 AM
#11
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
... I don't have a place on the internet to store the .exe file and do the update ...
... I already have a module that does the update, first shutting down the main system, downloading it and starting it again.
How do you access the Database from your Application? Are they on the same network?
If so, a simple file share would suffice for the "download" source.
Regards, Phill W.
-
Oct 3rd, 2024, 02:26 AM
#12
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
..
I don't have a place on the internet to store the .exe file and do the update.
For this reason, I thought about storing the .exe file inside the Mysql database so that clients can download it.
..
Where is the Mysql database running?
On the machine of the clients or on an external database server?
-
Oct 3rd, 2024, 12:26 PM
#13
Lively Member
Re: VB6 Exe Inside MySql
Originally Posted by VanGoghGaming
You don't need a separate "bootstrapper" like you call it. An app can overwrite itself by shelling a simple Copy command with a 1 second delay so that it has time to terminate.
It depends. For example you can have an app installed in a network environment with the exe stored in a shared resource so may be the exe is opened in 20 stations more so you will not be able to upgrade anything. If you use a launcher you can check which is the latest version available in the shared resource and load it.
-
Oct 3rd, 2024, 12:30 PM
#14
Lively Member
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
I have a system under development. I need to update two clients all the time. I don't have a place on the internet to store the .exe file and do the update.
For this reason, I thought about storing the .exe file inside the Mysql database so that clients can download it.
I already have a module that does the update, first shutting down the main system, downloading it and starting it again. But I don't have anywhere to store these executables.
I had never heard of this "Setup Bootstrap for Visual Basic Setup Toolkit"
I assume that you have two clients in a network and both connected to a SQL Server database so you have a server (or at least one machine sharing resources with the other). Then you have a shared resource (or you're able to have one) and you can "read" the exe from there, no need to involve the database. And you can have only one exe, no matter if you have two clients or hundreds of them so no need to update every station, just one.
You have a module that does the update but if you don't have anywhere to store the executables that module does...nothing? I mean, you can do exactly what you want, but I've never seen an app (comercial or not) use that way to upgrade the main exe, there are better and easier ways to do that.
-
Oct 3rd, 2024, 01:19 PM
#15
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
Hi everyone,
I use VB6 + MySQL.
The database is on a server exclusively for MySQL, and I don't have space to store files. This is the problem.
My clients are far away from me, so I have to access each machine remotely and do the update.
-
Oct 3rd, 2024, 01:25 PM
#16
Re: VB6 Exe Inside MySql
Then set something up. Use github. Use one drive. Use Google Drive. use SOMETHING, anything BUT a database.
-tg
-
Oct 4th, 2024, 01:44 AM
#17
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
The database is on a server exclusively for MySQL, and I don't have space to store files. This is the problem.
If you're that tight on space, your database is going to have problems of its own ... and soon.
Databases love to have space to run around in and they get really upset (i.e. stop working) if they run out of it.
Originally Posted by ricardoweb084
My clients are far away from me, so I have to access each machine remotely and do the update.
You need to discuss this requirement with your clients.
If you need a way to update software on their machines then you need to agree how that should be done.
The client may have all sorts of security requirements that might affect your choice of solution or they might even have a standardised delivery mechanism in place (Service Manager's Configuration Manager product, for example) that you could hook into.
Regards, Phill W.
-
Oct 4th, 2024, 10:38 AM
#18
Lively Member
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
Hi everyone,
I use VB6 + MySQL.
The database is on a server exclusively for MySQL, and I don't have space to store files. This is the problem.
My clients are far away from me, so I have to access each machine remotely and do the update.
If you really don't have space forget your original idea because storing a exe in a DB will need more space than if you store it in a standard way.
So I assume that you have space but you don't have a shared resource to store files and as other suggest this is something that should be discussed with your client because...you're app needs it (or store it in Google Drive or whatever free cloud storage).
But, if you still want to put a gun in your head and continue in that way (store the exe in the DB) you can do it, just use a table with a BLOB type field. This example store the exe in the DB (using DAO, but you can use also ADO), not tested, write on the fly:
Code:
Dim bytdata() As Byte
dim rs as dao.recordset
dim db as dao.database
Set db= OpenDatabase("", True, False, "odbc;DRIVER={your_driver};SERVER=your_server;DATABASE=your_db;UID=username;PWD=password;OPTION=16427;")
Open "myexefile.exe" For Binary As #1
ReDim bytdata(LOF(1))
Get #1, , bytdata
Close #1
Set rs = DB.OpenRecordset("your_table'", dbOpenDynaset, dbSeeChanges)
rs.addnew
rs.Fields("field_for_exe").AppendChunk bytdata
rs.update
rs.close
db.close
to extract the exe (if you want the latest you can change the SQL query to get the newest):
Code:
dim rs as dao.recordset
dim db as dao.database
dim b() as byte
Set DB = OpenDatabase("", True, False, "odbc;DRIVER={your_driver};SERVER=your_server;DATABASE=your_db;UID=username;PWD=password;OPTION=16427;")
Set rs = DB.OpenRecordset("Select field_for_exe From your_table where id = '" & id_of_your_exe & "'", dbOpenSnapshot)
ReDim B(Len(rs("field_for_exe")))
b=rs("field_for_exe")
Open "path_and_exe_name.exe" For Binary As #10
Put #10, , B
Close 10
rs.close
db.close
But take a look to all of our posts: this is not a good idea.
Last edited by zx81sp; Oct 4th, 2024 at 10:41 AM.
-
Oct 4th, 2024, 02:10 PM
#19
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
Originally Posted by zx81sp
If you really don't have space forget your original idea because storing a exe in a DB will need more space than if you store it in a standard way.
So I assume that you have space but you don't have a shared resource to store files and as other suggest this is something that should be discussed with your client because...you're app needs it (or store it in Google Drive or whatever free cloud storage).
But, if you still want to put a gun in your head and continue in that way (store the exe in the DB) you can do it, just use a table with a BLOB type field. This example store the exe in the DB (using DAO, but you can use also ADO), not tested, write on the fly:
Code:
Dim bytdata() As Byte
dim rs as dao.recordset
dim db as dao.database
Set db= OpenDatabase("", True, False, "odbc;DRIVER={your_driver};SERVER=your_server;DATABASE=your_db;UID=username;PWD=password;OPTION=16427;")
Open "myexefile.exe" For Binary As #1
ReDim bytdata(LOF(1))
Get #1, , bytdata
Close #1
Set rs = DB.OpenRecordset("your_table'", dbOpenDynaset, dbSeeChanges)
rs.addnew
rs.Fields("field_for_exe").AppendChunk bytdata
rs.update
rs.close
db.close
to extract the exe (if you want the latest you can change the SQL query to get the newest):
Code:
dim rs as dao.recordset
dim db as dao.database
dim b() as byte
Set DB = OpenDatabase("", True, False, "odbc;DRIVER={your_driver};SERVER=your_server;DATABASE=your_db;UID=username;PWD=password;OPTION=16427;")
Set rs = DB.OpenRecordset("Select field_for_exe From your_table where id = '" & id_of_your_exe & "'", dbOpenSnapshot)
ReDim B(Len(rs("field_for_exe")))
b=rs("field_for_exe")
Open "path_and_exe_name.exe" For Binary As #10
Put #10, , B
Close 10
rs.close
db.close
But take a look to all of our posts: this is not a good idea.
I am not an advanced programmer and I only know how to program in VB6, so I have my limitations when it comes to finding solutions.
Google Drive and other portals when hosting .exe files do not provide a direct download link. I have not found a solution for this in VB6 yet.
I will try to use your code and report back with the results. Thank you.
-
Oct 4th, 2024, 08:18 PM
#20
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
Error (3155 - Failed to insert into linked table '???') is occurring in rs.update
Using Windows 10 - 64 bits
{Mysql ODBC 3.51 Driver}
-
Oct 5th, 2024, 06:03 AM
#21
Lively Member
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
Error (3155 - Failed to insert into linked table '???') is occurring in rs.update
Using Windows 10 - 64 bits
{Mysql ODBC 3.51 Driver}
Linked table? Are you connecting to a real server or you're using any intermediate db/server?
Anyway this code is tested (different version of MySQL ODBC since is the oldest I have installed). First of all create a DB and a table. I've used this in the example:
Code:
CREATE TABLE IF NOT EXISTS `storage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`file` longblob NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
Code to store the exe in the DB:
Code:
Dim bytdata() As Byte
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = OpenDatabase("", True, False, "odbc;DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=test;UID=root;PWD=;OPTION=16427;")
Open "c:\temp\myexe.exe" For Binary As #1
ReDim bytdata(LOF(1) - 1)
Get #1, , bytdata
Close #1
Set rs = db.OpenRecordset("storage", dbOpenDynaset)
rs.addnew
rs.Fields("file").AppendChunk bytdata
rs.Update
rs.Close
db.Close
Code to retrieve the latest exe stored in the db and save it to a file:
Code:
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim b() As Byte
Set db = OpenDatabase("", True, False, "odbc;DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=test;UID=root;PWD=;OPTION=16427;")
Set rs = db.OpenRecordset("Select top 1 file From storage order by id desc", dbOpenSnapshot)
ReDim b(Len(rs("file")))
b = rs("file")
Open "c:\temp\mynewexe.exe" For Binary As #10
Put #10, , b
Close 10
rs.Close
db.Close
Tested under Win10 and MariaDB 10.4, should be 100% compatible with MySQL.
-
Oct 5th, 2024, 10:46 PM
#22
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
Originally Posted by zx81sp
Linked table? Are you connecting to a real server or you're using any intermediate db/server?
Anyway this code is tested (different version of MySQL ODBC since is the oldest I have installed). First of all create a DB and a table. I've used this in the example:
Code:
CREATE TABLE IF NOT EXISTS `storage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`file` longblob NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
Code to store the exe in the DB:
Code:
Dim bytdata() As Byte
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = OpenDatabase("", True, False, "odbc;DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=test;UID=root;PWD=;OPTION=16427;")
Open "c:\temp\myexe.exe" For Binary As #1
ReDim bytdata(LOF(1) - 1)
Get #1, , bytdata
Close #1
Set rs = db.OpenRecordset("storage", dbOpenDynaset)
rs.addnew
rs.Fields("file").AppendChunk bytdata
rs.Update
rs.Close
db.Close
Code to retrieve the latest exe stored in the db and save it to a file:
Code:
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim b() As Byte
Set db = OpenDatabase("", True, False, "odbc;DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=test;UID=root;PWD=;OPTION=16427;")
Set rs = db.OpenRecordset("Select top 1 file From storage order by id desc", dbOpenSnapshot)
ReDim b(Len(rs("file")))
b = rs("file")
Open "c:\temp\mynewexe.exe" For Binary As #10
Put #10, , b
Close 10
rs.Close
db.Close
Tested under Win10 and MariaDB 10.4, should be 100% compatible with MySQL.
In a first test, it worked!!!!!!!
As soon as I adapt the routine, I'll post the result here. But it worked!!!!
-
Oct 8th, 2024, 12:39 PM
#23
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
I will update the system on the clients today. I will comment on the results here soon. But preliminary tests indicate that everything is ok.
-
Oct 9th, 2024, 09:38 PM
#24
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
So far, everything is working. Now I have 5 different machines updating the system through the database. Thank you very much for the code.
But before closing the topic, I will soon restructure my system. I will replace the modules with ActiveX.dll, aiming to optimize it.
And then I want to test uploading these DLLs to the database as well. I will comment here soon.
-
Oct 10th, 2024, 01:39 AM
#25
Re: VB6 Exe Inside MySql
Originally Posted by ricardoweb084
I will replace the modules with ActiveX.dll, aiming to optimize it.
And then I want to test uploading these DLLs to the database as well. I will comment here soon.
Unless you're using a Manifest, your Dlls will require registering on each machine, and that will require elevated access on the machine, which your application should not have.
Simply copying ActiveX Dlls will [most likely] not be sufficient.
(You might get away with it if you enforce Binary Compatibility on your DLL projects and never change the Dlls interfaces, but that's unlikely, in the long term.)
Regards, Phill W.
-
Oct 10th, 2024, 02:59 AM
#26
Re: VB6 Exe Inside MySql
You can use ActiveX DLLs without registration and without manifests just fine. Also with Binary Compatibility they can be updated just by Copy/Pasting them on the target machine (you can add new methods to them but not change existing ones unless you also update the main EXE to take them into account).
-
Oct 13th, 2024, 02:49 AM
#27
Thread Starter
Junior Member
Re: VB6 Exe Inside MySql
I haven't tested it yet, but I could leave a .bat file on the client's machine and register the dlls there.
I'm not familiar with this Binary Compatibility, I'll need to study it.
-
Oct 15th, 2024, 07:47 AM
#28
Re: VB6 Exe Inside MySql
Check in my signature block ... there should be a link to a posting about binary compatibility - Set your VB6 ActiveX Compatibility.
-tg
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|