Topic: Network store database

Is there a way to use the Google Drive to store the database there and work it from there instead a local network ?
Or is there a way to work with the database from distance. Please keep in mind that I do not know MySQL.
An example were nice
and yes in a few days I will update my MVDB to the new version. I've still got the 4.02

Re: Network store database

v_pozidis,
I've not used Google Drive, but if Google Drive assigns a drive letter on your computer you should be able to use it. MVD needs to get to your data via a drive and path for SQLite db. I personally have used Microsoft's OneDrive and it works fine to store your database. It's the same concept as Google Drive. OneDrive assigns a drive letter and you can define folders as if it were on your computer. You can see the drive and its folders through Windows Explorer.

Re: Network store database

Can you please give an example ?

Re: Network store database

v_pozidis,
The first thing you need to do is obtain OneDrive from Microsoft. If you have Windows 10, you should already have OneDrive. If you don't see it on the left side of Windows Explorer, then you may need to sign-in or sign-up for it. Here is a link to do that:
https://www.microsoft.com/en-us/microso … ud-storage


If you do not have Windows 10 then here is the download link to get OneDrive. There is a free version if you use less than 5g of storage:
https://www.microsoft.com/en-us/microso … e/download


Once you have OneDrive your Windows Explorer should have a folder to get to OneDrive. I have it setup to sign-in automatically when Windows starts up. You can create folders on OneDrive just like you do on your computer. You can then copy your database to a folder on OneDrive. Then you indicate the location of your database in MVD Options. See attached screen image to see how you point to your database on OneDrive. Keep in mind that if you have multiple projects including your development project, you need to update the Options/Database Location settings in each project that uses the database. Also, if you have multiple users accessing it at the same time, you should have controls in place so that only one user is accessing a record at a time and lock other users when a record is in use.

Post's attachments

Attachment icon MVD Options Settings DB Loc.PNG 23.38 kb, 80 downloads since 2020-04-21 

Re: Network store database

Thank you it works .  But more than two person can not work at the same time? Or did I not understood correct?

Re: Network store database

Yes they can, but you need to be careful that they are not accessing and updating the same record at the same time. It could cause issues. It could potentially lock your database or at minimum you might not have the most updated info in it. There are ways through script to control the access to tables and records. Dimitry was kind enough to share an example in this forum. In addition to what he put together, you should probably also use the new login / roles feature of MVD to make it more robust and be able to see who is logged on and has various tables/records locked.


Here is the link to Dimitry's example:
http://myvisualdatabase.com/forum/viewt … 405#p21405

Re: Network store database

v_pozidis,
I went ahead and modified Dimitry's multiuser with locks project to include the new login and user roles feature of MVD (Requires version 6). See attached. You can test it on the same computer. You do not need to place it on OneDrive to test. Run the project and login as Admin (password is "admin"). Move the startup form to the left side of your screen. Then click on the ADMIN button. This form shows who is logged on and the record locks. The only thing that is displayed at this point is your login in the top tablegrid.

Now run the project again in parallel. Login as User1 (password is "user"). Move the startup form next to the Admin form. You will notice that User1 shows up in the Admin form top tablegrid.

Now run the project  a third time. This time login as User2 (password is "user"). Move the startup form next to User1 form. You will see User2 is logged in on the Admin form.

Double click on John Smith on User1's form. You will see that John Smith on User2's tablegrid turns red meaning that it is locked to other users. The Admin form will show the locked record in the bottom tablegrid. Double click on John Smith in the tablegrid of User2 (in red). An error message is displayed indicating that the record is locked and to try later.  All tablegrids update automatically as people lock and unlock records. You will need to place these lock mechanisms for all your tables in your project where multiple users will be updating.


You will notice that there is a CLEAR LOGIN button and DELETE LOCK button in the Admin form. You typically would never click these. However, if an end user's computer crashes, it may leave the login info and locked record info open in the database. This would be the way to clear them out for that particular user.


Hopefully you will be able to apply these controls in your project especially if you are storing the database on OneDrive.

Post's attachments

Attachment icon Multiuser Login and Rec Locks.zip 346.5 kb, 315 downloads since 2020-04-22 

Re: Network store database

Hi ehwagner,


I can't get your example to compile.  It can't find the reference to User.Username at line 9.

I tried altering it to _user.username but it didn't like that either.

Is the User.username referring to the login form or to the _user.username table?

On a clear disk you can seek forever

Re: Network store database

Change

User.Username

to

Application.User.Username
Dmitry.

10 (edited by CDB 2020-04-22 23:09:10)

Re: Network store database

Thank you Dmitry.


I've attached the modified script file for others.

Obviously it will either need to be renamed as 'script.pas' or a 'uses' clause will need to be added to the main script file of the project.


Amended file name to take into account ehwagner's comments below.

Post's attachments

Attachment icon MVD_6_3_and_above_multiuser_lock.pas 5.4 kb, 266 downloads since 2020-04-23 

On a clear disk you can seek forever

Re: Network store database

CDB,
Just letting you know that I am currently running version 6.2 and "Application.User.Username" is not recognized so it must have been introduced either in 6.3 or 6.4. Anybody who is on 6.2 or below must use "User.Username".

12

Re: Network store database

ehwagner wrote:

CDB,
it must have been introduced either in 6.3 or 6.4. Anybody who is on 6.2 or below must use "User.Username".

I'm using 6.3.

On a clear disk you can seek forever

Re: Network store database

CDB,
Thanks for updating the script for 6.3 and 6.4 users.

Re: Network store database

HELLO CDB

15

Re: Network store database

haruna wrote:

HELLO CDB

I'm still around.

On a clear disk you can seek forever

Re: Network store database

Guys, all this will not work with OneDrive, since synchronization with the cloud is at the file level, not the record. Database editing is editing a local copy. Therefore, if two users simultaneously edit the base, then the result of editing one will overwrite the result of the other. Don't reinvent the wheel, use MySQL server.

Визуальное программирование: блог и библиотека.

Re: Network store database

you must have a server or a nas

Domebil