04-12-2014 08:16 AM
11-12-2014 11:16 AM
Hi Lionel,
After takeing the back-up, the process still runs :mhwmapp.exe*32
I have added a kill process after it also doesn't work.
Below is my code :
MegaApplication objMegaApp = new MegaApplication();
MegaEnvironments cEnvironments = objMegaApp.getEnvironments();
oEnvironment = cEnvironments.get(sEnvironmentName);
oEnvironment.setCurrentAdministrator(sAdministratorName);
oEnvironment.setCurrentPassword(sPassword);
oDatabase = oEnvironment.databases().get(repNm);
Environment.setCurrentAdministrator(sAdministratorName);
oEnvironment.setCurrentPassword(sPassword);
oDatabase = oEnvironment.databases().get(repNm);
MegaTransactions lMegaTransaction=oEnvironment.transactions();
MegaTransaction oMegaTransaction = lMegaTransaction.create(oDatabase, sAdministratorName);
MegaRoot oMegaRoot = oMegaTransaction.getOwnedDatabase().open();
oDatabase.logicalSave(newBackupFileMain,"");
oMegaRoot.megaCommit();
oMegaRoot.close();
oMegaTransaction.dispatch();
oMegaTransaction.abort();
oMegaTransaction.release();
oMegaRoot.release();
lMegaTransaction.release();
oEnvironment.release();
objMegaApp.release();
lMegaTransaction=null;
oMegaTransaction = null;
oMegaRoot = null;
oEnvironment = null;
objMegaApp = null;
kill method---
-----String processName = "mgwmapp.exe";
private static final String KILL = "taskkill /IM ";
public static void killProcess(String serviceName) throws Exception {
Runtime.getRuntime().exec(KILL + serviceName);
}
-------
killProcess(processName);
Rakesh
08-12-2014 10:41 AM
Hi Lionel,
Thanks for your reply..:)
when I try to use:
oMegaRoot = oMegaTransaction.Database.Open
It's saying "The method database() from the type MegaTransaction is deprecated".
any alternative methiod ?
Br,
Rakesh
08-12-2014 10:18 AM
Hi Rakesh,
If you are implementing a logical backup it means that you are opening a transaction or you are "administrator" and the end of your code must include, for the first method, a end of transaction plus a end of mega. Sometimes I am adding a kill of process but never for a logical backup that is already ending well.
In VB I am always using this kind of :
oMega = New MegaApplication
oMegaEnv = oMega.Environments.Item(“xxxxx")
oMegaEnv.CurrentAdministrator = MegaUser
oMegaEnv.CurrentPassword = "yyyy"
oMegaTransaction = oMegaEnv.Transactions.Create("tttt", MegaUser)
oMegaRoot = oMegaTransaction.Database.Open
oMegaApplis = oMegaRoot.GetSelection("Select [Application] Where [zzzz]=""" + Trim(Str(ObjID)) + """")
… some lines …
oMegaRoot.MegaCommit()
oMegaRoot.BaseClose()
oMegaTransaction.Dispatch("AlwaysDispatch=Y")
oMegaTransaction.Abort()
oMegaAppli = Nothing
oMegaApplis = Nothing
oMegaTransaction = Nothing
oMegaRoot = Nothing
oMegaEnv = Nothing
oMega = Nothing
Dim myProcesses As Process() = Process.GetProcessesByName("mgwmapp")
Dim myProcess As Process
myProcesses = Process.GetProcessesByName("mgwmapp")
For Each myProcess In myProcesses
myProcess.Kill()
Next