|
Re: How to Connect to dynamic datasource using jdbc datasource [message #727651 is a reply to message #727359] |
Wed, 21 September 2011 18:38 |
|
You could always set the oda url like:
if( params["DBPARAM"].value == "beta"){
this.setExtensionProperty("odaURL","jdbc:mysql://localhost/mysql");
}else{
..
..
}
if the beforeOpen script of the data source. You could also use
connection profile and have one for alpha and one for beta.
Jason
On 9/21/2011 12:52 AM, cbr125x wrote:
> Hi All, can somebody help me?
> how to connect to dynamic database in BIRT using JDBC connection?
> i found that in scripted datasource example, the example using class as
> the datasource but i want the jdbc datasource but it's dynamic.
>
> i will explain the condition :
> let's say i have a parameter named "DBPARAM".
>
> in the beforeOpen events in datasource we put script :
> if DBPARAM = "beta" then The datasource connect to "serverBeta"
> else
> The datasource connect to "serverAlpha"
>
> can we do this programmatically or must be in designer or how should i
> do to accomplish that condition?
>
|
|
|
Re: How to Connect to dynamic datasource using jdbc datasource [message #727876 is a reply to message #727651] |
Thu, 22 September 2011 06:31 |
cbr125x Messages: 34 Registered: July 2011 |
Member |
|
|
Thx Jason
is this true, if i use sqlserver :
if( params["DBPARAM"].value == "beta"){
this.setExtensionProperty("odaURL","jdbc:sqlserver://server1/northwind;");
}else{
..
..
}
and also how can i get information for the property like "odaURL" in the setExtensionProperty?
i mean i don't know if the parameter for the "password", "username", etc.
Jason Weathersby wrote on Wed, 21 September 2011 14:38You could always set the oda url like:
if( params["DBPARAM"].value == "beta"){
this.setExtensionProperty("odaURL","jdbc:mysql://localhost/mysql");
}else{
..
..
}
if the beforeOpen script of the data source. You could also use
connection profile and have one for alpha and one for beta.
Jason
On 9/21/2011 12:52 AM, cbr125x wrote:
> Hi All, can somebody help me?
> how to connect to dynamic database in BIRT using JDBC connection?
> i found that in scripted datasource example, the example using class as
> the datasource but i want the jdbc datasource but it's dynamic.
>
> i will explain the condition :
> let's say i have a parameter named "DBPARAM".
>
> in the beforeOpen events in datasource we put script :
> if DBPARAM = "beta" then The datasource connect to "serverBeta"
> else
> The datasource connect to "serverAlpha"
>
> can we do this programmatically or must be in designer or how should i
> do to accomplish that condition?
>
|
|
|
Re: How to Connect to dynamic datasource using jdbc datasource [message #728159 is a reply to message #727876] |
Thu, 22 September 2011 15:58 |
|
That should work. Take a look at the xml view to see the property names:
<property
name="odaDriverClass">com.mysql.jdbc.Driver</property>
<property name="odaURL">jdbc:mysql://localhost/mydb</property>
<property name="odaUser">root</property>
<encrypted-property name="odaPassword"
encryptionID="base64">cm9vdA==</encrypted-property>
<property name="odaJndiName">jdbc/MyDataSource</property>
ie odaUser..
Jason
On 9/22/2011 2:31 AM, cbr125x wrote:
> Thx Jason
>
> is this true, if i use sqlserver : if( params["DBPARAM"].value == "beta"){
> this.setExtensionProperty("odaURL","jdbc:sqlserver://server1/northwind;");
> }else{
> ..
> ..
> }
>
> and also how can i get information for the property like "odaURL" in the
> setExtensionProperty? i mean i don't know if the parameter for the
> "password", "username", etc.
>
>
> Jason Weathersby wrote on Wed, 21 September 2011 14:38
>> You could always set the oda url like:
>>
>> if( params["DBPARAM"].value == "beta"){
>> this.setExtensionProperty("odaURL","jdbc:mysql://localhost/mysql");
>> }else{
>> ..
>> ..
>> }
>>
>> if the beforeOpen script of the data source. You could also use
>> connection profile and have one for alpha and one for beta.
>>
>>
>> Jason
>>
>>
>> On 9/21/2011 12:52 AM, cbr125x wrote:
>> > Hi All, can somebody help me?
>> > how to connect to dynamic database in BIRT using JDBC connection?
>> > i found that in scripted datasource example, the example using class as
>> > the datasource but i want the jdbc datasource but it's dynamic.
>> >
>> > i will explain the condition :
>> > let's say i have a parameter named "DBPARAM".
>> >
>> > in the beforeOpen events in datasource we put script :
>> > if DBPARAM = "beta" then The datasource connect to "serverBeta"
>> > else
>> > The datasource connect to "serverAlpha"
>> >
>> > can we do this programmatically or must be in designer or how should i
>> > do to accomplish that condition?
>> >
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04367 seconds