Re: [D7 Ent] [TADOStoredProc] lose and get back network connexion it still raise exceptionl



When a connection is severed in the manner you described, the connection is
broken and must be reestablished with the server. You cannot simply "put
the cable back in", and have it pickup where you left off.

You should be able to close the AdoConnection and then reopen it. The
AdoConnection does not set its Connected property to False when the
connection is severed. You must manually do that to reconnect.

_Cmd.Connected := False or _Cmd.Close
_Cmd.Connected := True or _Cmd.Open

You should also be aware that if a connection sits without activity, you
stand a chance of loosing the connection. SQL Server (depending how it is
setup) will drop inactive connections. We have had this happen and have
taken steps to prevent it by creating our own subclass of TAdoConnection.

http://groups.google.com/group/borland.public.delphi.database.ado/browse_thread/thread/712d08687d5bf160/2017b8c9ee522132?lnk=st&q=MS+SQL+%22Connection+Failure%22+Possible+Solution+group%3Aborland.public.delphi.*&rnum=1&hl=en#2017b8c9ee522132


Regards,
-Steve-

"aaa.aaaa" <aaa.aaa@xxxxxxx> wrote in message
news:43da441d$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> Hi All,
>
> I have a problem with TADOStoredProc
> If I lose the network the system raise an exception, (General Network
> Error) It is ok !!
>
> But when i get back the network connexion, the system still raise an
> exception (Connexion failure).
>
> The TADOConnection is created only the first time (singleton)
>
> my procedure to test it :
>
> 1- I execute the test one time with network ; Result OK
> 2- I unplug my network cable , run the test ; Result = General Network
> Error exception OK
> 3- I plug back the cable, run the test ; Result = Connection Failure
> exception ; WHY ?
>
> If I create the TADOConnection each time it works fine, but i don't want
> to do that !!!
>
> If i use an proc stock with params, the system raise exception because is
> cannot find the params when i get back the network ?
>
>
> How can i fix that ?
> I don't want to close the application each time the system lose and get
> back the network connexion
>
> With TADOQuery is working fine !!
>
> Thanks !!!
>
>
>
> See under my code source
>
> Unit ADONetworkTest
> .......
> type
> TCnxFailureTests = class(TTestCase)
> private
> protected
> published
> // Test methods
> procedure TestFailureCnxStoredProcWithoutParams2;
>
> end;
>
> implementation
>
> var
> _Cmd:TADOConnection;
>
> function GetCmd: TADOConnection;
> begin
> if _Cmd = nil then
> begin
> _Cmd:= TADOConnection.Create(Nil);
> _Cmd.ConnectionString:= 'Provider=SQLOLEDB.1;Persist Security'
> + 'Info=True;User ID=sa;Initial Catalog=Northwind;'
> + 'Data Source=MYSERVER\DEV';
> _Cmd.LoginPrompt:= False;
> end;
> Result:= _Cmd;
> end;
>
>
> procedure TCnxFailureTests.TestFailureCnxStoredProcWithoutParams2;
> var
> _SP: TADOStoredProc;
> begin
>
> _SP:= TADOStoredProc.Create(Nil);
> try
> _SP.Connection:= GetCmd;
> _SP.ProcedureName := 'dbo.SP_TEST';
> _SP.ExecProc;
> Check(_SP.Connection.Connected , 'Error Falure Cnx');
> finally
> FreeAndNil(_SP);
> end;
>
> end;


.



Relevant Pages

  • RE: Problems with Permissions
    ... And SBS server is only take ... the role of an internal server. ... they are all configured to connected to internal network. ... g. Run the Configure Email and Internet Connection Wizard on SBS server. ...
    (microsoft.public.windows.server.sbs)
  • Re: Outgoing POP3 email missing/lost/not received
    ... Funny thing is that I have had this ISP for 8 years and it has always been ... It looks like when you last ran CEICW, you set the ISP's mail server to: ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)
  • Re: server disconnection - very often
    ... Often get the redirected folders working offline prompt on some client ... VMware virtual network interface cause network issue. ... On the Connection Type page, click Broadband, and then click Next. ... |> re-initialize the offline files cache and database on client computers: ...
    (microsoft.public.windows.server.sbs)
  • Re: OT By a mile in parts comments on Viet Nam
    ... check bank accouts etc etc whilst away but is safe to do so over wireless and using the hotel network.. ... you should regard your connection as insecure and use some ... form of encryption to protect your passwords and privacy. ... My recommendation would be to set up a VPN endpoint in the UK that you ...
    (uk.comp.sys.mac)
  • Re: Outgoing POP3 email missing/lost/not received
    ... ISP's mail server instead of the domain name on the ... SUMMARY OF SETTINGS FOR CONFIGURE E-MAIL AND INTERNET ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)