Tech Tip: Automatically Adding Files for Replication
Pervasive DataExchange Real-Time Backup Edition (RTB) provides one-way replication of your Pervasive PSQL database files for customers requiring near real-time recovery. Did you know that once you’ve designed and activated a replication network that new files could be included into the network automatically? This is done through a pattern match entry that you create using a DataExchange utility called “Dxdynpath”. This feature can even be called from your application to automatically set-up tables.
Here is an example using Dxdynpath. First let’s review a sample configuration using the test database “DEMODATA” which is provided as part of the Pervasive PSQL database. Let’s assume the following parameters were used in the initial design of the replication network:
DSN Name: DXDemo
Database path c:\pvsw\demodata
Replication Path: c:\pvsw\demodata\DXDemo
New files to replicate: c:\pvsw\demodata\Test.dat
Based on the above information let’s make the following assumptions; we have designed a replication network for all tables located in c:\pvsw\demodata and we have activated our network using a DSN called DXDemo. Now that everything is activated and replicating, we want the replication event handler (REH) to detect when a new table is created. Let’s call the table Test.dat and insert it into our existing data path c:\pvsw\demodata.
From a command line we would use DxDynpath to create a matching pattern:
c:\>dxdynpath /P="dir ..\Test.dat" replace /LOGF= DXDemo
DxDynpath returns an informative message indicating the pattern details that were entered and accepted:
Pervasive DataExchange Dynamic Table Configuration and Test Utility Version 2.80.252.017 for Win32/Intel
Copyright (C) Pervasive Software 1999-2004. All rights reserved.
I 011c 0708-12:21:18 Verifying datasource: DXDemo should exist, have a dCnf table, and be in BRE mode
I 011c 0708-12:21:18 Attempting REPLACE operation on CNF_INCLUDE_PATTERN in dCnf table
I 011c 0708-12:21:18 Writing "dir ..\Test.dat" to CNF_INCLUDE_PATTERN in dCnf table
DxDynpath will also test if the pattern matched based on the information provided. Using the file called Test.dat here is the syntax:
C:\>dxdynpath /F="C:\pvsw\demodata\test.dat" /LOGF= test DXDemo
Pervasive DataExchange Dynamic Table Configuration and Test Utility Version 2.80.252.017 for Win32/Intel
Copyright (C) Pervasive Software 1999-2004. All rights reserved.
I 0a84 0708-12:22:40 Verifying datasource: DXDemo should exist, have a dCnf table, and be in BRE mode
I 0a84 0708-12:22:40 Attempting TEST operation on CNF_INCLUDE_PATTERN in dCnf table
I 0a84 0708-12:22:40 Getting path to DXDemo DSN's dictionary files
I 0a84 0708-12:22:41 Reading from CNF_INCLUDE_PATTERN in dCnf table
I 0a84 0708-12:22:41 Parsing pattern into list
I 0a84 0708-12:22:41 Directory reference is "C:\PVSW\DEMODATA\DXDEMO"
Expression is "dir ..\Test.dat"
File to test is "C:\pvsw\demodata\test.dat"
I 0a84 0708-12:22:41 Resulting regular expression is 'C:\\PVSW\\DEMODATA\\[^\\/]*\.dat'
I 0a84 0708-12:22:41 The match passed
Matches pattern
Note the command key words "replace" and "test". “Replace” means replace the pattern and “test” will verify the pattern match. There are also "append" and "show" command key words. "Append" will append a pattern. "Show" will show pattern(s). Also note the /LOGF= argument. That tells Dxdynpath to output log messages to a standard output.
The Data Replication Engine (DRE) will perform the actual replication of the table and it’s data set from the First Site to the Partner Site. This creation and population occurs during the next two replication cycles or manual replication sessions.
For more information, review the DataExchange User’s Guide here.



