|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Dynamic datasource |
« View previous topic :: View next topic » |
Author |
Message
|
csjayakumar |
Posted: Thu Jan 05, 2012 12:34 am Post subject: Dynamic datasource |
|
|
Newbie
Joined: 03 Jan 2012 Posts: 3
|
Hi,
In my project, we connect to two databases
1) Database where all project config data is stored. DataSource is ABCD in all environments
2) An external database. DataSource is DB2A in test and DB2B is production.
So here the datasource for the 2nd database is different in test and Production and hence should be set dynamically.
One option is to go with bar override, but I am trying not to touch the bar file for each environment.
So now we store the dataSource name as a configurable value in the ABCD database. So in ABCD test database, we store the value DB2A and in ABCD prod database, we store DB2B.
Then in the ESQL, I get the value from DB and use it in my database statements.
EG: SET RW_Properties.Properties[]=PASSTHRU (CH_HotelSelectProperties TO Database.{DataSource_1P} VALUES(CH_LastRetrieve,CH_LastRetrieve));
Where the value of DataSource_1P comes from the database.
The challenge is that if a compute node has code to connect to database, then the node property "data Source" is mandatory. So I should hard code to DB2A or DB2B.
If I hard code DB2B, then the flow is not working in test because DB2B is not a valid datasource in test. Though in the ESQL I will be using DB2A, I believe the broker will try connecting to the DataSource configured as Node property, irrespective of whether it is used in the ESQL.
I also tried to override this property via ESQL (similar to how you change the Directory of a FileRead node or URL of a HTTLRequest node), but could not find the right way to do it.
Can you please suggest a way out?
Thank you! |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jan 05, 2012 12:54 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Broker connects to Databases (unless you are using Java) using ODBC.
Code the ODBC name into the flow.{eg Compute Node Properties}
Configure the ODBC name in the different environments to talk to the different databases in Test and Prod etc.
I'm guessing here that you have not attended any proper training in the use of broker. What you are wanting to do is very standard and is not a problem for broker. _________________ 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 |
|
 |
Vitor |
Posted: Thu Jan 05, 2012 5:34 am Post subject: Re: Dynamic datasource |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
csjayakumar wrote: |
One option is to go with bar override, but I am trying not to touch the bar file for each environment. |
So you've chosen not to use the feature IBM has provided to allow for environmental changes without code changes? Why have you decided that?
csjayakumar wrote: |
So now we store the dataSource name as a configurable value in the ABCD database. So in ABCD test database, we store the value DB2A and in ABCD prod database, we store DB2B.
Then in the ESQL, I get the value from DB and use it in my database statements. |
So instead of using a property, you're using a database to store the name of a database? How is that better?
csjayakumar wrote: |
ge is that if a compute node has code to connect to database, then the node property "data Source" is mandatory. So I should hard code to DB2A or DB2B. |
Really? Why should you do that?
csjayakumar wrote: |
I also tried to override this property via ESQL (similar to how you change the Directory of a FileRead node or URL of a HTTLRequest node), but could not find the right way to do it. |
That's because you can't, and you shouldn't be trying to.
csjayakumar wrote: |
Can you please suggest a way out? |
Use the WMB feature provided & override the ODBC. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 05, 2012 5:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
smdavies99 wrote: |
I'm guessing here that you have not attended any proper training in the use of broker. What you are wanting to do is very standard and is not a problem for broker. |
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Jan 05, 2012 5:36 am Post subject: Re: Dynamic datasource |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
csjayakumar wrote: |
and hence should be set dynamically.One option is to go with bar override, but I am trying not to touch the bar file for each environment. |
You are silly to avoid the logical solution. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|