Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can you use onedrive for DBF for networking access? 1

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
578
0
16
PH
Hi everyone.. i have created an appplication in VFP, my question is, can i use Onedrive for online/local access of the DBF's? thanks...
 
Ok mm0000 Thanks for your guidance....I'll try to study it well ....
 
I would suggest that is a good way to almost guarantee the dbf gets corrupted.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I know it's not exactly the same, but someone asked the same question of MS about putting an Access database on OneDrive


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
OneDrive is essentially a hosting and synchronization service for files and documents, such as Word documents and Excel workbooks. It is not designed for shared multi-user access of database files. It's possible that you could open and view a DBF stored on OneDrive, but you would almost certainly not be able to update it.

Mandy, why exactly are you interested in using OneDrive? If you want somewhere to store copies of your DBFs so that users can download them and use them locally, that might be worth exploring. But if you want to use it to permanently host live DBFs for use within your application, there are better ways of doing that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I have checked that what I have said works. I just appended 10000 records to a dbf on Onedrive and VFP did so with out any problems. Would I recommend it for a stable solution for an application? No. The OP asked whether she could use Onedrive for accessing DBF's - Yes you can.

 
Just 'cos you CAN do something doesn't mean you SHOULD.

Using OneDrive in this way will lead to corruption, in a multifile, multi-user environment.
A single file is not a realistic test, just think about an update to a series of tables with
multiple indexes and our beloved memo files...

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi Mike, i just want the dbf be updated anywhere, unlike local access its limited to computer connected via LAN... thats why i thought it would be great to use OneDrive.... but thanks everyone for enlightening me.... with the code below, is it ready for local and multi user access?

PROCEDURE Load()

SET PATH TO c:
SET TALK OFF
SET BELL OFF
SET CENTURY ON
SET CONFIRM OFF
SET SAFETY OFF
SET ECHO OFF
SET ESCAPE OFF
SET AUTOSAVE ON

SELECT 0
USE transaction shared ALIAS trans
INDEX on idnum TO tidnumx
SET ORDER TO tidnumx

SELECT 0
USE smsrec shared ALIAS rek
INDEX on idnum TO rekndx

SELECT 0
USE sms shared ALIAS tsulat
INDEX on idnum TO idnumx
SET ORDER TO idnumx

SET relation TO idnum INTO trans

endproc
 
Mandy, your code is fine for multi-user access - but only as far as it goes. You will need to consider what to do if more than one user tries to update the same data at the same time - or how to prevent that happening. That's quite a large topic, and not easy to summarise in a forum post.

I suggest you start with the Help topic, "Programming for Shared Access". Then move on to some of the more specific topics to which it refers.

One issue with the code you posted: you do NOT need to execute INDEX ON every time you open a table. You only need to create your indexes when you create the tables. After that, they will automatically be kept up to date. Then, all you need to do to establish an index order is to issue SET ORDER. If you follow this advice you will find that your application runs much faster, especially if the tables are large.

(This is probably the commonest mistake we see in the form. In fact, I feel sure I've mentioned it to you in the past.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The way One Drive works you don't just have one online table as in a hosted database.
Every user gets a copy of the DBF to his local drive. Every change to that DBF works, but eventually leads to syncing that file with OneDrive.

In the end you have the same problem as with PACK, everytime you only just add a record or update one, OneDrive uploads the whole file online.

Just assume a simple starting situation and what happens. Two users have a DBF from the online OneDrive in version X with 100 records. Now user1 adds 1 record to his DBF and ONeDrive uploads that. This causes the other users PC to sync the new DBF version with 101 records, but when he already also added one record in his outdated 100 record version, either his record will be overwritten when his DBF file is overwritten from OneDrive or his DBF with his 101st record is uploaded to OneDrive. In any case, only one record of both remains. And that's still a good case, in the worst case such conflicts lead to file corruptions.

To summarize, OneDrive (and other cloud drive solutions) are syncing files on the basis of whole files, not single records within them, that's not what works well.

Mike told you there are better solutions to have DBFs in the internet, one is establishing a larger LAN, a WAN. There's hardware specific to that, ie routers with WAN feature, there are software solutions. I never set up a WAN, but you find threads about this solution.

Data in the internet is better put into a database server like MySQL, which would eed a rewrite database and all data access. It's something you should consider before even starting to program, because you're now either stuck with the DBFs and ways to host them or you have to reimplement a portion of your code.

Just to give a hint: A MySQL, MariaDB, PostGreSQL, MSSQL or even Access Daatbase in the internet has one big advantage: Also a website and also other clients than your application can connect to such databases easier than to DBFs.

Chriss
 
Hi Mike, can you give me an example for me to based on?

<p>One issue with the code you posted: you do NOT need to execute INDEX ON every time you open a table. You only need to create your indexes when you create the tables. After that, they will automatically be kept up to date. Then, all you need to do to establish an index order is to issue SET ORDER. If you follow this advice you will find that your application runs much faster, especially if the tables are large.</P>
 
I suggest you only use OneDrive or Google Drive for programmatically downloading files. Not files the user updates in a multi user environment but only for Help files or Update files or supporting DBFs etc. On Google drive executable files should be renamed to another extension. Executable files like EXE, VBS can no longer be downloaded programmatically from Google, but still from OneDrive.
Users do not need to have a Google Drive or OneDrive account for this.
 
can you give me an example for me to based on?

All you have to do is to remove the INDEX ON commands from the code that you posted. You should not execute those commands eac time you open the table.

Instead, create the index when you first create the table. If you use the table designer to create the table, use the Indexes tab to specify the index (or indexes). Specify a name for the index (tidnumx in your example) and the field (or expression) on which the index is based (idnum in your example).

If you create the table in code, using CREATE TABLE, then execute your INDEX ON commands immediately after the CREATE TABLE.

Note that, in both cases, you can create multiple indexes for the same table at the same time. Then, in your application, use SET ORDER to establish which index is in force at any one time.

I hope this helps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike, i have modified structure all my databases and set my indexes on each of the tables, then in my application i have set an ORDER to variable idnum... is this correct? Thanks...

SELECT 0
USE transaction shared ALIAS trans
SET ORDER TO idnum

SELECT 0
USE smsrec shared ALIAS rek

SELECT 0
USE sms shared ALIAS tsulat
SET ORDER TO idnum

SET relation TO idnum INTO trans
 
Yes, that's perfectly correct. You should now find that opening the tables is much faster - at least, that will be true if the tables are large.

Also, you can save yourself a tiny bit of typing by combining the USE and the ORDER commands. So, instead of this:

Code:
USE transaction shared ALIAS trans
SET ORDER TO idnum

you could to this:

Code:
USE transaction shared ALIAS trans ORDER idnum

That won't prevent you from changing the index order to something else later on.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi, i'm using OneDrive for file sharing between computers in differents instalations for the same client. The computer that workd as server create a dummy dbf with every new article, customer, provider.. on onedrive, the remote computer look for a specific file called 'sessions'.
If this file is found, the remote computer open it and read what king of information is in onedrive in this moment. Then update every file dbf with the new article, provider, etc. At last, after 30 seconds of last data reading, the remote computer delete all files from one drive.
When the remote computer create a new document, it is marked and when operator try to shutdown my app, the program send a message and if the operator respond yes, the remote computer do the same operations and the new documents are send from te remote computer to server. The server dectect it and update the data. It is working about 2 years with no problems ...
 
Thank you so much Mike....

Ok Capri1966...Thanks....
 
Hi everyone.. why do i have the error "table has no index order set" every time i open my exe file? Though i have followed everything that you have advised in the indexing and set order... Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top