Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to change the name of the database for a datasource dynamically?
How to change the name of the database for a datasource dynamically? [message #757113] Wed, 16 November 2011 14:48 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Hi,

I have one JDBC Data Source that all my Data Sets use. I would like to be able to change the name of the database defined in the Data Source in the "beforeOpen" exit for the Data Source so that we can use different databases for development .vs. deployment.
I'm thinking that the name of the database would be passed as a report parameter.

So I think the code would be something like:

this.setExtensionProperty("???",params["DBName"].value);

1) Would this work?
2) What is the extension property name that I'd need to fill in for "???"?

Thanks,
Mike
Re: How to change the name of the database for a datasource dynamically? [message #757745 is a reply to message #757113] Mon, 21 November 2011 13:12 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Bump! Does anyone have any thoughts on this?

Thanks,
Mike
Re: How to change the name of the database for a datasource dynamically? [message #757813 is a reply to message #757745] Mon, 21 November 2011 19:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike

I responded to this and it seems that the forums and newsgroup are not being replicated properly:

original response

Mike

That will work but you need to set the odaURL.
So it would be something like:

var newurl = "jdbc:mysql://localhost/" + params["DBName"].value;
this.setExtensionProperty("odaURL",newurl);

Jason
Re: How to change the name of the database for a datasource dynamically? [message #757819 is a reply to message #757113] Wed, 16 November 2011 16:00 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike

That will work but you need to set the odaURL.
So it would be something like:

var newurl = "jdbc:mysql://localhost/" + params["DBName"].value;
this.setExtensionProperty("odaURL",newurl);

Jason

On 11/16/2011 9:48 AM, Mike Wulkan wrote:
> Hi,
>
> I have one JDBC Data Source that all my Data Sets use. I would like to
> be able to change the name of the database defined in the Data Source in
> the "beforeOpen" exit for the Data Source so that we can use different
> databases for development .vs. deployment.
> I'm thinking that the name of the database would be passed as a report
> parameter.
>
> So I think the code would be something like:
>
> this.setExtensionProperty("???",params["DBName"].value);
>
> 1) Would this work?
> 2) What is the extension property name that I'd need to fill in for "???"?
>
> Thanks,
> Mike
Re: How to change the name of the database for a datasource dynamically? [message #775244 is a reply to message #757819] Thu, 05 January 2012 16:22 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Thanks Jason for this information. One other (hopefully) minor thing.

If I want to set the properties for the user and password as well, I see in the xml the property names to change are:
odaURL
odaUser
odaPassword

however for the odaPassword the value is an encrypted property.

eg.
<encrypted-property name="odaPassword" encryptionID="base64">cGFzczRub3c=</encrypted-property>

1) is the setExtensionProperty still the correct api to use to set the odaPassword?
2) how would one generate the correct encrypted string?

I'm thinking I could use the GUI to create the data source and then copy the encrypted string but is there a better way?
Re: How to change the name of the database for a datasource dynamically? [message #775294 is a reply to message #775244] Thu, 05 January 2012 18:26 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

this.setExtensionProperty("odaPassword","yourpassword"); does not need
to be encrypted.

Jason

On 1/5/2012 11:22 AM, Mike Wulkan wrote:
> Thanks Jason for this information. One other (hopefully) minor thing.
>
> If I want to set the properties for the user and password as well, I see
> in the xml the property names to change are:
> odaURL
> odaUser
> odaPassword
>
> however for the odaPassword the value is an encrypted property.
>
> eg.
> <encrypted-property name="odaPassword"
> encryptionID="base64">cGFzczRub3c=</encrypted-property>
>
> 1) is the setExtensionProperty still the correct api to use to set the
> odaPassword?
> 2) how would one generate the correct encrypted string?
>
> I'm thinking I could use the GUI to create the data source and then copy
> the encrypted string but is there a better way?
Previous Topic:EMF ODA DataSource, Report Viewer and Classloader Problems
Next Topic:trouble sorting with joint data sets
Goto Forum:
  


Current Time: Fri Apr 19 01:17:31 GMT 2024

Powered by FUDForum. Page generated in 0.03375 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top