Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
danishar
Partner - Contributor II
Partner - Contributor II

ODBC read failed

Hi
I'm trying to contact ODBC tables
Sometimes the connection fails
Is there a way to know when it fails?
I want to create conditions that if there is an error to wait a while (sleep) and then try again
How can you identify this kind of error?

My condition should look like this:

ODBC CONNECT TO DB (XUserId is USERNAME, XPassword is PASS);
if [Error: ODBC read failed] then
sleep 10000;
END IF

I want to run a loop 1 hour (every 10 minutes)

Thank you!

2 Replies
luciancotea
Specialist
Specialist

Play with:

ErrorMode
ScriptError
ScriptErrorDetails
ScriptErrorCount
ScriptErrorList

functions. Set ErrorMode = 0 to prevent script from stopping, then read the error. repeat until no error or time > 1hour

danishar
Partner - Contributor II
Partner - Contributor II
Author

Thanks for the tip

it works like this:

set ErrorMode=0;

FOR i=1 to 6 //  6times=1hour

ODBC CONNECT TO DB (XUserId is USERNAME, XPassword is PASS);

if ScriptError=0 then

SLEEP 6000000; //1000=1sec 6000000=10min

end if

NEXT