DBConvert for FoxPro & MSSQL: Troubleshooting Common IssuesDBConvert for FoxPro & MSSQL is a widely used tool for migrating and synchronizing data between Visual FoxPro (DBF) and Microsoft SQL Server. While powerful and flexible, users can run into issues related to connectivity, data mapping, performance, and character encoding. This article walks through common problems, how to diagnose them, and practical fixes to get migrations running smoothly.
1. Connection problems
Common symptoms: inability to connect to source or target, authentication errors, or timeouts.
- Verify connection parameters:
- Server name/IP, port, database name (for MSSQL).
- For FoxPro, ensure the DBF files are accessible and the folder path is correct.
- Authentication:
- For MSSQL, confirm whether you should use SQL Server Authentication (username/password) or Windows Authentication. If using Windows Authentication, run DBConvert under an account with appropriate permissions or use a service that supports integrated auth.
- ODBC/Drivers:
- Ensure the correct ODBC driver is installed for Visual FoxPro (VFP ODBC Driver) and for MSSQL (SQL Server Native Client / ODBC Driver ⁄18+). Mismatched or missing drivers often cause connection failures.
- Network and firewall:
- Make sure the SQL Server allows remote connections and the firewall permits the SQL port (default 1433). Test connectivity with ping and telnet (or Test-NetConnection on Windows PowerShell).
- Common fixes:
- Test connections with external tools (SQL Server Management Studio for MSSQL; a simple script or DBF viewer for FoxPro).
- Use IP instead of server name to rule out DNS issues.
- Confirm the account has the required privileges to access the database and tables.
2. Authentication and permissions errors
Symptoms: “Login failed”, “Access denied”, or operations failing due to insufficient rights.
- MSSQL permissions:
- Ensure the SQL account has rights to the target database: CREATE TABLE, INSERT, UPDATE, DELETE, SELECT, ALTER, and schema modification if DBConvert needs to create tables.
- For schema creation, the account may need db_owner or db_ddladmin roles temporarily.
- File permissions for FoxPro:
- The account running DBConvert must have read (and possibly write) access to the folder containing .dbf files and related memo (.fpt) or index (.cdx) files.
- Tips:
- Temporarily elevate privileges to confirm permission-related failures.
- Check SQL Server logs for detailed authentication failure reasons.
3. Data type mapping and conversion issues
Symptoms: truncated data, conversion errors, or unexpected NULLs.
- Understand default mappings:
- FoxPro numeric/date/memo fields map differently to MSSQL types. For example, VFP Character → SQL VARCHAR/NVARCHAR; Logical → BIT; Date → DATE; DateTime → DATETIME or DATETIME2.
- Common pitfalls:
- Precision/scale loss for numeric fields — VFP numeric fields mapped to SQL DECIMAL with insufficient precision will truncate values.
- Memo (FPT) fields may be mishandled if target columns are too small.
- Logical fields with non-standard values can convert improperly.
- How to resolve:
- Review and customize mappings in DBConvert before running migration. Explicitly set target types and sizes where needed.
- Pre-create target tables with exact schema you require, then map DBF fields to those columns.
- Use VARCHAR vs NVARCHAR based on encoding (see encoding section).
- Example: If a VFP Numeric(18,2) is mapped to DECIMAL(10,2) in MSSQL, increase precision to DECIMAL(18,2) to prevent truncation.
4. Character encoding and international characters
Symptoms: garbled text, question marks, or loss of diacritics.
- FoxPro encoding:
- DBF files may use OEM, Windows-1251, or other codepages. Determine the code page used when the DBF was created.
- MSSQL collation:
- If target columns use a collation that doesn’t support needed characters, data will be corrupted.
- Fixes:
- In DBConvert, explicitly set the source encoding (code page) and target encoding (UTF-8/UNICODE/NVARCHAR). Prefer Unicode (NVARCHAR) on SQL Server when possible.
- If changing collation, use a collation that supports the language (e.g., Cyrillic: Cyrillic_General_CI_AS).
- Test with a subset of records to verify correct character mapping before full migration.
5. Performance issues and slow migrations
Symptoms: long runtimes, high CPU or disk usage, or bottlenecks.
- Factors that slow migration:
- Large volumes of data, network latency, inefficient indexing, or using single-row inserts instead of batch operations.
- Solutions:
- Use batching: DBConvert supports batch sizes — increase batch size where memory permits.
- Disable indexes and triggers on the target during bulk load and rebuild them after migration.
- Use native DB drivers and fast network connections; run migrations from a machine close to the SQL Server.
- Consider migrating during low-usage windows.
- Monitoring:
- Watch SQL Server Activity Monitor and disk I/O; adjust accordingly.
- Use transaction logging settings: consider simple recovery model during bulk loads, then revert to full if needed.
6. Referential integrity and foreign keys
Symptoms: failures when inserting child rows due to missing parent keys or constraint violations.
- Order of operations:
- Migrate parent tables before child tables, or temporarily disable foreign key checks on the target.
- Options:
- Disable constraints during migration, then re-enable and validate after load.
- Ensure identity columns are handled correctly (set IDENTITY_INSERT ON when inserting explicit identity values).
- Validation:
- After migration, run queries to check for orphaned child records or violated foreign keys.
7. Handling nulls and default values
Symptoms: unexpected NULLs or defaults in target tables.
- FoxPro specifics:
- VFP can store blank strings, zero values, or special NULL markers depending on version and schema.
- Mapping strategy:
- Decide how to map FoxPro blank/missing values: to SQL NULL, empty string, or default value.
- Configure DBConvert mappings to convert blanks to desired target values.
- Verify after a small run and adjust mapping rules as needed.
8. Errors during schema synchronization
Symptoms: mismatched columns, errors creating or altering tables, or skipped fields.
- Causes:
- Reserved keywords in MSSQL used as column names in FoxPro.
- Unsupported characters in field names.
- Differences in allowed lengths/types.
- Remedies:
- Pre-create schema on MSSQL using sanitized names and explicit types.
- Use DBConvert’s field mapping and renaming features.
- Avoid using SQL reserved words as column names; wrap names in brackets if unavoidable.
9. Transaction log growth and space issues
Symptoms: SQL Server transaction log grows rapidly during migration, filling disk.
- Why it happens:
- Bulk inserts in Full recovery model generate large logs.
- Solutions:
- Switch database to Simple recovery model for the migration (if acceptable), or take periodic transaction log backups.
- Use smaller transactions/batches to limit log growth.
- Monitor log file size and free disk space during migration.
10. Troubleshooting steps and best practices
- Start small:
- Migrate a subset of tables/rows first to validate mappings, encoding, and performance.
- Use logs:
- Enable detailed logging in DBConvert and review error messages. They often point directly to field-level issues.
- Iterate:
- Fix mapping or schema issues, then re-run on the subset before scaling up.
- Backup:
- Always back up target databases before major operations.
- Document:
- Keep notes of mapping decisions and scripts used for schema changes so the process can be reproduced or audited.
- Automation:
- For repeated syncs, use DBConvert’s scheduling and synchronization features after verifying an initial full migration.
11. Sample checklist before full migration
- Confirm ODBC/drivers installed and connections tested.
- Verify account permissions and file access.
- Define and pre-create target schema where needed.
- Set correct encodings and collations.
- Plan batching and disable indexes/triggers if bulk-loading.
- Check recovery model and transaction log strategy.
- Run a trial migration for representative data.
- Validate data counts, checksums, and sample records.
If you have a specific error message or log excerpt from DBConvert, paste it here and I’ll give targeted steps to resolve that issue.
Leave a Reply