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) ?
Solved! Go to Solution.
You will find more information on this subject on MEGA website:
repository_transfer_pull.zip – Resources (20.9 KB)
repository_transfer_push.zip – Resources (41.4 KB)
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 – This article explains how to configure transfer of data (push) between two MEGA repositories with MEGA Teamwork. (860 KB)
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.databases().item("repository name").fileImport("C:\\your path\\import.mgr", "C:\\your path\\rejects.txt", "");