• Welcome, Guest. Please login.
 

Handling -18 error message and automatic reconnect ? is-it possible ?

Started by Jean-Pierre LEROY, November 28, 2013, 05:16:59 AM

Previous topic - Next topic

Jean-Pierre LEROY

Dear all,

I use SQLitening in some FireFly projects with great success.

In my case some users are using laptops and other desktop PCs on a LAN. After lunch time (or when they go away from their laptop for a long period of time) they got -18 error message, when they came back and try using the application.

This message appears only on laptops, so I suspect that it is probably due to power saving options where the lan card is powered off.

Here is my question:

Is there a simple way to handle this -18 error message and try to reconnect automatically to the database when the laptop wakes on again and is connecting again to the network.

That could be nice to avoid end user to launch again the application.

Thanks for your help and / or shared experience on this topic.
Jean-Pierre

cj

http://www.sqlitening.com/support/index.php?topic=3412.30
See post  #43 and other posts.


%ID_TIMER             = 500   'must be in the same thread so using a timer
SetTimer(CB.HNDL, %ID_Timer, 30000, BYVAL %NULL)  'check every 30 seconds

FUNCTION AutoStart(hDlg AS DWORD)  AS LONG
  ConnectToServer   hDlg
  OpenDatabase      hDlg
END FUNCTION

CASE %WM_DESTROY
  PostQuitMessage 0
  FUNCTION = 0
  KillTimer CB.HNDL, %ID_TIMER
  EXIT FUNCTION

CASE %WM_TIMER
  CALL Ping(CB.HNDL)

FUNCTION Ping(hDlg AS DWORD) AS LONG
  LOCAL s AS STRING
  s = slGetStatus(4)
  IF s <> "Yes" THEN
     AutoStart(hDlg)
  END IF
END FUNCTION





D. Wilson

One possiblity is to look at the wireless adapter and change the power settings to not shut off the adapter. I had a Windows 7 Notebook that would give the Blue Screen Of Death - and that is what the issue was. When I did not shut the adapter off problem solved.

Personally -- I never leave a connection open to server. When I need to get data from the server I connect ,get my data and disconnect.
I don't know if this is the best method but it works for me.
If other users have thoughts on this I would appreciate your opinions/thoughts.

cj

Good suggestions, plus look at sleep and hibernate.
The time to reconnect is very small so staying connected should not be necessary.
Plus, the router lease may cause a disconnect every so many hours.
Normally 12-hours in my tests.

Reconnecting everytime may be the way to go.