Page 1 of 1

Cannot disable auto reconnect

Posted: Thu 18 Feb 2016 07:54
by uno
Hello,
If oracle session has been killed, reconnect occurs when I set TSQLStoredProc.ProcedureName

Found this http://forums.devart.com/viewtopic.php? ... ect#p92780

To disable auto-reconnecting to the server, you should set the Reconnect parameter to False

SQLConnection1.Params.Values['Reconnect'] := 'False';


but that does not work for me
version 5.1.3.0 delphi xe2

Thanks

Re: Cannot disable auto reconnect

Posted: Mon 22 Feb 2016 13:12
by AlexP
Hello,

The Reconnect parameter is only responsible for connection when the connection is broken. As I wrote earlier, the error occurring when setting a procedure name is restrained inside DBExpress in the TCustomSQLDataSet.SetParamsFromProcedure method and is not transmitted to the outside.

P.S. dbExpress driver for Oracle 6.7.1

Re: Cannot disable auto reconnect

Posted: Wed 24 Feb 2016 07:58
by uno
Connection is broken (session is killed from another session)
Reconnect parameter is set to False

but connection is established again

is there a way to prevent reconnectiong? what do i do wrong?

Re: Cannot disable auto reconnect

Posted: Wed 24 Feb 2016 09:25
by AlexP
We can't reproduce this behavior on the latest driver version 6.7.11. Please execute the following code and let us know the result.

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  SysUtils,
  SqlExpr,
  DB,
  DBXDevartOracle;

var
  SQLConnection, SQLConnectionKill: TSQLConnection;
  SQLQueryKill: TSQLQuery;
  SQLStoredProc: TSQLStoredProc;

begin
  SQLConnection := TSQLConnection.Create(nil);
  try
    SQLConnection.LibraryName := 'dbexpoda40.dll';
    SQLConnection.DriverName := 'DevartOracle';
    SQLConnection.GetDriverFunc := 'getSQLDriverORA';
    SQLConnection.VendorLib := 'oci.dll';
    SQLConnection.Params.Values['Reconnect'] :=  'False';

    SQLConnection.LoginPrompt := false;
    SQLConnection.Params.Add('Database=orcl');
    SQLConnection.Params.Add('User_Name=scott');
    SQLConnection.Params.Add('Password=tiger');
    SQLConnection.Connected := true;
    SQLStoredProc := TSQLStoredProc.Create(nil);
    try
      SQLStoredProc.SQLConnection := SQLConnection;
      SQLConnectionKill := TSQLConnection.Create(nil);
      try
        SQLConnectionKill.LibraryName := 'dbexpoda40.dll';
        SQLConnectionKill.DriverName := 'DevartOracle';
        SQLConnectionKill.GetDriverFunc := 'getSQLDriverORA';
        SQLConnectionKill.VendorLib := 'oci.dll';
        SQLConnectionKill.LoginPrompt := false;
        SQLConnectionKill.Params.Add('Database=orcl');
        SQLConnectionKill.Params.Add('User_Name=sys');
        SQLConnectionKill.Params.Add('Password=********');
        SQLConnectionKill.Params.Add('RoleName=SYSDBA');
        SQLConnectionKill.Connected := True;
        SQLQueryKill := TSQLQuery.Create(nil);
        SQLQueryKill.SQLConnection := SQLConnectionKill;
        SQLQueryKill.SQL.Text := 'select sid||'',''||serial#||'',@''||inst_id from gv$session where username=''SCOTT''';
        SQLQueryKill.Open;
        SQLConnectionKill.ExecuteDirect('alter system kill session ''' + SQLQueryKill.Fields[0].AsString + '''');
        SQLQueryKill.Close;
        try
          SQLStoredProc.StoredProcName := 'SP_TEST';
        except
          on E: Exception do
            Writeln(e.Message);
        end;
        SQLQueryKill.Open;
        if not SQLQueryKill.IsEmpty then
          Writeln('Error')
        else
          Writeln('Ok')
      finally
        SQLConnectionKill.Free;
      end;
    finally
      SQLStoredProc.Free;
    end;
  finally
    SQLConnection.Free;
    Readln;
  end;
end.

Re: Cannot disable auto reconnect

Posted: Wed 24 Feb 2016 12:32
by uno
That works fine on the version 5.1.3

we found out that the problem appeared when LoadParamsOnConnect parameter had been set to True

Thank you very much!

Re: Cannot disable auto reconnect

Posted: Wed 24 Feb 2016 13:03
by AlexP
glad to see that you solved the problem. If you have any other questions, feel free to contact us