Database Ids

You normally identify a NewViews database by its file, but files can be copied, renamed, or moved. So NewViews also gives each database file an internal database id, which uniquely identifies the file.

When a NewViews file is renamed or moved to another folder, it's internal database id does not change. The advantage is that the workstation can still identify the database. So when the workstation opens the database, it can still open windows and position you exactly where you were the last time you had that particular database open. Of course you will still have to change the database file in the workstation login table to comply to its new location.

Displaying the Database Id of a Particular Database

You can display a database's database id by opening the database and issuing the Help>About command. The database id is displayed in the table for the current NewViews application database, and also for the workstation database. The database id looks something like "020-060-525-085-152". It was given to the database when the database was originally created.

There is also a way to view the database id without opening the database. Using a Command Prompt window, enter the command as shown below:

c:/nv>type my_database.nv2

Internal information about the database is listed in the command prompt window and this information includes the database id (without the hyphens), as shown below:

.warning1 {**************************** WARNING ***************************}
.warning2 {Uncontrolled changes to this file will render NewViews unusable.}
.warning3 {**************************** WARNING ***************************}
.volume {
    .bytes 8404992
    .block_bytes 512
}
.checksum 49983
.odb {
    .version 2.09
    .build 20070918
    .patch_level 0
    .next_index_id 1297
    .next_object_id 123546
    .database_id 20070525085152
    .database_type application
    .blocks 16384
    .inodes {
        .id 1
        .root 2
        .branch_order 64
        .leaf_order 64
        .path /
        .schema {
            .key string
            .amounts .count
        }
    }
    .recovery {
        .id 13
        .blocks 0
    }
    .free {
        .blocks 928
        .head 15456
    }
    .state closed
    .exception {}
}
        

There are reasons you may want to get the database id without opening the database. For example, you might want to check the database id of a backup copy. You really shouldn't attempt to open a backup copy and in any case it probably has a different file type, i.e. not ".nv2". Just typing the file to the command prompt window lets you quickly display the database id.

Other information displayed might also be useful. For example, the .database_type above is application. Other database types are workstation and server. The NewViews version, patch level (service pack number) and release date are also to be found in the displayed information.

Note: Never try to open a NewViews database file with a text editor or any program except NewViews. Doing so may inadvertently modify the file and any such modifications will render the file unusable.

Copying Databases

When a database is created it is given a unique internal id. However, when you copy a database to a different file you end up with two databases that have the same database id.

This is a good thing when you are making a backup copy of a database because its helps identify the database that the backup is a copy of. Also, it allows you to open the backup copy (after renaming it if necessary to change its file type back to ".nv2") with the same window configurations used on the original database and this can be very convenient.

However, instead of creating a new database, a user might copy an existing database just to get the new database up and running faster. The original database could be a demonstration set of books, or a starter database that contains the reports, accounts, and journals used by companies of a particular kind, or in a particular industry. But if you create several databases by making copies of the same original, you end up with more than one database with the same database id.

Having more than one database with the same database id could be confusing because the workstation may attempt to open the same window configurations on two different databases. In addition, you cannot have the same database opened more than once at the same time from the same workstation, and a workstation considers two databases to be the same database if they have the same database id. This is true even if the databases are actually in different files, or if they are on different computers accessed through a server.

Changing a Database Id

You can change the database id of an existing database by running the script database_id_set.qw_script which can be found under c:/nv/nv2.exe/system. Note, we are assuming the NewViews was installed in folder c:/nv. You can run the script from anywhere in NewViews. The only requirements are that the database must be in your computer directory space (i.e. not remote through a server), and that the database cannot be open.

When you run the script you are asked to pick a database from a file explorer. You are then asked for confirmation and the database id is set to a new unique value.

After you set a new database id the workstation will think it is a brand new database that it has never seen before. So the window configurations will be empty and you will be prompted to setup the default window configurations.


Copyright (c) 2003-2025 Q.W.Page Associates Inc., All Rights Reserved.