While most often it is in workgroup installations (i.e. using the Actian/Pervasive workgroup engine, even if installed to a "real" production server) when this error is generated, it can also occur in client-server versions since the 161 means (from Pervasive's status code documentation):
161: The maximum number of user count licenses has been reached
You attempted to open another session when you were at the limit of your user count license. Either close a session or upgrade your user count.
This status code is also returned after a trial or temporary license has expired. If all users receive this error and no one is able to access the database engine, then most likely you have been using a temporary license key and you must now apply a regular license key. Please contact your reseller or Pervasive Software to purchase a regular license.
For more information about purchasing and installing additive user counts, refer to Getting Started With Pervasive PSQL. You can use Monitor to determine which users currently have connections to Pervasive PSQL. For information about Monitor, refer to Advanced Operations Guide.
A 161 however can mean something quite different than the explanation above. In a workgroup situation where the gateway locator has been appropriately set using the Pervasive/PSQL Gateway Locator Utility and the accounting or other software is moved to a different server or gateway PC, this can then lead to the user receiving a 161 until a new "server" gateway assignment is made.
The Gateway Locator Utility (which again, only applies to Actian/Pervasive workgroup configurations and not Actian/Pervasive client-server installations) is located under the utilities section (or can be searched for under PSQL Gateway Locator in Win 8 or just search for gateway).
This utility should be used to assign the PC that "hosts" the software application and needs to point to the data folder where the Pervasive data files are stored. In that folder, it will create a read only file name PVSW (an abbreviation for Pervasive Software) that is enclosed in tildes and that has an LOC extension, i.e.: ~PVSW~.LOC. Designating a PC as gateway then basically allows that designated PC to act more like a server would in a true client-server installation. In other words, the Pervasive workgroup engine has some built-in client-server type capabilities. The locator file can be removed manually only by first removing its read only attribute or by using the Gateway Locator Utility. Removing it would solve the status code 161 but if the gateway locator is not set, then the first PC to open the data files becomes the gateway computer and that can lead to a number of problems (if for example that first PC is then shutdown after other PC's have accessed the data while it was still the "traffic cop"). We would therefore highly recommend always making a gateway assignment when using the Actian/Pervasive workgroup engines.
When migrating the data folder(s) of a system to a new computer, all of the data and related INI files (and usually also the software as well) are naturally going to be copied to that new computer. But this then will pick-up the locator file. Then, when trying to run the software even after deauthorizing and re-authorizing the license via the Pervasive License Administrator, an error 161 may result since it will be the old server/gateway with the deauthorized license that new server/gateway as well as the other workgroup engines will be looking for. If the old server/gateway is off-line, instead of an error/status code 161, a status code 11 (invalid file name) or some other status code might be returned, and it may also take a long time before that error is returned while the database engine/Windows tries to find the old server name.
To resolve, a new gateway assignment needs to be made. The new server name would be entered under "Enter the computer name of the gateway" and this would be run directly on that same computer:
Without re-booting, it should then be possible to run the application that accesses the data files without getting a status code 161 or some other error, both from the gateway PC as well as from other computers with an installed Pervasive workgroup engine (and assuming those other PC's have been pointed to the NEWSERVER name in the Pervasive license administrator which needs to be run on each PC in the workgroup).