Subject Closing connection to DB
Author Michael Vilhelmsen <Michael.Vilhelmsen@M
Hi

I have a program, which OnShow opens a DB.
It read some values, and updates 1 field.

The DB Contains only 1 table with 25 fields.

Connecting to the DB happens immidially.
But closing the connection takes up to 5 seconds !
This is especially true, if the DB is running locally.

To open I do this:

DMMain.DBLicens.Params.Clear;
DMMain.DBLicens.Params.Add('USER_NAME='+'OCCLICENS');
DMMain.DBLicens.Params.add('PASSWORD='+'OCCLICENS');
DMMain.DBLicens.DatabaseName := frmVaelgDB.cbDB2Navn.Text;
DMMain.DBLicens.Open;


To close I do this:

// To commit every open transactions, eventhough I have already
commited the only one active.
try
for trTeller:=0 to DMMain.dbLicens.TransactionCount-1 do
begin
if (DMMain.dbLicens.Transactions[trTeller].Active) then
DMMain.dbLicens.Transactions[trTeller].Commit;
end;
except
ShowMessage('Davs 1');
end;
// Closing the connection. Takes up to 5 seconds.
try
if (DMMain.dbLicens.Connected) then
DMMain.dbLicens.Close
except
ShowMessage('Davs 2');
end;


Any suggestions ?

Michael