Pervasive PSQL Architecture Overview
Dual Engine Model
Pervasive PSQL operates with two engines: the MicroKernel Engine (MKDE) for ISAM-based data access, and the SQL Relational Engine (SRDE) for SQL access. Issues often arise from contention or mismatches between these engines—especially when both access the same datasets simultaneously.
File-Based Storage and Locking
The database relies on file-based data storage and record-level locking. When integrated with modern OS-level features like network shares or cloud sync folders, it can lead to locking inconsistencies or data corruption.
Common Troubleshooting Scenarios
1. Btrieve Status Codes and Misleading Errors
Errors such as Status 2 (I/O Error) or Status 85 (file in use) often mask deeper filesystem or permission issues. Root causes include:
- Antivirus interference with .MKD or .DDF files
- File locking conflicts over SMB/NFS
- Permission elevation discrepancies on Windows
2. Transactional Deadlocks
In multi-user environments, improper transaction design or excessive long-lived locks can lead to frequent deadlocks, manifesting as Status 78 (deadlock detected). These typically arise from:
- Mixing SQL and Btrieve operations without isolation level planning
- Uncommitted transactions across sessions
- Bad application retry logic
3. ODBC Connection Failures
Connection issues via ODBC drivers may show vague errors like "Unable to connect to data source." Common causes:
- Incorrect DSN configuration or mismatched 32/64-bit drivers
- SRDE engine not running or improperly licensed
- Firewall or TCP port restrictions on remote access (port 1583)
Diagnostic Techniques
Enabling MKDE Trace Logs
pvlocate.exe pvstop.exe set MKDE_LOG_PATH=C:\logs\mkdelog.txt pvstart.exe
This captures detailed low-level access patterns and status codes from the MicroKernel engine.
SQL Query Logging
Enable verbose SQL logs by setting the environment variable:
SET PSQL_SQL_LOG=C:\logs\sqltrace.log
Useful for identifying performance issues, bad joins, or unsupported syntax triggering internal errors.
Remediation Strategies
1. Resolving Status Code Errors
- Whitelist database paths in antivirus configurations
- Ensure exclusive file access when restoring or copying .MKD files
- Map network drives using consistent drive letters and full permissions
2. Preventing Transaction Deadlocks
- Design transactions to be short and atomic
- Enforce consistent access order of tables across sessions
- Use
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
to reduce contention
3. Fixing ODBC and Client Connectivity
- Ensure driver bitness matches application architecture
- Test SRDE availability with
psql -u
utility - Allow port 1583 on both server and client firewalls
Best Practices for Enterprise Stability
- Use PSQL Control Center to manage and monitor engine status
- Automate nightly consistency checks using
BUTIL -STAT
and-CL
options - Always backup .MKD, .DDF, and .VAL files together
- Avoid using file-sync tools like OneDrive or Dropbox on live database files
Conclusion
Pervasive PSQL remains a critical component in many enterprise stacks, particularly in legacy ERP and vertical applications. However, its unique dual-engine model, file-based storage, and legacy integration paths create troubleshooting challenges that require methodical analysis and deep platform familiarity. By applying structured diagnostics, carefully planned access patterns, and isolation-aware transaction design, organizations can maintain operational integrity and modernize their data systems with confidence.
FAQs
1. What does Status Code 2 indicate in Pervasive PSQL?
It means an I/O error, often stemming from filesystem issues, antivirus interference, or improper access permissions on database files.
2. Can I mix SQL and Btrieve access in the same application?
Yes, but it must be done with care—particularly around transaction boundaries and locking behavior to avoid deadlocks or data anomalies.
3. How do I test if the SRDE is active?
Use the command-line tool psql -u
to test SQL connectivity. Ensure the SQL engine is installed, licensed, and not blocked by firewall rules.
4. Are PSQL backups safe using file copy?
Only if all database-related files are copied when the engine is stopped. Live backups should use tools like BUTIL or VSS to ensure consistency.
5. What ports does Pervasive PSQL use for remote access?
Primarily TCP port 1583. Ensure this is open and not blocked by firewalls or endpoint security solutions.