ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Checking the Database connectivity

Post new topic  Reply to topic
 Checking the Database connectivity « View previous topic :: View next topic » 
Author Message
Girirsh K N
PostPosted: Mon May 23, 2016 9:49 pm    Post subject: Checking the Database connectivity Reply with quote

Newbie

Joined: 26 Apr 2016
Posts: 6

Hi,

My Scenario : I'm trying to insert the data in to the database table, but before performing the database insertion i want to check whether the database is active or not in the esql file. If the database is active then will perform the insertion else throw the user defined exception "Database is inactive".


Is there any possible way to do this ,if so kindly share your knowledge.


Thanks in advance!
Back to top
View user's profile Send private message
maurito
PostPosted: Mon May 23, 2016 10:17 pm    Post subject: Re: Checking the Database connectivity Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

Girirsh K N wrote:
Hi,

My Scenario : I'm trying to insert the data in to the database table, but before performing the database insertion i want to check whether the database is active or not in the esql file. If the database is active then will perform the insertion else throw the user defined exception "Database is inactive".


Is there any possible way to do this ,if so kindly share your knowledge.


Thanks in advance!

Why? why not just try the insert, catch the failure if any with a HANDLER, anylize it and throw the exception.
Back to top
View user's profile Send private message
kash3338
PostPosted: Mon May 23, 2016 11:34 pm    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Why do you need to do this? Your query is not very clear. If your motive is to check for the DB connectivity first before making a INSERT, then you can have a dummy SELECT query run before doing the INSERT. Even in that case you have a possibility of failure between the SELECT and INSERT queries.

Best way is to handle the error on the INSERT as mentioned by "maurito".
Back to top
View user's profile Send private message Send e-mail
Girirsh K N
PostPosted: Tue May 24, 2016 2:05 am    Post subject: Reply with quote

Newbie

Joined: 26 Apr 2016
Posts: 6

The main intention of using this method is to check the database connectivity first and then do the insertion.If the connectivity is not there, will retry for some count and if still the same scenario persists the user exception in thrown.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue May 24, 2016 3:54 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Lets turn this on its head

Why do you think that the DB won't be there?
Both Systems and DB's are pretty reliable these days.
What is the MTBF for your DB System (Hardware and software)?
Is there some dodgy network between them?

FWIW, I know of a system where the IIB Server is 1500Km from the DB server. Sure the traffic is low volume but in three years, we have not seen a failure due to DB non availability.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue May 24, 2016 4:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What happens if you check the DB, the DB is available, but then it crashes before you try to use it?

In every programming environment, you get some option to handle any exceptions that are thrown by a given programming statement.

IIB is no different.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Checking the Database connectivity
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.