Created a test application that justs logs onto the database passing OSConnection.connected := true when username, password, database are not null,
all other properties were left as default.
It took 45 seconds to gain the connection first time, subsequent logins take from 10 secs to 20 on a development box. Im taking the test app to the server next to test.
Heres the connection code:-
procedure TFrmLogin.dbsConnect;
var Client_Info: string;
begin
//Update the counter, set messages and refresh
inc(Login_Attempts);
wrsmain.ledconnect.value := true;
lblMessage.Width := gbMessages.width - 10;
{Connect to the local database server & then
activate the tables + set all other
required components as this will
be required to progress through the application.
Handle any exceptions, dealing with connecting
to the database & activating the table + resetting
components as they were before connect. }
Screen.Cursor := crHourGlass;
if Login_Attempts < Max_Attempts_Allowed then
begin
wrsmain.StatusBar.Panels.Items[0].Text := STATUS_TEXT0 +
'Connecting To The Database, Please Wait...';
lblMessage.Caption := 'Attempting to access the ' +
rgLocation.Items[rgLocation.ItemIndex] +
' RDBMS.' + #13 + 'Please wait...';
refresh;
//------------------ Set database parameters before ---------------
//------------------ trying to conect -----------------------------
rs35dm.osConnection.LogonDatabase := rgLocation.items[rgLocation.itemIndex];
rs35dm.osConnection.LogonUsername := edtUserName.Text;
rs35dm.osConnection.LogonPassword := edtPassword.Text;
try
begin
{ Look after the Database & activate main Tables }
rs35dm.osConnection.Logon;
wrsmain.ledconnect.TrueColor := clyellow;
sleep(500);
sql_user_rdb := rgLocation.items[rgLocation.itemIndex];
ReportsType := rgReports.Items[rgReports.itemIndex];
wrsmain.DRLabel1.caption := '[ '+sql_user_rdb+' ] [ ' + ReportsType + ' ]';
rs35dm.SetReportType;
wrsmain.chkdir;
rs35dm.enable_tables;
{ Look After menu & form Components }
wrsmain.DisDatabase1.visible := True;
wrsmain.ConDatabase1.visible := False;
wrsmain.ConDatabase1.enabled := False;
wrsmain.dbnavigator.visible := True;
wrsmain.Print1.enabled := True;
wrsmain.sbIncome.enabled := True;
wrsmain.sbComplete.enabled := True;
wrsmain.Panel1.Visible := True;
wrsmain.SBPrint.Enabled := True;
wrsmain.sbIncome.Click;
wrsmain.sbOpenRPC.enabled := True;
wrsmain.sbResubmit.Visible := True;
wrsmain.StatusBar.Panels.Items[0].Text := STATUS_TEXT0;
currentLogin := edtUserName.Text;
currentPassword := edtPassword.Text;
LoggedIn := True;
self.hide;
self.close;
wrsmain.writetolog('Interface Started :','WRS Started at '+ FormatDateTime('DD-MM-YYYY HH:MM',now)+ #13);
wrsmain.writetolog('Interface Started :','User ['+currentlogin+
'] started processing ' + ReportsType + ' reports on ['+sql_user_rdb+
'] on '+ FormatDateTime('DD-MM-YYYY HH:MM',now)+ #13);
//If we are here then everything is ok so read the relevant setup variables in
//from the registry
if ReportsType = 'Labels' then
begin
wrssetup.sePPInc.Value := EasyReg4.ReadInteger('SIncome');
wrssetup.sePPCom.Value := EasyReg4.ReadInteger('SCompleted');
wrssetup.sePPMin.Value := EasyReg4.ReadInteger('SMin');
wrssetup.sePPMax.value := EasyReg4.ReadInteger('SMax');
end
else
begin
wrssetup.sePPInc.Value := EasyReg5.ReadInteger('SIncome');
wrssetup.sePPCom.Value := EasyReg5.ReadInteger('SCompleted');
wrssetup.sePPMin.Value := EasyReg5.ReadInteger('SMin');
wrssetup.sePPMax.value := EasyReg5.ReadInteger('SMax');
end;
wrssetup.SpinChange;
end;
except
on E: EOracleError do
begin
Screen.Cursor := crDefault;
if (rs35DM.osConnection.Connected) then
rs35dm.disable_tables;
lblMessage.Caption := 'Connection Failed ' +
rgLocation.Items[rgLocation.ItemIndex] +
' RDBMS.';
lblMessage.Caption := lblMessage.Caption + #13 + e.message;
//lblMessage.Caption := lblMessage.Caption + #13 + e.Errors[1].message;
wrsmain.writetolog('Interface Login :','Error :-'+#13+lblMessage.Caption+#13);
sleep(1500);
LoggedIn := False;
currentLogin := '';
currentPassword := '';
wrsmain.ledconnect.TrueColor := clred;
wrsmain.ConDatabase1.visible := True;
wrsmain.ConDatabase1.enabled := True;
wrsmain.DisDatabase1.visible := False;
wrsmain.dbnavigator.visible := False;
wrsmain.sbOpenRPC.enabled := False;
wrsmain.sbIncome.enabled := False;
wrsmain.sbComplete.enabled := False;
wrsmain.sbPrint.enabled := False;
wrsmain.Print1.enabled := False;
wrsmain.Panel1.Visible := False;
wrsmain.sbResubmit.Visible := False;
rs35dm.osConnection.Logoff;
wrsmain.ledconnect.value := False;
end;
end;
Screen.Cursor := crDefault;
//-------------
end;
if Login_Attempts = Max_Attempts_Allowed then
begin
//Kick the user out of the system.
Sleep(1500);
wrsmain.ledconnect.TrueColor := clred;
lblMessage.Caption := 'You have exceeded the maximum login attempts.';
wrsmain.writetolog('Interface Login :','Security :-'+lblMessage.Caption+#13);
wrsmain.ConDatabase1.visible := True;
wrsmain.ConDatabase1.enabled := True;
refresh;
Login_Attempts := 0;
sleep(3000);
wrsmain.ledconnect.value := False;
currentLogin := '';
currentPassword := '';
self.close;
end;
//Its now ok to set the DBMS_Application_info
Client_Info := Application.Title +' - '+ReportsType;
rs35dm.OSConnection.DBMS_Application_Info.Set_Client_Info(Client_Info);
end;
I did comment out the writing to the log file in the test, just in case that may be causing problems. No change.
Eric^2 we are using dns and tnsnames, no host file. But as already stated using just sqlplus or oracle reports gives a connection under or around 3 secs every time.
Will report what happened on the server shortly.