ARIS Community - We Love BPM

Database backup inside a report

hreidemeister's picture
by Holger Reidemeister in Reports & Macros posted on 2017-05-04

Hallo folks,

for creating a backup inside a report I have the following function DbBackup:

function DbBackup()
{
    var ADB   = ArisData.getActiveDatabase();
    var oFile;
    var oDbAdmin;
    var lOK;
    var sPath = "C:\\Download";
    var sFile = "WorkDB "+Date();

    Context.setSelectedPath(sPath);
    Context.setSelectedFile(sFile);
    oFile     = new java.io.File(sPath, sFile);
    oDbAdmin  = Context.getComponent("ServerAdmin");
    lOK       = oDbAdmin.backupDatabase(ADB, oFile);

    return;
}

 

This function runs through without creating an error.
But unfortunately it does not create any backup file and the answer of "oDbAdmin.backupDatabase(ADB, oFile)" is "false". (lOK = false)
The path "C:\Download" exists on my computer and I run the report on my local server for development.
When starting a backup of this database manually I have no problems. That works fine.

Now I would be very happy if anybody can help me and show me where my mistake is.
Many thanks in advance,
Holger

3237 Views
2 Likes
1 Comments
There are no attachments
Holger Reidemeister posted on 2017-05-05

OK, I found the solution myself. The mistake is the filename. Using Date() generates the filename "WorkDB Fri May 05 2017 09:32:45 GMT+0200 (MESZ).adb" and this can't be handled. The new line for generating the filename is:

var sFile = "WorkDB "+getTimeStamp()+".adb";

getTimeStamp() is an own function that gives back the current date and time in the format "YYYYMMDDhhmm" without any special chars like ":", "(", ")" and "+".

And so it works and I get my backup.

Many thanks to everyone who were thinking about.