SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: Gary Stout on September 04, 2012, 05:55:27 pm

Title: Access Denied (error -8) Remote mode
Post by: Gary Stout on September 04, 2012, 05:55:27 pm
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.

Thanks,
Gary
Title: Re: Access Denied (error -8) Remote mode
Post by: Fred Meier on September 04, 2012, 06:30:00 pm
Use slCopyDatabase to do a copy/backup.  Read/understand the P and S ModChars.  This uses the sqlite3_backup routines --- very powerful.
Title: Re: Access Denied (error -8) Remote mode
Post by: Gary Stout on September 04, 2012, 07:24:23 pm
Fred,

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.

Thanks,
Gary
Title: Re: Access Denied (error -8) Remote mode
Post by: Fred Meier on September 04, 2012, 08:43:26 pm
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.
Title: Re: Access Denied (error -8) Remote mode
Post by: Gary Stout on September 06, 2012, 03:47:14 pm
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!

Thanks,
Gary
Title: Re: Access Denied (error -8) Remote mode
Post by: Fredrick Ughimi on September 06, 2012, 05:04:55 pm
Hello Gary,

You might want to take a look at this thread:

http://www.sqlitening.com/support/index.php?topic=3379.msg17438#msg17438