Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Macro to connect to ODBC datasource


I want to create a macro to connect to ODBC datasource automatically after fixed time intervals. Can anyone help with that?

My Qlikview application is connected to a PostgreSQL through ODBC connector. The tabs and objects work fine most of the time but sometimes after some standby period (no user using the app) the connection gets broken somehow and it starts showing "Database Connection failed".

After that, the only way i have figured out to reconnect is to close the application and open it again (or re-publish it again). A macro code to re-connect again will help in such a case.


2 Replies
MVP & Luminary
MVP & Luminary

Re: Macro to connect to ODBC datasource

Look through these - http://community.qlik.com/search.jspa?q=macro+write+odbc - various posting maybe they give you a hint how to (re)connect yout database. But it could be that it don't work with direct discovery. Maybe it's better to go to your database/odbc-driver and change the timeout-settings.

- Marcus

Not applicable

Re: Macro to connect to ODBC datasource

Marcus, thanks for your reply. Unfortunately, i do not think that those codes are meant to be run with Direct Discovery.

Have already tweaked the time-out settings but the database still fails to connect.