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 » Database connection from Compute node

Post new topic  Reply to topic
 Database connection from Compute node « View previous topic :: View next topic » 
Author Message
ENVYMB
PostPosted: Thu Dec 19, 2013 11:52 pm    Post subject: Database connection from Compute node Reply with quote

Newbie

Joined: 19 Nov 2013
Posts: 7

Hi All,

I am using a ODBC connection to database from compute node which is working fine. Configuration is as below.

I have set a datasource name in compute node property.

I have declared shared row as below.

DECLARE v_Row SHARED ROW;

And the code is as below

IF v_Row .valid IS NULL THEN
SET v_Row .vship[] = (SELECT T.A,T.B,T.C,T.D FROM Database.table AS T );
SET v_Row .valid = TRUE;
END IF;
SET outLocalEnvRef.Variables.vShip[] = SELECT T.D FROM v_Row .vship[] AS T WHERE T.A = refIn.(XMLNSC.Attribute)A AND T.B= refIn.(XMLNSC.Attribute)BAND T.C= refIn.Extn.(XMLNSC.Attribute)C;

That means database records are fetched only if v_Row .valid is null.

now that i have tested this flow with multiple samples i have v_Row .valid = TRUE.

I recently observed that database that i am trying to connect was down and messages went to error queue.

So my question is will message flow trys to initiate databse connection even if code is not trying to fetch anything from databse? in my case v_Row.valid is TRUE. so code should fetch from v_Row .vship[] instead from database. Even in this case database being down is a problem?

Thanks,
ENVYMB
Back to top
View user's profile Send private message
Esa
PostPosted: Fri Dec 20, 2013 12:01 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

The problem is presumably with your test:
Code:
IF v_Row .valid IS NULL THEN


Test like this and you don't need the variable valid at all:
Code:
IF NOT EXISTS(v_Row .vship[]) THEN
Back to top
View user's profile Send private message
dogorsy
PostPosted: Fri Dec 20, 2013 12:17 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

Esa wrote:
The problem is presumably with your test:
Code:
IF v_Row .valid IS NULL THEN


Test like this and you don't need the variable valid at all:
Code:
IF NOT EXISTS(v_Row .vship[]) THEN


This change has nothing to do with the database.

If the message flow contains a value in the datasource, WMB will try to establish connection to that datasource, regardless of whether it is accessed by the code or not. So the answer to the OP is YES.
Back to top
View user's profile Send private message
ENVYMB
PostPosted: Fri Dec 20, 2013 1:32 am    Post subject: Reply with quote

Newbie

Joined: 19 Nov 2013
Posts: 7

Thank you dogorsy
So messages failing on db connectivity issue is normal even if code is not accessing db. I will not have to change anything in code.

I believe statements
IF v_Row .valid IS NULL THEN
and
IF NOT EXISTS(v_Row .vship[]) THEN

perform same action

Thanks,
ENVYMB
Back to top
View user's profile Send private message
Esa
PostPosted: Fri Dec 20, 2013 5:08 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

ENVYMB wrote:

So messages failing on db connectivity issue is normal even if code is not accessing db.


I disagree. I tested a flow where a compute node had a datasource that could not be connected. The esql code did not use the datasource. Test messages went through the flow and no exceptions were thrown.

Messages can fail if the database connection is down when the first ans subsequent message after flow restart try to populate the cache. But if the cache is populated and the values are fetched from there, a database connection that is not used when processing the message should not throw any exception.

Are you sure that the flow does not hit the database for every message? Have you verified it with user trace?
Back to top
View user's profile Send private message
manoj5007
PostPosted: Mon Dec 23, 2013 12:56 am    Post subject: Reply with quote

Acolyte

Joined: 15 May 2013
Posts: 64

@Esa

In my code data is fetched from DB. I did some modifications where the data is being read from file instead of DB and so made changes wherever connection to DB was established.
So though there is no DB connection involved within the ESQL and under DataSource I have given a invalid DSN name, I get the Datasource exception.

So I am not sure how come you didnt get any exception inspite of an invalid Datasource being mentioned. Please share your comments on scenarios where we will not be encountering such an exception with an invalid Datasource.
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 » Database connection from Compute node
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.