Options

how can get Server NAme from NAV 2009 RTC

TatevikTatevik Member Posts: 28
edited 2011-03-03 in NAV Three Tier
I need to get server name from Role tailored client ..
In classic client I used ContextURL function. But it's not supported in RTC.
Also I it is not allowed to read data from Server virtual table. Please advice.


Beforehand thanks a lot...

Comments

  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    Can you tell me what you need it for? (different scenarios might have different solutions)
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    TatevikTatevik Member Posts: 28
    Hello the scinaro is the following. I need just to get sql server name, just for passing its name to the VB project by automation. In the Classic NAV I used CONTEXTURL function, and probably you know it is not supported from NAV 2009 RTC.
  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    For that you would need to read the CustomSettings.config on the service tier, which is located in (I think) the APPLICATIONPATH.
    You should be able to read that and find the DBSERVER key (and the DBINSTANCE key for SP1)
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    PureHeartPureHeart Member Posts: 190
    Please Help!

    How can I get the Computername of the NAV server???
    That is not saved in the customsettings.config and I can't use the ENVIRON command in RTC?

    What I'm trying to achieve is to build dynamically the address to call the NAV web services but without the PC name I can't do that!

    Any Idea is much appreciated!
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • Options
    ara3nara3n Member Posts: 9,255
    you can use windows host script and send a command set

    It will return a lot of parameters. One of them is computername.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    PureHeartPureHeart Member Posts: 190
    Thank you ara3n!

    I think I have found an even easier method using WshNetwork!

    You can get the value of the property "ComputerName"!

    :D:D
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • Options
    ara3nara3n Member Posts: 9,255
    That's great that you found another way.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    I would create a field in a system table to hold the base URL of the Web Service listener - it is more flexible and who knows, maybe one day you will add another service tier (without an extra Web Service listener) or you decide to move the web service listener to a different machine.

    /Freddy
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    PureHeartPureHeart Member Posts: 190
    Thanks Freddy, which system table do you think would be better?
    the company table?
    I was trying to make it setup free....
    Also can you please shed some light on this? ](*,) ](*,)
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • Options
    pdjpdj Member Posts: 643
    Found this old thread, while searching for a solution to build a SQL Connection String to connect to the current NAV DB. It seems this simply isn't possible anymore, and even Microsoft tried a rather strange way to do exactly the same in codeunit 8705 (NAV 2009 SP1 & R2). Take a look at in GetSessionInfo and the usage in LoadWindowsGroups.
    It seems to assume the code (in this case the NAS) is running on the SQL server, and the used SQL server is installed as the default instance. Otherwise this doesn't seem to work, or am I missing something? :-k
    Regards
    Peter
  • Options
    davmac1davmac1 Member Posts: 1,283
    Isn't this one of the new features in R2?
    I have not looked at it yet - maybe it could be ported to SP1 or base 2009?
  • Options
    matttraxmatttrax Member Posts: 2,309
    If you just need the server name of the NAV Service Tier (not the actual service you are connected to, in the case of multiple services running on the same server) you can get it in the Session table in the Host Name field.
  • Options
    pdjpdj Member Posts: 643
    @davmac1: Which new function are you refering to? I can't find anything that should give me what I need. :-(

    The functions in codeunit 8705 are re-written from NAV5 SP1, where it used CONTEXTURL to get the db-name and SQL-instance name. The re-writing is now finding the db-name from the Session table which is ok. But it tries to find the SQL instance name from the Host Name field of the Session table, which is the computer name of the client executing the code. This would rarly work, but I guess it worked at the developers setup :?
    Regards
    Peter
  • Options
    pdjpdj Member Posts: 643
    matttrax wrote:
    need the server name of the NAV Service Tier
    Yes, but in my case I need the SQL Server instance to make an ADO connection. I can't see anyway to do this anymore, and apparently Microsoft can't either.
    Regards
    Peter
  • Options
    PureHeartPureHeart Member Posts: 190
    Can't you get the SQL server name from the database information?
    Or otherwise you can easily do it creating a SQL view and then link it to a nav table...
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • Options
    pdjpdj Member Posts: 643
    PureHeart wrote:
    Can't you get the SQL server name from the database information?
    Yes it is basically the information from the Database Information window I need. However, I can't find a system table containing this info anywhere. HEY! Finally! I can get the current SQL Instance from the "Server" table, and the database from either the "Session" or the "Database" table. My problem is solved - thanks \:D/
    PureHeart wrote:
    Or otherwise you can easily do it creating a SQL view and then link it to a nav table...
    I'm kinda old school. I prefer making solutions that works both with SQL and Native DB, and both with the RTC and Classic client. And I should be able to restore my DB at a different server, and be up and running without having to change all kinds of setup and configuration. I know this approach is not the way the world is turning, but hech, I'm old school 8)
    Regards
    Peter
Sign In or Register to comment.