Legacy Application Modernization: Key Steps, Benefits & Best Practices
This blog post was co-authored with Riaz Merchant, President and CEO at Mertech. In the fast-paced software world, 'legacy' often signals a warning.
Sometimes an error occurs (Error loading driver! in the screenshot below) when you select the target server in the BTR2SQL Migration Utility Login dialog box or the Migration Utility closes unexpectedly.
The most likely cause is that a BTR2SQL driver is not in the expected location, or there is a problem with the SQL client installation.
When you make a server selection, the BTR2SQL Migration Utility loads one of four migration drivers (sql_btr.dll, mys_btr.dll, ora_btr.dll, or pgs_btr.dll). By default, the Migration Utility looks for these dlls in the installation folder (typically <Program Files>\Mertech Data Systems\DB Drivers\Btrieve\bin). The Migration Utility also expects to find a valid license file (sql_btr.cfg, mys_btr.cfg, ora_btr.cfg, or pgs_btr.cfg) in that same folder.
Additionally, the Migration Utility requires a 32-bit client driver that matches your selected SQL server and the client driver may have other dependencies such as the C runtime libraries.
If any of these items are not found on the system PATH, Windows fails to load the Mertech dll.
Selected Server | Required 32-bit Client | Comments |
MS SQL Server | Microsoft SQL Native Client | The MSSQL client is included with the BTR2SQL installation. |
MySQL | MySQL Client | A client libmysql.dll is available in <Program Files>\Mertech Data Systems\DB Drivers\Btrieve\bin. The version of the installed client must match the version of the server. |
Oracle | Oracle Client (including Instant Client) | Requires OCI.dll, which may have other dependencies. All of these should be included with the client software. |
PostgreSQL | PostgreSQL Client | ClientDlls are installed in <Program Files>\Mertech Data Systems\DB Drivers\Btrieve\clients\pgsql and can be copied to the System32 directory. The version of the installed client must match the version of the server. See also BTR2SQL error accessing the PostgreSQL server v 9.1, v 9.2 and v 9.3. |
First and foremost, be sure the appropriate 32-bit client is installed and that the client and server version numbers match and are supported by BTR2SQL. You can develop 64-bit applications, and if so 64-bit libraries are available from Mertech. However, the Migration Utility requires the 32-bit client to be installed. If a 64-bit client is installed the Migration Utility may close unexpectedly when you attempt to login.
Note: Missing Oracle dependencies may be resolved by installing the Visual C++ 2010 Redistributable package. (https://www.microsoft.com/en-US/download/details.aspx?id=8328)
Below are several options to help identify the exact cause of the problem.
Note: Be sure to turn off tracing otherwise you will experience performance degradation.
Check for the trace file that you specified earlier. If it exists, it will be small and should have information about the cause of the failure. If the trace file was not created, the driver was not loaded, most likely because a dependency is missing.
An extract from a trace file is shown below. Lines highlighted in blue show where dlls were successfully loaded. Lines highlighted in red show an attempt to locate the license file first in the installation\bin directory and then in each directory listed in the Windows PATH.
A good tool to locate a missing dependency is Dependency Walker, which can be downloaded from www.dependencywalker.com. Since the Mertech driver and migration application are 32-bit, make sure to install the 32-bit version of Dependency Walker.
Missing or mismatched dependencies appear in yellow or red. The most common dlls to be missing are libmysql.dll and oci.dll (as shown in the screenshot below).
Process Monitor can also be used to do identify statically and dynamically loaded dlls. Download Process Monitor from https://technet.microsoft.com/en-us/sysinternals/processmonitor.
8. Enable event capture: select File from the menu bar and select Capture Events so IT IS checked.
9. Start the BTR2SQL Migration Utility and reproduce the error.
10. Disable event capture in the Process Monitor: select File from the menu bar and select Capture Events so it IS NOT checked.
11. Examine the output, looking in particular for NAME NOT FOUND.
12. In the example below, OCI.dll is not found in the BTR2SQL bin folder, nor can it be located anywhere on the system PATH.
There is also a startup trace file to record errors detected during the early stages of driver initialization. The startup trace is automatically turned on and then turned off after successful driver connection.
The startup trace file is named "mds_.log" (for example, mds_ora_btr.log, mds_sql_btr.log, mds_mys_btr.log, mds_pgs_btr.log) and is always written to %temp%.
Note: Always use Windows Start | Run "%temp%" to navigate to the temp folder rather than manually going to what you *think* is the temp folder. Look for error messages in the trace file. The type of errors captured includes:
This blog post was co-authored with Riaz Merchant, President and CEO at Mertech. In the fast-paced software world, 'legacy' often signals a warning.
This post was co-authored with Riaz Merchant, President/CEO at Mertech Data Systems, Inc.
Shifting from your traditional legacy systems to the Cloud can be a game changer, as the benefits of cloud migration are numerous. Cloud computing...