Skip to main content



      Home
Home » Archived » BIRT » Specifying DataSource outside of report
Specifying DataSource outside of report [message #246313] Wed, 04 July 2007 11:46 Go to next message
Eclipse UserFriend
Hello,

I'm looking for a way to override the datasource defined in the report at
runtime. When I need to achieve is:

1. Pass in a DataSource object from JUnit tests (connects to local Derby
database)
2. Pass DataSource to real database from command line tool
3. Pass pooled JNDI DataSource from Tomcat into the report.

I understand that I can achieve #3 with defining a JNDI DataSource in the
report but I haven't found a way yet to do #1 and #2. Currently, I'm using
2.1.2.

Any pointers?

Regards,

Aaron Digulla
Re: Specifying DataSource outside of report [message #246318 is a reply to message #246313] Wed, 04 July 2007 12:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Martin.Ahrer.gmx.at

For #1 & #2 you can just create your own data source and associate it
with the database and jndi url -> Just behave like if you are a
container (like tomcat)

use the apache naming components and set up a data source with some XML
as shown below

<?xml version="1.0" encoding="utf-8"?>
<naming>
<context>
<resource name="jdbc/dsname" type="javax.sql.DataSource">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value >
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@server:1526:inst</value>
</parameter>
<parameter>
<name>username</name>
<value>???</value>
</parameter>
<parameter>
<name>password</name>
<value>??</value>
</parameter>
</resource>
</context>
</naming>


Aaron Digulla schrieb:
> Hello,
>
> I'm looking for a way to override the datasource defined in the report
> at runtime. When I need to achieve is:
>
> 1. Pass in a DataSource object from JUnit tests (connects to local Derby
> database)
> 2. Pass DataSource to real database from command line tool
> 3. Pass pooled JNDI DataSource from Tomcat into the report.
>
> I understand that I can achieve #3 with defining a JNDI DataSource in
> the report but I haven't found a way yet to do #1 and #2. Currently, I'm
> using 2.1.2.
>
> Any pointers?
>
> Regards,
>
> Aaron Digulla
>
Re: Specifying DataSource outside of report [message #246467 is a reply to message #246318] Thu, 05 July 2007 08:45 Go to previous message
Eclipse UserFriend
Martin Ahrer wrote:

>> 1. Pass in a DataSource object from JUnit tests (connects to local Derby
>> database)
>> 2. Pass DataSource to real database from command line tool
>> 3. Pass pooled JNDI DataSource from Tomcat into the report.
> For #1 & #2 you can just create your own data source and associate it
> with the database and jndi url -> Just behave like if you are a
> container (like tomcat)

Good idea. I'm already using mockejb which comes with a JNDI context so
setting up my own context (even without XML) is easy. The report designer,
I can use BIRT's fallback mechanism as described on
http://wiki.eclipse.org/BIRT/FAQ/Data_Access#Q:_What_is_the_ precedence_when_both_JDBC_URL_and_JNDI_name_are_specified.3F

Regards,

Aaron Digulla
Previous Topic:Yellowfin 3.2 release notes
Next Topic:Birt and Hibernate Help
Goto Forum:
  


Current Time: Sun Jul 13 19:40:13 EDT 2025

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

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

Back to the top