Tip: NAV Classic Server – hidden features

It has been a while since my last blog post. There were a couple of reasons for this:

  • First, my wife and me are expecting our third child, so I was busy redecorating Smile
  • Second, I was so busy the last month at work with my projects
  • And third, I didn't have any inspiration for a new post.

But all that changed last week when our newest MVP Luc van Vugt wanted to install multiple classic servers on a single machine. (I know, this is old school NAV). The installation went ok, but

In the old days (if I recall this correctly NAV 3.70 and earlier) all you had to do was create a copy of the server folder change the name of the second server and make an entry in the hosts and service files for each server and you  were good to go. (Note: these two files are in the well-known "C:\Windows\System32\drivers\etc" folder) To change a setting to one of the servers, you just opened the folder of the corresponding server and with the "server.exe" you could change the settings for that server.

In the latest NAV versions things started to work a little different. I'll explain this in the following example.

Setting the hosts and services file

As in the old days, we are going to change the entries in the hosts and service files on the server (and client) machines.

Add the following entries to the hosts file:

127.0.0.1       server1
127.0.0.1       server2

(Note that on the client machines 127.0.0.1 should be replaced by the server's ip-address.)

Add the following entries to the services file:

server1          2407/tcp                           #NAV Server 1
server2          2408/tcp                           #NAV Server 2

Now, what's new then?

With the old NAV versions the trick was to make a copy of the server folder and change the settings of that copy to the new server in the command prompt.

So, for changing a setting of one server you just had to browse to the appropriate folder and change the settings using the "server.exe" in that directory. The settings were stored in the directory itself in a "dbms.zup" file.

Now, the copy process is still the same, but there have been some strange glitches now since NAV started to use the windows profiles to store its settings.

The settings are no longer stored per server folder but in the registry. Changing the server name with "server servername=<yourservername>" will allow you to change the server settings for that server using the command prompt.

When installing the server as a service these latest settings are stored in the registry.

 

As the screen capture above shows, the registry settings can be found by using "regedit".

The strange thing is that you can edit the values in here, but when I got the settings of the server in the command prompt I still got the old settings. The settings that are used in the command prompt also stored in the "dbms.zup" file.

Now here's where it gets tricky, when I just change the folder to the second server in the command prompt. I get a list of the server I changed the latest. These settings get copied out of the "dbms.zup" file and not from the registry!

 

Latest server settings are shown above. I first installed "SERVER1" in the "c:\server\" folder and then installed "SERVER2" into the "c:\server2\" folder.  Now change to the folder of the first server and type "server" and see what happens:

 

So IF you plan to install two classic servers on one machine, in my humble opion the best practice is to put the complete command string in a batch file (i.e. "Server1.bat" and "Server2.bat") in its corresponding folder.

You probably are thinking by now, why still copy the folder. I asked myself that question too.. When trying to run the two services from the same directory (different database with a different server name) I ran into the following error:

"You cannot open another database or create a new database because the database was opened on the server with the program property database=<database name>. ..."

Since the path of the server.exe is also stored in the registry, my conclusion was that running the exact same executable twice is giving this problem.

 

Comment List
  • I don't see any change as long as you don't mess with the values in registry?

    Another tip: If you name your NAV DB services for <servername>:<port> during creation, you don't need to mess with Host and Service files anywhere. Then clients just have to connect directly to the server called <servername>:<port>

  • Peter, the biggest change is that in the old days each folder had its own dbms.zup. In the current versions of NAV they are stored in a "profile" folder.

    This results in the fact that multiple servers use the same dbms.zup when requesting the server settings in which case Server1 can return the settings of Server2.

    By the way, thanks for the tip to avoid the hosts and services change. I knew that you can address the servers using the ip address and port number (from the client), but I was unfamiliar with the fact that you can set them up the same way. I'll try that one out over the weekend :)

Related
Recommended