Overview
Users may encounter an access violation error when launching Toad for Oracle that has been deployed as a FlexApp package. The application crashes immediately on startup and does not load. This issue is caused by conflicting or incorrect Oracle client environment variables and can be resolved by correcting the 32-bit and 64-bit Oracle environment variable configuration on the affected desktop.
Symptoms
Users experience one or more of the following:
- Toad for Oracle fails to launch immediately after the splash screen or before it appears
- An error dialog is displayed containing: Access violation at address [address] in module 'Toad.exe'. Read of address [address]
- The error occurs during Delphi runtime initialization, referencing internal modules such as System._IntfCopy or QBCodeGenerator
- Only specific users are affected while others in the same environment launch Toad successfully
- The application error dialog includes a Click Here button which displays a detailed call stack
Environment
- Product: FlexApp
- Application: Toad for Oracle (Quest Software)
- Operating System: Windows 10 / Windows 11 / Windows Server 2022
- Deployment Type: FlexApp package (VHD/VHDX layered delivery)
Root Cause
Toad for Oracle is a Delphi-based application that depends on Oracle client libraries to initialize correctly. When Oracle Client is installed in both 32-bit and 64-bit variants, Windows uses system environment variables (such as ORACLE_HOME, TNS_ADMIN, and PATH) to resolve which Oracle libraries are loaded at runtime.
When these environment variables are misconfigured — for example, pointing to mismatched client versions, incorrect paths, or conflicting 32-bit and 64-bit entries — Toad's Delphi runtime attempts to bind to incompatible library code during startup. This causes an access violation before the application fully initializes.
Because FlexApp delivers the application layer at logon, any environmental inconsistency present on the base OS or user session is exposed during application initialization. Users whose machines have incorrect Oracle environment variables will consistently reproduce the crash, while users with correctly configured variables will not.
Resolution
Correct the Oracle 32-bit and 64-bit environment variables on the affected machine(s).
Step 1: Identify the Oracle Client Installations
- Open File Explorer and confirm the installation paths for both Oracle Client versions, for example:
- 32-bit: C:\Oracle\product\12.2.0\client_32\
- 64-bit: C:\Oracle\product\12.2.0\client_64\
Step 2: Update System Environment Variables
- Open System Properties > Advanced > Environment Variables
- Under System Variables, verify or correct the following:
| Variable | Expected Value |
|---|---|
| ORACLE_HOME | Path to the 64-bit Oracle Client (e.g., C:\Oracle\product\12.2.0\client_64) |
| TNS_ADMIN | Path to the network\admin folder containing tnsnames.ora |
| PATH | Must include both the 32-bit and 64-bit Oracle bin directories, with the 64-bit path listed first |
- Remove any duplicate, stale, or incorrect Oracle path entries from PATH
- Ensure no user-level environment variables override the system-level Oracle settings incorrectly
Step 3: Validate and Test
- Log the affected user off the desktop completely
- Log back on to allow FlexApp to reattach the Toad package in the corrected environment
- Launch Toad for Oracle and confirm the access violation no longer occurs
Addressing Oracle Environment Variables at Capture Time (FlexApp Packaging Console)
If you are building or rebuilding the Toad for Oracle FlexApp package, the Oracle Client environment variables can be embedded directly into the package or enforced via a post-activation script during the capture process. This ensures that correct Oracle path configuration travels with the package, rather than relying solely on the base OS configuration of each endpoint.
There are two approaches within the FlexApp Packaging Console (FPC):
Option A: Edit the Captured Registry in an Existing Package
If the package has already been captured and you need to correct or add Oracle environment variable entries without recapturing, you can edit the registry content of the package directly using the Edit Package function.
- In the FlexApp Packaging Console, locate the Toad for Oracle package
- Click the Edit (pencil) icon or select Edit Package from the package action drop-down
- In the Edit a Package screen, expand Registry and navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
- Verify the ORACLE_HOME, TNS_ADMIN, and PATH values present in the captured layer
- Add or correct the values as needed to reflect the proper 32-bit and 64-bit Oracle Client paths
- Click Save to write the changes back to the package
| Important: Changes made via Edit Package modify the content of the captured VHDX directly. Test the updated package on a clean snapshot or UAT desktop before deploying to production. |
Option B: Use a Post-Activation Script to Set Environment Variables at Runtime
If Oracle Client paths may differ across desktops (for example, different drive letters or Oracle versions per site), a post-activation script can be used to dynamically set environment variables each time the Toad package is activated.
- In the FlexApp Packaging Console, activate the Toad for Oracle package (click Play)
- Once active, click the package action drop-down and select the Scripts (abc) icon
- Click Add Script and configure as follows:
- Script Location: Select the directory containing your .cmd or .bat script
- Script Type: Select Post Activation
- Script Context: Select the appropriate context (typically appdir-1 or System)
- Click OK to attach the script to the package, then OK again to save
Example post-activation script (set_oracle_env.cmd):
@echo off REM Set Oracle Client environment variables for Toad for Oracle setx ORACLE_HOME "C:\Oracle\product\12.2.0\client_64" /M setx TNS_ADMIN "C:\Oracle\product\12.2.0\client_64\network\admin" /M
REM Append Oracle bin paths to system PATH (64-bit first, then 32-bit) for /f "tokens=2*" %%A in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path 2^>nul') do set CURRENT_PATH=%%B setx PATH "C:\Oracle\product\12.2.0\client_64\bin; C:\Oracle\product\12.2.0\client_32\bin;%CURRENT_PATH%" /M |
Product: FlexApp Application: Toad for Oracle (Quest Software) Version: 6.8.x