FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour LOST CONNECTION - At. Mr. Rao
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
LOST CONNECTION - At. Mr. Rao
Posted: Fri Jan 14, 2022 01:57 PM
Buenos d铆as, estoy teniendo este error en un servidor remoto
La conexi贸n se corta, he le铆do que la reconexi贸n es autom谩tica, pero al ejecutar la sentencia SQL da error y se sale del sistema, a veces sigue el curso del programa, depende de la tarea.
Todo esto con la nativa.
Habr谩 alguna manera que ya este solucionado o tal vez configurar algo en el servidor? el cual yo desconozca.
Adjunto imagen del error.

Desde ya les agradezco a quienes tengan alguna soluci贸n.
Saludos
Marcelo Roggeri
FWH - Harbour - BCC7 - PellesC
Posts: 230
Joined: Thu Sep 17, 2015 11:40 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Fri Jan 14, 2022 11:32 PM

Hola tengo una proceso que realizo antes de enviar una consulta para que se verifique la conexi贸n

Function IsConexion(lWait)
local IsQry,aWait
local lConn:= .T.

DEFAULT lWait TO .F.

TRY
If lWait
WaitOn("Espere, Comprobando conexion....",@await )
EndIf
IsQry:= oServer:Query("Select 1")
IsQry:End()
If lWait
WaitOff( @aWait )
Endif

CATCH oError
If oError:SubCode=2013 .OR. oError:SubCode=1096
If lWait
WaitOn("Espere, intentando reconectar...",@aWait )
EndIf
While .t.
TRY
SysRefresh()
oServer:= NIL
oServer:= ConnectTo()
lSale:=.T.
CATCH oErr
lSale:=.F.
END
If lSale
Exit
EndIf
EndDo
If lWait
WaitOff( @aWait )
Endif
EndIf
lConn:=.F.
END

Return lConn

Carlos Atuncar - CaSoftSystem
Chincha - Per煤
+51983478218
carlosalbatun@gmail.com
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Sat Jan 15, 2022 12:55 PM

Hola Carlos buenos d铆as, muchas gracias por tu funci贸n, pruebo de implementarla y comento luego como me fue.
Saludos desde Argentina
Marcelo

FWH - Harbour - BCC7 - PellesC
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Sat Jan 15, 2022 01:05 PM
Carlos, fijate que puse el codigo entre etiquetas Code y hay un EndDo y un EndIf que sobra.
Podrias revisar la function tuya y pasarmela de nuevo?
Gracias
Code (fw): Select all Collapse
Function IsConexion(lWait)
聽 聽 聽 聽 聽local IsQry,aWait
聽 聽 聽 聽 聽local lConn:= .T.
聽 聽 聽 聽 聽
聽 聽 聽 聽 聽DEFAULT lWait TO .F.
聽 聽 聽 聽 聽
聽 聽 聽 聽 聽TRY
聽 聽 聽 聽 聽 聽 If lWait
聽 聽 聽 聽 聽 聽 聽 聽WaitOn("Espere, Comprobando conexion....",@await )
聽 聽 聽 聽 聽 聽 EndIf
聽 聽 聽 聽 聽 聽 IsQry:= oServer:Query("Select 1")
聽 聽 聽 聽 聽 聽 IsQry:End()
聽 聽 聽 聽 聽 聽 If lWait
聽 聽 聽 聽 聽 聽 聽 聽WaitOff( @aWait )
聽 聽 聽 聽 聽 聽 Endif
聽 聽 聽 聽 聽
聽 聽 聽 聽 聽CATCH oError
聽 聽 聽 聽 聽 聽 If oError:SubCode=2013 .OR. oError:SubCode=1096
聽 聽 聽 聽 聽 聽 聽 聽If lWait
聽 聽 聽 聽 聽 聽 聽 聽 聽 WaitOn("Espere, intentando reconectar...",@aWait )
聽 聽 聽 聽 聽 聽 聽 聽EndIf
聽 聽 聽 聽 聽 聽 聽 聽While .t.
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽TRY
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 SysRefresh()
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oServer:= NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oServer:= ConnectTo()
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 lSale:=.T.
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽CATCH oErr
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 lSale:=.F.
聽 聽 聽 聽 聽 聽 聽 聽END
聽 聽 聽 聽 聽 聽 聽 聽If lSale
聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽EndIf
聽 聽 聽 聽 聽 聽 聽 聽EndDo
聽 聽 聽 聽 聽 聽 聽 聽If lWait
聽 聽 聽 聽 聽 聽 聽 聽 聽 WaitOff( @aWait )
聽 聽 聽 聽 聽 聽 聽 聽Endif
聽 聽 聽 聽 聽 聽 聽 聽EndIf
聽 聽 聽 聽 聽 聽 聽 聽lConn:=.F.
聽 聽 聽 聽 聽END
聽 聽 聽 聽 聽
Return lConn
FWH - Harbour - BCC7 - PellesC
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Mon Jan 17, 2022 07:57 PM
A mi, parece bien.

Code (fw): Select all Collapse
FUNCTION IsConexion( lWait )

   LOCAL IsQry, aWait
   LOCAL lConn := .T.

   DEFAULT lWait TO .F.

   TRY

      IF lWait

         WaitOn( "Espere, Comprobando conexion....", @await )

      ENDIF

      IsQry := oServer:Query( "Select 1" )

      IsQry:End()

      IF lWait

         WaitOff( @aWait )

      ENDIF

   CATCH oError

      IF oError:SubCode = 2013 .OR. oError:SubCode = 1096

         IF lWait

            WaitOn( "Espere, intentando reconectar...", @aWait )

         ENDIF

         WHILE( .T. )

            SysRefresh()

            TRY

               oServer := NIL
               oServer := ConnectTo()

               lSale   := .T.

            CATCH oErr

               lSale   := .F.

            END // TRY

            IF lSale

               EXIT

            ENDIF

         ENDDO

         IF lWait

            WaitOff( @aWait )

         ENDIF

      ENDIF

      lConn := .F.

   END // TRY

RETURN lConn


Regards, saludos.
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Mon Jan 17, 2022 08:39 PM

Ok gracias Karinha debo haberme mareado en su momento.
Saludos

FWH - Harbour - BCC7 - PellesC
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Wed Feb 02, 2022 11:46 AM
Buenos d铆as a todos, siguiendo con el hilo, como bien dijo Mr. Rao la reconexi贸n la hace en forma autom谩tica, pero al reconectarse luego de haber estado varios minutos sin usar el sistema me da el siguiente error:
Code (fw): Select all Collapse
Application
===========
聽 聽Path and name: H:\Sistema\samvt\menu.exe (32 bits)
聽 聽Size: ********* bytes
聽 聽Compiler version: Harbour 3.2.0dev (r1801051438)
聽 聽FiveWin 聽version: FWH 21.11
聽 聽C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
聽 聽Windows version: 6.2, Build 9200 

聽 聽Time from start: 0 hours 33 mins 37 secs 
聽 聽Error occurred at: 01/02/2022, 19:57:49
聽 聽Error description: Error BASE/1081 聽Error de argumento: +
聽 聽Args:
聽 聽 聽[ 聽 1] = C 聽 SET @@TX_ISOLATION = '
聽 聽 聽[ 聽 2] = U 聽 

Stack Calls
===========
聽 聽Called from: .\source\internal\FWMARIA.PRG => FWMARIACONNECTION:INTRANSACTION( 6864 )
聽 聽Called from: .\source\internal\FWMARIA.PRG => (b)FWMARIACONNECTION( 5837 )
聽 聽Called from: .\source\internal\FWMARIA.PRG => FWMARIACONNECTION:BEGINTRANSACTION( 0 )
聽 聽Called from: .\source\classes\TARRDATA.PRG => TARRAYDATA:SAVETOMYSQL( 1717 )
聽 聽Called from: .\source\classes\TARRDATA.PRG => TARRAYDATA:SAVEDATA( 1566 )

Quedo a la espera de alguna ayuda.
Desde ya muchas gracias
Marcelo
FWH - Harbour - BCC7 - PellesC
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Wed Feb 02, 2022 07:27 PM
Marcelo:

Yo hago lo siguiente y no he tenido problemas de ca铆da de conexi贸n

Code (fw): Select all Collapse
      oApp:oCon:Execute( "SET SESSION wait_timeout = 86400;" )


Para mayor explicaci贸n "茅chale un ojo" a este link

https://programmerclick.com/article/3236598340/

Espero te sirva.

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Thu Feb 03, 2022 10:57 AM

Hola Armando, he puesto esa l铆nea, con Dolphin si lo hace, con la nativa no
De todas maneras gracias voy a leer el link que compartiste para ver si saco algo en claro.
Muchas gracias.
Saludos
Marcelo

FWH - Harbour - BCC7 - PellesC
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Thu Feb 03, 2022 11:58 AM
Armando los tiros vienen por ahi, esa pagina que me pasaste esta muy buena, y los cambios de los valores que he hecho solo me los toma en localhost, nunca en el servidor remoto, por lo tanto me puse en contacto con quienes me brindan el servicio y ver como hago.
Code (fw): Select all Collapse
 聽 聽 聽 聽 聽 聽cSql := "set GLOBAL interactive_timeout=7200;"
聽 聽 聽 聽 聽 聽 oSql := oCn:Execute( cSql )
聽 聽 聽 聽 聽 聽 
聽 聽 聽 聽 聽 聽 cSql := "set GLOBAL wait_timeout=7200;"
聽 聽 聽 聽 聽 聽 oSql := oCn:Execute( cSql )


聽 聽 聽 聽 聽 聽 cSql := "show GLOBAL VARIABLES like '%timeout%';"
聽 聽 聽 聽 聽 聽 oSql := oCn:Execute( cSql )
聽 聽 聽 聽 聽 聽 xbrowse(oSql)

Adjunto el codigo de como lo hice, solo que a modo localhost si funciona
Con 7200=2Hs en forma remota me parece suficiente
Luego comento una vez que tenga respuesta
Saludos
FWH - Harbour - BCC7 - PellesC
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Fri Feb 04, 2022 12:58 AM

Marcelo:

Llevas raz贸n, yo lo uso en una LAN, no he probado en un servidor remoto.

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Fri Feb 04, 2022 01:20 PM

En los servidores remotos de pago esas variables son protegidas PROTECTED para el usuario final, por lo tanto solo los administradores lo pueden cambiar, al menos con mi proveedor.
Cuento esto por si a alguien le llega a pasar y se ahorre horas de probar.
Saludos

FWH - Harbour - BCC7 - PellesC
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Sun Feb 13, 2022 09:56 AM
Marcelo Roggeri wrote:Buenos d铆as, estoy teniendo este error en un servidor remoto
La conexi贸n se corta, he le铆do que la reconexi贸n es autom谩tica, pero al ejecutar la sentencia SQL da error y se sale del sistema, a veces sigue el curso del programa, depende de la tarea.
Todo esto con la nativa.
Habr谩 alguna manera que ya este solucionado o tal vez configurar algo en el servidor? el cual yo desconozca.
Adjunto imagen del error.

Desde ya les agradezco a quienes tengan alguna soluci贸n.
Saludos
Marcelo Roggeri


There is nothing to be done in the program.

This message is given to the user, so that he will check internet/cables, etc.

If the user gets this message, let him check and wait for internet connection. When the internet connection is restored, he can continue with the program.
Regards



G. N. Rao.

Hyderabad, India
Posts: 344
Joined: Sat Jul 22, 2006 09:04 PM
Re: LOST CONNECTION - At. Mr. Rao
Posted: Sun Feb 13, 2022 02:10 PM

Ok muchas gracias Mr. Rao
Saludos
Marcelo

FWH - Harbour - BCC7 - PellesC

Continue the discussion