Search code examples
oracle-data-integrator

ODI 12c Smart Import into Exec Repository with SDK behave like importing into Dev Repository


I try to smart import an XML file generated from an Exec Repository via ODI client to another Exec Repository with the SDK. I am using ODI 12.2.1.4. I already had a java program that was working fine in 11g (11.1.1.9) but since I upgraded to 12, I have errors (I made some changes to the code due to the new version). Smart importing the xml file to the Exec Repository with ODI studio is working fine so the file seems okay.

The error given by the program is : oracle.odi.impexp.smartie.OdiSmartImportException: com.sunopsis.dwg.SQLWorkReposException: ORA-00942: Table ou vue inexistante

Caused by: Error : 942, Position : 14, Sql = SELECT 1 FROM SNP_VAR WHERE I_PROJECT IS NULL AND VAR_NAME = 'CONN_DEC_USER', OriginalSql = SELECT 1 FROM SNP_VAR WHERE I_PROJECT IS NULL AND VAR_NAME = 'CONN_DEC_USER', Error Msg = ORA-00942: Table ou vue inexistante

According to the Oracle support, it is totally normal that my Exec repository doesn't have the table SNP_VAR, it is only in Dev repository. What is strange is that the smart Import makes this request on it. It seems to me that the smartImport is acting like working with a Dev Repository (just guessing)

My code :

    private String TargetUrl = "jdbc:oracle:thin:@";
    private String TargetDriver="oracle.jdbc.OracleDriver";
    private String TargetMaster_User;
    private String TargetMaster_Pass;
    private String WorkRep_Execution="WORK1";
    private String TargetOdi_User="USER";
    private String TargetOdi_Pass="PASS";
    private String ExportFile;
    private MasterRepositoryDbInfo targetmasterInfo;
    private WorkRepositoryDbInfo workInfo_exec;
    private OdiInstance odiInstance_exec;
    private Authentication auth_exec;
    private SmartImportServiceImpl smartImport;
    private ITransactionManager Tm;
    ITransactionStatus TStatus;

SmartImport(String Url, String File, String targetMasterUser, String targetMasterPwd) throws IOException{
    TargetUrl = TargetUrl+Url;
    ExportFile = File;
    TargetMaster_User = targetMasterUser;
    TargetMaster_Pass = targetMasterPwd;
    targetmasterInfo = new MasterRepositoryDbInfo(TargetUrl, TargetDriver, TargetMaster_User,TargetMaster_Pass.toCharArray(), new PoolingAttributes());
    workInfo_exec = new WorkRepositoryDbInfo(WorkRep_Execution, new PoolingAttributes());
    odiInstance_exec=OdiInstance.createInstance(new OdiInstanceConfig(targetmasterInfo,workInfo_exec));
    auth_exec = odiInstance_exec.getSecurityManager().createAuthentication(TargetOdi_User,TargetOdi_Pass.toCharArray());
    odiInstance_exec.getSecurityManager().setCurrentThreadAuthentication(auth_exec);
    smartImport = new SmartImportServiceImpl(odiInstance_exec);
    Tm = odiInstance_exec.getTransactionManager();
    TStatus = odiInstance_exec.getTransactionManager().getTransaction( new DefaultTransactionDefinition());
    }
smartImport.importObjectsFromXml(ExportFile, "MyPassword".toCharArray(), false);

The master repository I am working on has only one work repository (called "WORK1") which is an execution repository. Any clue on what is wrong ?

Thanks PEB


Solution

  • Thanks to JeromeFR suggestion, I found a workaround for my issue using Deployment Archives instead of Smart Export/Import. It works fine exporting my archive from my dev repository (through ODI client) and importing to my Exec repositories via java skd (I have several exec environments) The code for importing the archive in replacement for the smartImport :

    DeploymentService.applyFullDeploymentArchive(odiInstance_exec, "EXEC_Init.zip", true, "Password".toCharArray(), true);
    

    Thx PEB