Is there a way to work around backing up a database while in remote mode from code that would over ride the Access Denied error.
I have a program/service running in C:\PRS and if I select the backup option in the program and try to copy the database to say C:\PRS_BU, of course, I get the Access Denied error. Is it possible to stop the service from code, do the backup and then restart it? This all being done on a local peer to peer network with one computer acting as the server.
Use slCopyDatabase to do a copy/backup. Read/understand the P and S ModChars. This uses the sqlite3_backup routines --- very powerful.
I am using the slCopyDatabase routine, but I haven't looked at the P & S ModChars yet. I will read up on those. All was fine in local mode, but from reading the docs on slCopyDatabase, I understand why it works the way it does.
See the "Remote Mode" notes for slCopyDatabase
Quote--- Remote Mode ---
The FileName is assumed to be relative to the folder which the service is
running from. Since this is running on a remote server SQLitening can not
allow the user to access files anyplace on the server. Access is denied
to any FileName that has a colon, a double dot, or begins with a
backslash. This will insure that the file is in same folder as the
service or below it.
Examples: If your service is running from C:\SQLitening then:
If DestinationFileName is Data\Able.Sld then will assume file is in C:\SQLitening\Data.
If DestinationFileName is ..\Y\Able.Sld then will get error %SQLitening_AccessDenied.
If DestinationFileName is C:\Able.Sld then will get error %SQLitening_AccessDenied.
If DestinationFileName is X\Y\Able.Exe and command was GetFile then will get error %SQLitening_AccessDenied.
Fred and others,
I was able to come up with a workable solution to allow moving the file to another location on the server when in remote mode.
I am still using the slCopyDatabase command, but I am copying the main database to a temp file, ie MainDB.bak. I then use the PB FILECOPY command to move the newly created *.bak file to the location the user selects from a file save dialog. From there, I rename the file to the original name with the PB NAME command and delete the *.bak file from both locations.
Works like a charm!
You might want to take a look at this thread: