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 » Multiple DB2 Table entries and SELECT statement

Post new topic  Reply to topic
 Multiple DB2 Table entries and SELECT statement « View previous topic :: View next topic » 
Author Message
neeha_kashyap120
PostPosted: Thu Mar 05, 2009 1:04 pm    Post subject: Multiple DB2 Table entries and SELECT statement Reply with quote

Apprentice

Joined: 05 Mar 2009
Posts: 31

Hi All

I tried to lookup previous posts but couldnt find any related to me, also looked up HELP but wasnt able toget teh answer.

I am using SELECT function to access queue and qmgr name from the database table based on Application name and Message type.

I noticed that someone entered two rows in the table having same App name and Msgtyp but diff Q and Qmgr names. When i sent a message through the flow, it selected the Q and Qmgr that was 2nd in order. I am not sure how it knew which to pick.

The entries in table are

AppGrp Msgtyp Q1 QMGR1
AppGrp MsgTyp Q2 QMGR2

The message ended up in Q2 QMGR2, I am not using any other XREFKey, just picking the destination based on AppGrp and Msgtyp. I know THE with SELECT returns the first one in list but here the second entry was picked.

Please help

Neeha
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Mar 05, 2009 1:31 pm    Post subject: Reply with quote

Jedi Council

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

I think you should look at the SQL documentation for the Database you are using.
That and with the PASSTHRU statement will allow you to select:-
- The first
- The last
etc
etc
Don't for get to make the select read only as well just so you don't keep a lock on the data.
_________________
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
MQEnthu
PostPosted: Thu Mar 05, 2009 8:44 pm    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

neeha_kashyap120 wrote:
I noticed that someone entered two rows in the table having same App name and Msgtyp but diff Q and Qmgr names. When i sent a message through the flow, it selected the Q and Qmgr that was 2nd in order. I am not sure how it knew which to pick.

The entries in table are

AppGrp Msgtyp Q1 QMGR1
AppGrp MsgTyp Q2 QMGR2

The message ended up in Q2 QMGR2, I am not using any other XREFKey, just picking the destination based on AppGrp and Msgtyp. I know THE with SELECT returns the first one in list but here the second entry was picked.


You can retrive all the matching rows from database using the PASSTHRU statenment...

Code:
SET Environment.Variables.QmgrInfo[]= passthru(<your SQL select query>

_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
Back to top
View user's profile Send private message
neeha_kashyap120
PostPosted: Fri Mar 06, 2009 5:16 am    Post subject: Reply with quote

Apprentice

Joined: 05 Mar 2009
Posts: 31

Usually we wouldnot have duplicate entries like this for AppGrp and MsgTyp, but in case accidentally there is , I wanted to know which one would the SELECT choose.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 06, 2009 5:19 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

neeha_kashyap120 wrote:
Usually we wouldnot have duplicate entries like this for AppGrp and MsgTyp, but in case accidentally there is , I wanted to know which one would the SELECT choose.


Unless you've taken specific action (THE or ITEM) it will return both as a result set. How your code reacts to that is a design decision.

Accidents like this can also be prevented by proper use of DB2 constraints.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Multiple DB2 Table entries and SELECT statement
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.