cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to another database with write permissions

Solved
Highlighted
Occasional Contributor

Connect to another database with write permissions

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

2 Replies
Administrator

Re: Connect to another database with write permissions

Hello,

 

You will find more information on this subject on MEGA website:

 

repository_transfer_pull.zip
Download this file (repository_transfer-pull.zip) repository_transfer_pull.zip – Resources (20.9 KB)

repository_transfer_push.zip
Download this file (repository_transfer-push.zip) repository_transfer_push.zip – Resources (41.4 KB)

repository_transfer_pull.pdf
Download this file (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
Download this file (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.

MEGA

Re: Connect to another database with write permissions

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

Claudio Pucci