Connection problems

twilson

Member²
We are using 3.4.5 DOA and Delphi 5 Enterprise, Our application is working but we seem to have a small problem when connecting (it may also happen elsewhere and this why I have addressed the forum, we think this may also be causing delays with inserts, updates and commits).

Oracle SQLPLUS or Developer 6i forms and reports when logging onto the database take 2-5 seconds to connect, but our app can take anywhere from 15 - 90 seconds to connect this isnt really acceptable. We also noticed that this happens in a product called TOAD.

We have run tests pinging different boxes and tnsping80ing to check connection times and packet loss etc but this is fine, so we have to come back to DOA when making its connection.

Anybody else out there had similar problems or have any solution or have other methods of testing exactly where this delay could be.

Regards
Tony
 
Perhaps Oracle Forms is installed in a different Oracle Home than the Primary Oracle Home that Direct Oracle Access uses by default? You should verify if the sqlnet.ora file from your Primary Oracle Home (\network\admin\sqlnet.ora or \net80\admin\sqlnet.ora) contains a line like this:

SQLNET.AUTHENTICATION_SERVICES=(NTS)

If so, change it to a comment line:

# SQLNET.AUTHENTICATION_SERVICES=(NTS)

Now connection time should be improved considerably.

------------------
Marco Kalter
Allround Automations
 
Thanks for the reply Marko,

Only one oracle_home exists for the installation of oracle reports and it is using NET80. But sqlnet.ora setting rings a bell from something Ive read sometime ago, So I will give it a go and report back.
 
Hmm. Can you create a little test-project that has a new, fresh TOracleSession instance with just default properties (except username, password and database of course) and make sure that just the property assignment OracleSession.Connected := True takes 15 - 90 seconds? If so, what happens for a subsequent disconnect/connect?

------------------
Marco Kalter
Allround Automations
 
Also list what naming method(s) you're using. If you're using hosts naming, then please provide the nslookup times for the host as you may be running into a DNS name resolution problem.
 
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.
 
Back
Top