Change Datasaource info using a Script - Websphere

This is a discussion on Change Datasaource info using a Script - Websphere ; Hello All,
My application needs to toggle between 2 DBs, So I was just wondering ,if it would be possible to change the JDBC URL and the connect info using a wsadmin scripting client with jacl or jython script? ....Any ...

Change Datasaource info using a Script

Hello All,

My application needs to toggle between 2 DBs, So I was just wondering ,if it would be possible to change the JDBC URL and the connect info using a wsadmin scripting client with jacl or jython script? ....Any ideas on how to get started?.

Cheers!
Amulya

Re: Change Datasaource info using a Script

amulya.green@yahoo.com wrote:
> Hello All,
>
> My application needs to toggle between 2 DBs, So I was just wondering
> ,if it would be possible to change the JDBC URL and the connect info
> using a wsadmin scripting client with jacl or jython script? ....Any
> ideas on how to get started?.

what do you mean by "toggle"? Surely you don't mean at runtime?

Re: Change Datasaource info using a Script

On Apr 19, 2:33 am, Paul Ilechko wrote:
> amulya.gr...@yahoo.com wrote:
> > Hello All,
>
> > My application needs to toggle between 2 DBs, So I was just wondering
> > ,if it would be possible to change the JDBC URL and the connect info
> > using a wsadmin scripting client with jacl or jython script? ....Any
> > ideas on how to get started?.
>
> what do you mean by "toggle"? Surely you don't mean at runtime?

I assume you need to change the properties associated with the
datasource jndi reference.

See the link for a create datasource script. Just amend it to modify
an existing datasource. The proc is installDataSource_proc.tcl.

Re: Change Datasaource info using a Script

Paul,
This toggle will not be at runtime. The development team will make a request to switch to a different DB and thats when the script comes in to picture. Thanks.

Re: Change Datasaource info using a Script

amulya.green@yahoo.com wrote:
> Paul, This toggle will not be at runtime. The development team will
> make a request to switch to a different DB and thats when the script
> comes in to picture. Thanks.

So why not just define two different datasources? Then the development
team can just change their resource reference to point to the right one
when they re-deploy their application.

Re: Change Datasaource info using a Script

I have tried to create the second data source, but it would'nt let me do so because, the jndi reference name is same for both of 'em. The only thing thats different is the JDBC URL and the connect account. Thats why I think its a little complicated. Thanks.

Re: Change Datasaource info using a Script

amulya.green@yahoo.com wrote:
> I have tried to create the second data source, but it would'nt let me
> do so because, the jndi reference name is same for both of 'em. The
> only thing thats different is the JDBC URL and the connect account.
> Thats why I think its a little complicated. Thanks.

So give it a different JNDI reference name. I don't see what the problem
is, assuming of course that your developers didn't do anything as stupid
as use hard coded JNDI names instead of using resource references.