Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
HOWTO Recover from Database failure
JanLinders
Hi all,
I'm looking for help on getting my report running without user intervention.
The reports runs in a separate thread and is started every 5 minutes.
Connection is made via a DataSource with JDBC (defined in the report) to an Oracle database running on a separate server.
The only part that runs in the thread is the 'task.run()' to reduce overhead from creating factory, engine , design and report. No changes to the report are needed.
Now this all runs fine and the html output is generated every 5 mins.
So far so good.
However when one of the following errors occur, it does not seem to recover.
. network connection failure
. tns listener failure/down
. database failure/down
I can catch the errors and I'm generating an HTML file indicating an error occurred.
Is there a way to recover from these types of errors so when the errors are gone, the report is generated again without user intervention.
Find more posts tagged with
Comments
JasonW
Does your thread create a new task every time? That should be the best route. You should be able to check for an error using
task.getErrors( ).isEmpty( )
or
task.getStatus()
static final int STATUS_NOT_STARTED = 0;
/**
* the task is running
*/
static final int STATUS_RUNNING = 1;
/**
* the task is finished with sucessful
*/
static final int STATUS_SUCCEEDED = 2;
/**
* the task is finished with errors
*/
static final int STATUS_FAILED = 3;
/**
* the task is finished by cancled
*/
static final int STATUS_CANCELLED = 4;
Jason
JanLinders
Hi Jason,
thanks for the follow up.
I'll certainly will give it try...
Does creating a complete new task not add to much overhead ?
What parts of the total task should/can be in every new thread without
creating to much overhead and which part can be done once...
To be able to recover from the issues mentioned earlier, do you know
in which part (factory, engine, design , report, tasks ) the connection to the DB is made ?
Is the DB connection status somehow available in one of these ?
Best regards, Jan
JasonW
Jan,
The task is not a heavy process. If you look at the web viewer example a new task is created for every new request. Just make sure you close the task after each request. The task makes the connection but can also take a passed in connection:
task.getAppContext().put("OdaJDBCDriverPassInConnection", myconnection);
Jason