Lock, Lock, Who's Got The Lock?
Is it Visual PRO/5, PRO/5, PRO/5 Data Server, or BBj?
By Janet Smith
PDF Format

Janet Smith
Technical Support Supervisor
he BBj® configuration defaults to a setting of exclusive locking, which can cause contention issues if Visual PRO/5® or PRO/5® (collectively V/PRO/5) attempts to access the same files. The BASIS Technical Support team often receives questions about how to make BBj and V/PRO/5 share files without causing conflict errors. Additionally, BBj revision 5.x and V/PRO/5 revision 5.x offer several configuration options that tend to increase the complexity.

What configuration options are available?

There are three different configuration options:

  1. BBj clients access files via the PRO/5 Data Server. In this option, BBj clients perform all file access through the PRO/5 Data Server®, thereby using the V/PRO/5 locking scheme, which eliminates the potential for file contention errors with other V/PRO/5 clients. This configuration option is available in every release of BBj.
  2. Visual PRO/5 & PRO/5 clients access the files via the BBj PRO/5 5.0 DS Server. First introduced in BBj revision 4.0, this option is similar to the option listed above in that all clients use the same locking mechanism, however in this case, V/PRO/5 clients access the files through the BBj filesystem. This option eliminates the potential for file contention errors with BBj clients since all clients are using the BBj locking scheme. In addition, new file types become available to V/PRO/5 clients along with BBj-specific features such as triggers and stored procedures.
  3. BBj uses shared locking. Introduced in BBj revision 5.0, this option provides BBj clients access to files using the OS filesystem like the V/PRO/5 style of locking to ensure compatibility with existing V/PRO/5 clients and PRO/5 Data Servers. Refer to The Advantage article The BASIS DBMS - New 5.0 Features for a more in-depth discussion of this configuration option.

What is the difference between a PRO/5 Data Server and the BBj PRO/5 5.0 DS Server that uses the shared locking configuration? Which configuration should I use?

The PRO/5 Data Server is a separate download and installation, requiring its own config.bbx file and separate start-up at the operating system. Use the PRO/5 Data Server when most of the clients use Visual PRO/5 or PRO/5 and only a few clients use BBj or BBj ODBC. If there are a large number of clients connecting to the database, resource consumption will be high and you may consider using the more scalable BBj P5 DS.

The BBj PRO/5 5.0 DS Server (BBj P5 DS) is a component of BBj Services and part of the standard BBj install. Configure this Server in Enterprise Manager along with other BBj Servers such as the Filesystem Server. Use the BBj P5 DS when BBj is at revision 4.0 and higher and V/PRO/5 is at revision 5.0 or higher and 1) when the majority of the clients are BBj with only a few Visual PRO/5 or PRO/5 clients or 2) when new file types and DBMS features are needed or 3) when scalability is important. This solution is more scalable because it is a multithreaded solution versus PRO/5 Data Server's multisession solution.

Shared locking (see Figure 1) enables BBj to use the V/PRO/5 method of file locking though it carries some performance overhead. Use shared locking when the ease of configuration is most important and new features are not required.

Figure 1. BBj share locking

My BBj ODBC configuration uses the PRO/5 Data Server for file access but I receive an !Error=0 when V/PRO/5 tries to access the same record. What is going on?

In addition to file level locking, there is record level locking. All BBx® generations – BBj, Visual PRO/5, and PRO/5 – have the ability to allow multiple read operations to the record level while blocking writes to extracted records. It is important to configure advisory locking in the exact same manner for all BBx products that may access the data files, including ODBC clients and any other Data Servers. Error 0's result when attempting to access the same record without advisory locking set in the same manner for all clients and Data Servers accessing the files. Bottom line – either every component must have advisory locking turned on or none should have it turned on.

How do I set advisory locking for the various products?

There are a few different ways to set advisory locking, depending on the product.

For all BBx Generations
Specific SETOPTS bits in BBj, Visual PRO/5, and PRO/5 control advisory locking. Set these SETOPTS bits either with code using the SETOPTS verb or in the config file.

To determine which SETOPTS bits to set, refer to the online SETOPTS Verb documentation.

For PRO/5 Data Server
Set advisory locking for PRO/5 Data Server in the config file according to the online documentation.

For BBj PRO/5 DS Server
Set advisory locking for BBj P5 DS in the BBj Enterprise Manager. To turn advisory locking on, log in to BBj Enterprise Manager. Right click on BBj Services and select Set Configuration. On the BBj Services Setup dialog, expand PRO/5 5.0 DS Servers and select PRO/5 5.0 DS. Locate Advisory Locking and check the box shown in Figure 2. For more information refer to Configuring BBj Services via the Enterprise Manager in the documentation.

Figure 2. BBj PRO/5 DS Server advisory locking

For BBj ODBC/JDBC Driver
Set advisory locking in the Enterprise Manager for BBj ODBC access. From within the BBj Enterprise Manager, expand the Databases folder as needed, and right click the desired data source. Select Edit Properties to display the Database Properties dialog box. Locate Advisory Locking and check the associated box shown in Figure 3.

Figure 3. BBj ODBC/JDBC Driver advisory locking