ODBC lost connection after hibernation

My AFL can't get db connection back after windows sleep or hibernate unless I close and restart amibroker. Is there any setting to make AFL connect to db automatically?

ODBC plugin version: 1.7.0
amibroekr version: 6.43.1
database: postgresql @ another host

_N(pgcon="ODBC;DSN=PostgreSQL30;SERVER=192.168.1.99;PORT=5432;DATABASE=amibroker;UID=amibroekr;PWD=amibroker");
odbcOpenDatabase(pgcon);

Just don't hibernate. Hibernation is broken in Windows. Turn it off.
Use administrator command prompt and type

powercfg /hibernate off

https://www.howtogeek.com/868748/how-to-disable-hibernation-on-windows-10/

1 Like

Hi Tomasz,
Thanks for always promptly support. I have some fundamental datas stored in SQL and shown as indicators. These charts get empty every time after windows awake from Hibernation. The thing I don't understand why AFL can't connect to db after windows woke up. The connection test in windows ODBC setting is good, and AFL should re-execute every refresh/change, i.e., the connection should be re-established. Or did I miss something?

As I wrote, hibernation is broken in Windows. Properly designed hibernation feature should restore previous state, as it never happened, but in Windows it doesn't do that.
It is not the task for application to handle things that should be taken care of by OS.
AFL does not "connect" to anything. AFL is a language.