26-06-2012 03:06 PM
Hello,
I want to import data from development to validation database with API but I have to run macro from development database.
I try this code :
Set root = GetRoot Set myTargetBase = CurrentEnvironment.openBase("validation", root, "") myTargetBase.MegaImport sFileName, sRejectFile, "" myTargetBase.MegaCommit
This code opens validation database with read only access.
How to connect to another database with write permissions (using the API) ?
Regards.
--
N. Gibanel
Solved! Go to Solution.
28-06-2012 04:50 PM
Hello,
it is not possible to open two repositories of the same environment in Read/Write at the same time.
But you can open the first, do you job, then close it and open the other to do the remaining stuffs.
You shall also avoid to use CurrentEnvironment because it will lock the environment and you cannot close it.
Use the "Administration APIs", like
MegaApplication mgApp = new MegaApplication("C:\\MEGA\\MEGA 2009 SP5\\System\\");
MegaEnvironment mgEnv = mgApp.environments().item("environment full path");
mgEnv.setCurrentAdministrator("Administrator");
mgEnv.setCurrentPassword("password");
mgEnv.databases().item("repository name").fileImport("C:\\your path\\import.mgr", "C:\\your path\\rejects.txt", "");
mgApp=null;
System.gc();
Cheers,
Claudio
28-06-2012 04:43 PM - edited 28-06-2012 04:44 PM
Hello,
You will find more information on this subject on MEGA website:
repository_transfer_pull.zip
repository_transfer_pull.zip – Resources (20.9 KB)
repository_transfer_push.zip
repository_transfer_push.zip – Resources (41.4 KB)
repository_transfer_pull.pdf
repository_transfer_pull.pdf – This article explains how to configure transfer of data (pull) between two MEGA repositories with MEGA Teamwork. (759 KB)
repository_transfer_push.pdf
repository_transfer_push.pdf – This article explains how to configure transfer of data (push) between two MEGA repositories with MEGA Teamwork. (860 KB)
see you.