NAS and Access Automation - CLIENT.EXE ok NAS.EXE ko

LouisLouis Member Posts: 78
edited 2006-01-23 in Navision Attain
Native DB V360 - The developped code unit uses Access Automation Control to create periodically an Access DB.
On the server, the Code Unit runs perfectly when started from the Client (CLIENT.EXE and Run by Object Designer).
When started from an NAS (NAS.EXE) the Access Automation Control doesn't work. The Event Log shows an event like - can not create an instance of ACCESS.APPLICATION - ...check Registry ...
Can you explain what happens, what is the difference related to the registry entry of the automation control, between a code unit started from the client or started from NAS. (even when the client is started on the DB server or on another PC it works).
TIA for all information,
Louis - best wishes for 2006[/u]

Comments

  • DenSterDenSter Member Posts: 8,307
    Is Access installed on your NAS machine?
  • LouisLouis Member Posts: 78
    Yes, the Access and the DLL are installed on the server. On the server, I can compile the code unit from my (Client.exe) session - which means for me that the path to the Automation Control is correct.

    Here is a piece of C/AL :
    VARS
    OBJdbconnection	        - Automation - 'Microsoft ActiveX Data Objects 2.1 Library'.Connection	
    OBJ_Access11Application	- Automation - 'Microsoft Access 11.0 Object Library'.Application	
    
    
    FCT gf_CreateDB_MDB()
    
    lrec_Setup.gf_GetDataWarehousePath();
    lrec_Setup.gf_GetDataWarehouseMDBFile();
    gtex250_DBFile := lrec_Setup.gf_GetDataWarehouseMDBFile()+'.mdb';
    // ERASE DB IF IT EXISTS
    IF ERASE(lrec_Setup.gf_GetDataWarehousePath()+lrec_Setup.gf_GetDataWarehouseMDBFile()+'.mdb') THEN;
    
    gtexProvider   := 'Provider=Microsoft.Jet.OLEDB.4.0';        //MSACCESS
    gtexDataSource := 'Data Source='+lrec_Setup.gf_GetDataWarehousePath()+      
      lrec_Setup.gf_GetDataWarehouseMDBFile()+'.mdb';
    gtexOptions    := '';                                        //Persist Security Info=False';
    DSN:=gtexProvider+';'+gtexDataSource+';'+gtexOptions;        //connectionString 
    
    /////////////////////////////////
    // Create MDB database
    /////////////////////////////////
    
      CREATE(OBJ_Access11Application);
      OBJ_Access11Application.NewCurrentDatabase :=
        lrec_Setup.gf_GetDataWarehousePath()+lrec_Setup.gf_GetDataWarehouseMDBFile()+'.mdb';
      OBJ_Access11Application.SetOption('Auto Compact',1);      //AUTO COMPACT ON             0); //AUTO COMPACT OFF
      OBJ_Access11Application.CloseCurrentDatabase();
      OBJ_Access11Application.Quit();                           //[ACQUITOPTION Option])
    
    ...etc
    


    Any idea ?
    Does Provider requires something on the server ? ("Microsoft.Jet.OLEDB.4.0")
    Louis
  • DenSterDenSter Member Posts: 8,307
    When you run that from a client session, are there any visual things happening on the screen, like Access opening up? NAS does not know how to handle visuals, so you'd have to program to do all of that without user interface.
  • LouisLouis Member Posts: 78
    Thank you for your replies.
    There is no visual problem. On my PC there is no problem to run the DB Server and an NAS Server. In this environment everything is OK - the MDB file is created by the running NAS. The problem occurs only on the PROD DB Server installation. This is the mystery !
    Louis
  • DenSterDenSter Member Posts: 8,307
    So when you run a NAS form your own computer it works, but when it runs from the production machine it doesn't? That is weird.... Could it be some sort of permissions problem?
  • LouisLouis Member Posts: 78
    Thank you for the reply.
    I don't know. What is sure... is that's a problem :cry:
    Of course the PROD machine doesn't have the same permission rights as mine. But the event log talk about a problem of Instanciation of the automation control - not about permissions. I have tried to create the MDB file on C:/Temp on the server - the result is the same in the event viewer.
    Louis
  • DenSterDenSter Member Posts: 8,307
    IF NOT ISCLEAR(OBJ_Access11Application) THEN
      CLEAR(OBJ_Access11Application);
    CREATE(OBJ_Access11Application);
    
    Just trying different things. There are a few things that can go wrong when you instantiate an automation variable:
    The component is not know, which we have eliminated, since Access is installed on the NAS machine.

    There is something wrong with the object itself, like it tries to create one when it already has one in memory. That's what I am trying to prevent with the code above, where it makes sure that it clears the object before creating it.

    Then, there could be something wrong with a parameter, like a connection string. That could be a problem if the user that is set up to run NAS does not have permissions to open the connection.

    Could you copy the exact message into a reply?
  • kinekine Member Posts: 12,562
    Check under which account is NAS running on the server... on your PC it is running under your account I assume... and on the server may be under some account which is not able to run the Access...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • LouisLouis Member Posts: 78
    Thank you for your replies.
    The exact event description when the NAS is running :
    This message is for C/AL programmers:
    Could not create an instance of the OLE control or Automation server identified by GUID=...etc :Microsoft Access Object library.Application

    (which doesn't really show permission problem...)
    Effectively the task manager shows multiple instances of crashed--MSAccess.exe --

    On my PC it is running on my Account (Log on as "My Account").

    How to test/debug if the NAS account can run Access ?

    Louis
  • kinekine Member Posts: 12,562
    Log into PC under the account you are using for the NAS... if it is not Network or System account. In this case, I advice to change it to some other account...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,307
    Go to Services in your computer management console, and open the NAS service property pages. In there you will find a Logon tab where you can enter the user credentials. The user that you enter there must be a valid Navision windows user.

    If that i not the problem, then either you are not calling the automation correctly, or there must be some sort of visual component in the Application object that NAS can't handle.
  • dtotzkedtotzke Member Posts: 2
    Louis wrote:
    Native DB V360 - The developped code unit uses Access Automation Control to create periodically an Access DB.

    The office automation objects are not thread safe and were never intended to be run in a service environment. To do so is asking for trouble. This applies everywhere, not just in Navision.

    I would make a template access database. Have a scheduled task that first copies this template version to a new file and then use ODBC to pump the data into it. If you have SQL Server there, you can use DTS to do this quite easily.

    No good could come of automating Access on your server.

    Dave
Sign In or Register to comment.