Altius Community

Altius Consulting Community
Welcome to Altius Community Sign in | Join | Help
in Search

Jake Smillie

August 2008 - Posts

  • Essbase API Load Data - Error 1042015 - Network error: Cannot Locate Connect Information For [%s]

    Today I was trying to load data into Essbase v7.1.5 using the VB API command EsbImport.

    The Essbase API documentation is great and gives you very useful code examples. The example they give for EsbImport is defined below:

    Declare Function EsbImport Lib "ESBAPIN" (ByVal hCtx As Long, Rules As ESB_OBJDEF_T, 
                                              Data As ESB_OBJDEF_T, User As ESB_MBRUSER_T, 
                                              ByVal ErrName As String, ByVal AbortOnError As Integer) 
                                              As Long
    Sub ESB_Import ()
       Dim sts          As Long
       Dim Rules        As ESB_OBJDEF_T
       Dim Data         As ESB_OBJDEF_T
       Dim User         As ESB_MBRUSER_T
       Dim ErrorName    As String
       Dim AbortOnError As Integer    
       '*********************************
       ' Rules file resides at the server
       '********************************* 
       Rules.hCtx     = hCtx
       Rules.Type     = ESB_OBJTYPE_RULES    
       Rules.AppName  = "Demo"
       Rules.DbName   = "Basic"   
       Rules.FileName = "Test"           
       
       '********************************
       ' Data file resides at the server
       '******************************** 
       Data.hCtx      = hCtx
       Data.Type      = ESB_OBJTYPE_TEXT      
       Data.AppName   = "Demo"
       Data.DbName    = "Basic"
       Data.FileName  = "Data"               
       '********************************
       ' Specify file to redirect errors 
       ' to if any 
       '******************************** 
       ErrorName      = "IMPORT.ERR"   
       '*************************
       ' Abort on the first error 
       '*************************
       AbortOnError   = ESB_YES   
       '*******
       ' Import
       '*******
       sts            = EsbImport (hCtx, Rules, Data, User, ErrorName, AbortOnError)    
     End Sub

     

    This code however is incomplete and will generate an Essbase error 1042015 - Network error: Cannot Locate Connect Information For [%s].

    The problem is that the database you have selected to import data into is not active. Therefore before the EsbImport command is called, you need to call EsbSetActive, like below

    Dim pAccess AS Integer
     
    sts = EsbSetActive (hCtx, "Demo", "Basic", pAccess)

    This will fix your error 1042015 woes.