Hello everybody!
I'm currently working with the version 98.1 of ARIS, and based on Dave Keaton's post(https://www.ariscommunity.com/users/ddkeaton/2016-02-08-serveradminbackupdatabase-question), also on scheduling a report to execute a daily backup of the database.
After execution, the results of the scheduling show:
The following errors occurred:
script Automatic Backup, line 32: Can't find method com.aris.modeling.server.bl.components.serveradmin.AServerAdminScriptInterface.backupDatabase(string,java.io.File).
Has somebody faced this error before, or would have any idea about it?
The code I'm implementing goes as follows. Any help is appreciated
Cheers,
Oswaldo
main();
function main()
{
//Select the target folder
var selectedFolders="C:\Users\bejarosw";
Context.setSelectedPath(selectedFolders[0]);
Context.setSelectedFile("Work DB"+"_"+Date());
var sPath=Context.getSelectedPath();
var sFile=Context.getSelectedFile();
var oFile=new java.io.File(sPath,sFile);
var oDatabase = "Work DB";
var dbAdmin = Context.getComponent("ServerAdmin");
if(dbAdmin.backupDatabase(oDatabase,oFile)){
//Log backup result
sMessage="Work DB"+" was backed up on "+new Date();
}else{
//Log backup result
sMessage="Work DB"+" could not be backed up on "+new Date();
}
}
Hello,
The signature for the method is :
backupDatabase ( Database p_Database, File adbFile )
So the method is waiting for an object database, and not only the name of the database you want to backup.
If you want to save the selected database, try :
var oDatabase = ArisData.getSelectedDatabases()[0];
.....
if(dbAdmin.backupDatabase(oDatabase,oFile)){
.....
Hope it will help you.
Best Regards.
Romain Tricarico
Hi Romain Tricarico,
Thank you very much for your help.
I included the change you mentioned, but now another error appears regarding the output of the report. What kind of output should I include in this case, and how to do it?
[Error]: The report returned no result. You may have to change the execution data.
[code]
main();
function main()
{
//Select the target folder
var selectedFolders="C:\Users\bejarosw";
Context.setSelectedPath(selectedFolders[0]);
Context.setSelectedFile("Work DB"+"_"+Date());
var sPath=Context.getSelectedPath();
var sFile=Context.getSelectedFile();
var oFile=new java.io.File(sPath,sFile);
var oDatabase = ArisData.getActiveDatabase();
var dbAdmin = Context.getComponent("ServerAdmin");
if(dbAdmin.backupDatabase(oDatabase,oFile)){
//Log backup result
sMessage="Work DB"+" was backed up on "+new Date();
}else{
//Log backup result
sMessage="Work DB"+" could not be backed up on "+new Date();
}
}
[/code]
Best,
Oswaldo