How to distinguish between production db and test db

ta5ta5 Member Posts: 1,164
Hi

We often have customers with 2 dbs. One for testing purposes and the production db.

Is there an easy way for customers to distinguish between these 2 environments? The problems is, they are sometimes in the wrong db without noticing it. As far as I know, renaming the companies in test db is not an option with sql option.

I'm looking forward to some input for:

Version: 4.x
DB: Native and SQL

Many thanks
Thomas

Comments

  • Captain_DX4Captain_DX4 Member Posts: 230
    Traditionally, I've found that with databases that are separate, preparing a customization for the menu that will set it apart. Do something like change the background colour, or add a label that can act as a message to the users.

    For v4, would a MESSAGE prompt be sufficient?

    As far as I knew, you could change the name of a company within NAV even in the SQL version.
    Kristopher Webb
    Microsoft Dynamics NAV Developer
  • ta5ta5 Member Posts: 1,164
    Hi Kristopher

    Message: Not too bad, but after clicking it away its gone. Someone has another idea (similar to another color of the menu, or maybe a status line...)

    Renaming: Ok in SQL, but can be very slow.

    Thanks
    Thomas[/b]
  • thaugthaug Member Posts: 106
    I've done this on select forms that would most likely give people a problem. First, we don't use the Navigation Pain (spelled incorrectly on purpose), so I've customized the main menu to show the company, which could also be changed to show the database name. Use the samples provided in the download section to find out the database name, etc. I also highlight it in Red when it is different from the expected default.

    On select forms, I also add to the DataCaptionExpr for the form to display the company, but it could also be used to display the database easily.
    There is no data, only bool!
  • ArhontisArhontis Member Posts: 667
    I have built a form that looks like a toolbar and shows the server and the database name, and the database name is always something like "TEST database" and the productive has a more meaning name to the customer...

    I place that form to run in the cu1, so no matter what database I work I can see where exactly I am.

    Since I work in different servers and databases all the time (2-3 at the same time) it helps me alot...
  • bbrownbbrown Member Posts: 3,268
    Another way is to give them different passwords in the test system. This only works with database users.
    There are no bugs - only undocumented features.
  • DenSterDenSter Member Posts: 8,305
    How about you create a menu group at the top of the menusuite with the name of the database?
  • WaldoWaldo Member Posts: 3,412
    I posted a solution for this once, but can't find the thread anymore.

    What I did:

    I created a form with properties:
    Autoposition: None
    Insertallowed: No
    ModifyAllowed: No
    DeleteAllowed: No
    Editable: No
    Minimizable: No
    Maximizable: No
    Sizable: No
    Borderstyle: None
    Captionbar: None

    Then a setup where you can decide:
    - if the form should be shown at all
    - the title: will be filled in in a textbox on the form
    - the color of the form

    in codeunit 1 OnCompanyOpen:
    Show the form

    On the form are the fields:
    - Title (set up in the setup)
    - Company
    - License info (owner and type of license (e.g. developer license))
    - current user
    - current number of sessions (with drill down)
    - database

    The form is always shown on XPOS=0 and YPOS=0, and with the same width and height.

    We include this in our default database, so this functionality is always available at new customers.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • ta5ta5 Member Posts: 1,164
    Thanx for all of your replies.
    I think we will opt for the form which is started in cu1.

    Regards
    Thomas
  • Dave_CintronDave_Cintron Member Posts: 189
    thaug wrote:
    (spelled incorrectly on purpose)
    SIC
    Dave Cintron
    Dynamics West
    http://www.dynamicswest.com
  • headley27headley27 Member Posts: 188
    You can use this:

    Change MYSERVERNAME to your Production Server Name
    Change MYDATABASENAME to your Production Database Name

    The form runs invisibly in the background at all times.

    It will pop up a warning message if you are not logging into your production server or your production database.

    It will also provide a warning that prevents the accidental 'closure' of Navision (which drove many of our employees crazy).
    The 'closure' message will also fire when changing companies within the same database.
    OBJECT Form 50100 CustomAppFunc
    {
      OBJECT-PROPERTIES
      {
        Date=10/12/07;
        Time=11:31:08 AM;
        Version List=BT;
      }
      PROPERTIES
      {
        Width=14080;
        Height=3740;
        Visible=No;
        Editable=No;
        CaptionML=ENU=WARNING !!;
        Sizeable=No;
        ActiveControlOnOpen=1000000001;
        OnOpenForm=BEGIN
                     //BT002 START
                     Context := CONTEXTURL;
                     ServerName := COPYSTR(Context,STRPOS(Context,'servername=')+11);
                     ServerName := DELSTR(ServerName,STRPOS(ServerName,'&'));
                     DatabaseName := COPYSTR(Context,STRPOS(Context,'database=')+9);
                     DatabaseName := DELSTR(DatabaseName,STRPOS(DatabaseName,'&'));
    
                     ServerName :=UPPERCASE(ServerName);
                     DatabaseName := UPPERCASE(DatabaseName);
    
                     IF (ServerName <> 'MYSERVERNAME') OR (DatabaseName <> 'MYDATABASENAME') THEN BEGIN
                       CurrForm.Alert.VISIBLE := TRUE;
                       CurrForm.TestDatabase.VISIBLE := TRUE;
                       CurrForm.ServerName.VISIBLE := TRUE;
                       CurrForm.DBName.VISIBLE := TRUE;
                       CurrForm.VISIBLE :=TRUE;
                     END;
                     //BT002 END
                   END;
    
        OnQueryCloseForm=BEGIN
                           //BT001 START
                           IF CurrForm.VISIBLE = FALSE THEN BEGIN
                             IF NOT CONFIRM('Are you sure you want to close your connection to the Navision Database?',FALSE)THEN
                               ERROR('');
                           END ELSE BEGIN
    
                             CurrForm.VISIBLE := FALSE;
                             ERROR('');
                           END;
                           //BT001 END
                         END;
    
        OnDeactivateForm=BEGIN
                           CurrForm.VISIBLE := FALSE;
                         END;
    
      }
      CONTROLS
      {
        { 1000000004;Frame  ;0    ;0    ;14080;3740 ;ShowCaption=No;
                                                     Border=No }
        { 1000000000;Image  ;440  ;990  ;2200 ;1663 ;Name=Alert;
                                                     Visible=No;
                                                     ParentControl=1000000004;
                                                     InFrame=Yes;
                                                     Bitmap=5 }
        { 1000000002;Label  ;2970 ;330  ;10556;990  ;Name=TestDatabase;
                                                     Visible=No;
                                                     ParentControl=1000000004;
                                                     InFrame=Yes;
                                                     HorzAlign=Left;
                                                     ForeColor=8880;
                                                     Border=No;
                                                     FontName=Arial;
                                                     FontSize=12;
                                                     FontBold=Yes;
                                                     FontUnderline=Yes;
                                                     LeaderDots=No;
                                                     CaptionML=ENU=You are accessing a test database !! }
        { 1000000001;TextBox;2970 ;1540 ;10556;880  ;Name=ServerName;
                                                     Visible=No;
                                                     Editable=No;
                                                     Focusable=No;
                                                     ParentControl=1000000004;
                                                     InFrame=Yes;
                                                     HorzAlign=Left;
                                                     ForeColor=8880;
                                                     Border=No;
                                                     BorderStyle=Normal;
                                                     FontName=Arial;
                                                     FontSize=12;
                                                     FontBold=Yes;
                                                     SourceExpr='Server: ' +  ServerName }
        { 1000000003;TextBox;2970 ;2420 ;10556;880  ;Name=DBName;
                                                     Visible=No;
                                                     Editable=No;
                                                     Focusable=No;
                                                     ParentControl=1000000004;
                                                     InFrame=Yes;
                                                     HorzAlign=Left;
                                                     ForeColor=8880;
                                                     Border=No;
                                                     BorderStyle=Normal;
                                                     FontName=Arial;
                                                     FontSize=12;
                                                     FontBold=Yes;
                                                     SourceExpr='Database: ' +  DatabaseName }
      }
      CODE
      {
        VAR
          Context@1000000002 : Text[1024];
          ServerName@1000000001 : Text[1024];
          DatabaseName@1000000000 : Text[1024];
    
        BEGIN
        {
          BT001 - 10/06/07 - REQUEST CONFIRMATION BEFORE CLOSING NAVISION
                             THIS FORM RUNS IN AN INVISIBLE STATE AND IS INSTANTIATED BY CODEUNIT 1.
    
          BT002 - 10/06/07 - WARN USER IF ACCESSING A TEST DATABASE
        }
        END.
      }
    }
    

    In CU1 - CompanyOpen() use this code:
      FORM.RUN(50100);
    

    I should add that I've never tried this on a Native Database but I think it should work. I wrote it specifically for our SQL Server installation.

    Hope this helps.

    Headley27
  • hawwahawwa Member Posts: 106
    I use a very simple method. Change the company name in the test db to something that user can easily identified that this is a test company. For example, Company - TESTONLYDB. Company name will always shown on the title bar.
  • bergoullebergoulle Member Posts: 23
    In my company, before each menu we added TEST.
    In that way, users known at any time witch database they are performing.
  • WaldoWaldo Member Posts: 3,412
    If interested ... I wrote a small BLOG about it. You can read it here.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • DeepDeep Member Posts: 569
    I find the best solution to be two separate database servers.
    One your original server, and another one, one anhy local machine, with the name as DUMMY. The company can be renames as DUMMY Company.

    I frequently replace the dummy database with the original database, (and changing the company name)so that the testing people find more data and real data to work upon.
    Regards,

    Deep
    India
Sign In or Register to comment.