KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D for Oracle on Windows: The Oracle DLL & 4D for Oracle Preferences
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: September 10, 1999

The Windows Preferences file for the 4D for Oracle Plug-In is stored in your system's 4D Folder (%SystemRoot%\4D\, where %SystemRoot% is the folder on your hard drive where you have installed your Microsoft Windows (95/98/NT) Operating System). The first time you launch an application that uses the 4D for Oracle Plug-in, 4D will look in this folder for a file called "ORAV6Prf.RSR". If 4D is unable to find this file, you will be presented with a dialog box asking you to locate the Oracle DLL:



The precise name of the DLL depends on which version of the Oracle Client Libraries are installed on the computer. In the dialog box above, the name "ORA72.DLL" is suggested, but your DLL might be named ORA73.DLL, ORA803.DLL, ORA805.DLL, etc.

If an end-user were to see this dialog box, they might become alarmed or confused. In all likelihood, they have no idea where to find this DLL. Fortunately, a cursory examination of the ORAV6Prf.RSR file exposes its secret: it is just a standard Resource File, loaded with 'STR ' resources. Using standard 4D Commands, you can read and write to the contents of this file:

With some changes to the 4D method above, you can easily write data to the preferences file (using SET STRING RESOURCE) to specify whatever DLL name you need. Additionally, you can specify usernames and passwords for Oracle Servers using this method. You may cut and paste the code below into your own 4D application:

Cut and Paste the following code example into your
own 4D project

C_TIME($hResourceFile)
C_STRING(4;$sResourceType)
C_LONGINT($iResourceNumber;$iResourceCount)
C_TEXT($tFilePath;$tMessage)

If (Env_PlatformIsWindows )
 $tFilePath:=4D folder+"ORAV6Prf.RSR"
Else
 $tFilePath:=4D folder+"ORAV6Prf"
End if

If (Test path name($tFilePath)=Is a document )

 $hResourceFile:=Open resource file($tFilePath)

 If (OK=1)

  $sResourcetype:="STR " `note the 4th character is a space

  ARRAY INTEGER($aiResourceID;0)
  ARRAY STRING(255;$asResourceDescription;0)

  RESOURCE LIST($sResourceType;$aiResourceID;$asResourceDescription;$hResourceFile)

  $iResourceCount:=Size of array($aiResourceID)

  ARRAY STRING(255;$asStringList;$iResourceCount)

  For ($iResourceNumber;1;$iResourceCount)
   $sString:=Get string resource($aiResourceID$iResourceNumber;$hResourceFile)
   $asStringList$iResourceNumber:=$sString
   $tMessage:="Resource ID: "+String($aiResourceID$iResourceNumber)
   $tMessage:=$tMessage+Char(Carriage return )+"Value: "+$sString
   ALERT($tMessage)
  End for

 End if

 CLOSE RESOURCE FILE($hResourceFile)

End if