Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Handling errors in OLEDB CONNECT

I have a OLEDB CONNECT in a scheduled reload that sometimes fails. Is there a way of handling that failure?

I want to be able to use another OLEDB CONNECT if the first one fails.

The only way I can handle failure at the moment is in the QMC job scheduler.

1 Solution

Accepted Solutions
telepuzik
Contributor II
Contributor II

Hi Ashar,

The second ODBC will be used if the first one fails. !

--------------------------------------------------------------------------

set ErrorMode=0;

OLEDB CONNECT32 TO [Provider=MSDASQL.1;Persist Security Info=False;Data Source=MyTest;Extended Properties="DSN=MyTest;DBQ=C:\Temp\Database1.accdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"];

let ErrorNum = num(ScriptError);

Trace ScriptError: $(ErrorNum);

IF ErrorNum > 0 Then

  OLEDB CONNECT32 TO [Provider=MSDASQL.1;Persist Security Info=False;Data Source=MyTest2;Extended Properties="DSN=MyTest2;DBQ=C:\Temp\Database2.accdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"];

ENDIF

[Temp]:

Load

  Client

  , ID

;

SQL SELECT

  Client

  , ID

FROM TClient;

--------------------------------------------------------------------------

Best Regards,

Cyrus

View solution in original post

7 Replies
amit_saini
Master III
Master III

Hi Ashar,

Inside QMC go to System->Setup->Select Distribution Services ->Alert E-mail and here mention your email Id. This will  help you for getting automatic alert whenever any task got failed.

Thanks,
AS

Not applicable
Author

Hi,

If i was you i would find out what the cause of the failure is. In my mind the following could be the issue:

1. Different connection name: Make sure that the connection name on the server and the development environment is the same.

2. User credentials: Make sure that the user credentials being used on the development machine are valid on the server too.

This could help you eliminate the failure in the first place.

Regards

Rahul

Not applicable
Author

Thanks but I got alert emails set up already. I am looking for some way to automatically connect to the second database, if the first one fails.

Not applicable
Author

Its a cluster with 2 IP addresses. Sometimes the main server goes down and the OLEDB CONNECT fails.When this happens, I need to connect to the second server.

telepuzik
Contributor II
Contributor II

Hi Ashar,

The second ODBC will be used if the first one fails. !

--------------------------------------------------------------------------

set ErrorMode=0;

OLEDB CONNECT32 TO [Provider=MSDASQL.1;Persist Security Info=False;Data Source=MyTest;Extended Properties="DSN=MyTest;DBQ=C:\Temp\Database1.accdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"];

let ErrorNum = num(ScriptError);

Trace ScriptError: $(ErrorNum);

IF ErrorNum > 0 Then

  OLEDB CONNECT32 TO [Provider=MSDASQL.1;Persist Security Info=False;Data Source=MyTest2;Extended Properties="DSN=MyTest2;DBQ=C:\Temp\Database2.accdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"];

ENDIF

[Temp]:

Load

  Client

  , ID

;

SQL SELECT

  Client

  , ID

FROM TClient;

--------------------------------------------------------------------------

Best Regards,

Cyrus

Not applicable
Author

Thanks Cyrus! This is what I was looking for

telepuzik
Contributor II
Contributor II

You are welcome!