See Also: Load_Driver
Unloads a loaded database driver.
Unload_Driver driverName
Where driverName is the name (string) of the database driver. The names of drivers available from Data Access Worldwide are:
"DATAFLEX" for the embedded database
"DB2_DRV" for the DB2 Driver
"DFBTRDRV" for the Pervasive.SQL Driver
"MSSQLDRV" for the Microsoft SQL Driver
"ODBC_DRV" for the ODBC Driver
The Unload_Driver command unloads the specified driver from memory, which may release some system resources. It will also close any open files that use driver driverName.
Note that you do not need to use this command; if your program terminates without unloading drivers, you will not receive an error message.
Unload_Driver "MSSQLDRV"
In this example, all MS SQL tables are closed, all server connections for that driver are terminated, and the driver is deinitialized.
When a driver is unloaded, the number of drivers (DF_NUMBER_DRIVERS) is decremented immediately and all drivers numbered higher are automatically decremented. So this code does not work:
Integer iDriverCount iDriver
String sName
Get_Attribute DF_NUMBER_DRIVERS to iDriverCount
For iDriver From 1 to iDriverCount
Get_Attribute DF_DRIVER_NAME of iDriver to sName
If (sName <> "DATAFLEX") Begin
Unload_Driver sName
End
Loop
while this code does:
Integer iDriver iDrivers iDriverCount iDriversToUnload
String sName
String[] sDriversToUnload
Get_Attribute DF_NUMBER_DRIVERS to iDriverCount
For iDriver from 1 to iDriverCount
Get_Attribute DF_DRIVER_NAME of iDriver to sName
If (sName <> "DATAFLEX") Begin
Move sName to sDriversToUnload[iDriversToUnload]
Increment iDriversToUnload
End
Loop
For iDriver from 0 to (iDriversToUnload-1)
Unload_Driver sDriversToUnload[iDriver]
Loop
The embedded database ("DATAFLEX") driver is always loaded and cannot be unloaded.
It is not necessary to unload one driver before loading another; multiple drivers can be loaded at the same time.