Skip to main content



      Home
Home » Archived » BIRT » Common Data-Source for all the reports
Common Data-Source for all the reports [message #163278] Mon, 22 May 2006 02:05 Go to next message
Eclipse UserFriend
Originally posted by: gandhimathi_p2002.yahoo.co.in

Hello Guys,
I have 15 reports .Whenever I change my DB connection, I need to change
the data-source in all of my 15 reports .I wish to have a common
data-source so that I can change at only one place.
Else I wish to read data-sources from one of my XMLs .
Plz suggest me how to do this.

Thanks in advance!
Mathi
Re: Common Data-Source for all the reports [message #163409 is a reply to message #163278] Mon, 22 May 2006 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lsellam.ebusinessinformation.fr

Mathi a écrit :
> Hello Guys,
> I have 15 reports .Whenever I change my DB connection, I need to change
> the data-source in all of my 15 reports .I wish to have a common
> data-source so that I can change at only one place.
> Else I wish to read data-sources from one of my XMLs .
> Plz suggest me how to do this.
>
> Thanks in advance!
> Mathi
>

Have you tried to make an rptTemplate?
Re: Common Data-Source for all the reports [message #163505 is a reply to message #163278] Mon, 22 May 2006 13:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cruzd.alum.rpi.edu

You can try creating a Library file with the Data Source you want defined
in it. Then use that Library file in your various reports. When you make
changes to your Library file, changes should carry through to the reports
using it.
Re: Common Data-Source for all the reports [message #163654 is a reply to message #163505] Tue, 23 May 2006 02:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
Thanks for the reply.I tried using library but culd not get a soln .
I have 2 doubts.
1)We are creating a data source for the report also .
Then how come it ll take libraries data source.

2)If I include library, thn the path of it is specified there.
<property
name="fileName">../../cvs/nios/resources/newLibrary.rptlibrary </property>

Everytime I deploy in my rmeote server , I have to change the path in each
and every report file.

Plz give a soln.
Thanks in advance.
Mathi
Re: Common Data-Source for all the reports [message #163894 is a reply to message #163654] Tue, 23 May 2006 17:03 Go to previous messageGo to next message
Eclipse UserFriend
Mathi, I have the same problem. The library seems to be the best
solution, but there doesn't seem to be a way to define a relative path for
the library file. We have over 100 reports and I really don't want to go
through each one and change the path to the library once the reports are
deployed to the server. Is there a better way to do this?
Re: Common Data-Source for all the reports [message #164038 is a reply to message #163894] Wed, 24 May 2006 05:32 Go to previous messageGo to next message
Eclipse UserFriend
I face the same problem pertaining to different development and deployment
environments, but in addition to libraries it is for drill-throughs also.
Can anybody help ?

Thanks,
Girish



"Erica" <erica.m.jackson@boeing.com> wrote in message
news:11111f245a95130131537dde91384932$1@www.eclipse.org...
> Mathi, I have the same problem. The library seems to be the best
> solution, but there doesn't seem to be a way to define a relative path for
> the library file. We have over 100 reports and I really don't want to go
> through each one and change the path to the library once the reports are
> deployed to the server. Is there a better way to do this?
>
Re: Common Data-Source for all the reports [message #164075 is a reply to message #163278] Wed, 24 May 2006 06:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: venaktar.euclid.com

hi,
if you want to common data source for all reports you have to do as
follows.

if you see .rptdesign file in editplus or any text editor
you will find following tags

<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc"
name="Data Source" id="26">
<property
name="odaDriverClass">oracle.jdbc.OracleDriver</property>
<property
name="odaURL">jdbc:oracle:thin:@10.152.11.17:1521:whiterab </property>
<property name="odaUser">metrikusbeta2</property>
<encrypted-property
name="odaPassword">bWV0cmlrdXNiZXRhMg==</encrypted-property >
</oda-data-source>
</data-sources>
Re: Common Data-Source for all the reports [message #164082 is a reply to message #163278] Wed, 24 May 2006 06:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: venaktar.euclid.com

hi,
if you want to common data source for all reports you have to do as
follows.

if you see .rptdesign file in editplus or any text editor
you will find following tags

<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc"
name="Data Source" id="26">
<property name="odaDriverClass">oracle.jdbc.OracleDriver</property>
<property
name="odaURL">jdbc:oracle:thin:@10.152.11.17:1521:whiterab </property>
<property name="odaUser">metrikusbeta2</property>
<encrypted-property
name="odaPassword">bWV0cmlrdXNiZXRhMg==</encrypted-property >
</oda-data-source>
</data-sources>

at run time we have an api to get these values.


so now you can write one property file where you can store you common db
details.

at run time you can retrive you common db properties and assign that
values to .rptdesign values.

the code as follows


getting db details from property file
runtimeProperties = RuntimeProperties.getInstance();
url = runtimeProperties.getProperty(
runtimeProperties.DB_PROPERTY, runtimeProperties.DB_URL);
user = runtimeProperties.getProperty(
runtimeProperties.DB_PROPERTY, runtimeProperties.DB_USER);
pwd = runtimeProperties.getProperty(
runtimeProperties.DB_PROPERTY,runtimeProperties.DB_PASSWORD) ;
dbName =
runtimeProperties.getProperty(runtimeProperties.DB_PROPERTY,
runtimeProperties.DB_NAME);
url = url + dbName;


getting data-source from .rptdesign and swap .rptdesign values with above
values.

DesignElementHandle desHndl = runnable.getDesignHandle();
// ReportDesignHandle rHandl=DesignEngine.openDesign(source);
// SlotHandle slHandle=rHandl.getSlot(rHandl.DATA_SOURCE_SLOT);
SlotHandle slHandle = desHndl
.getSlot(ReportDesignHandle.DATA_SOURCE_SLOT);
Iterator iter = slHandle.iterator();
while (iter.hasNext()) {
Object obj = iter.next();
OdaDataSourceHandle odaSrcHdl = (OdaDataSourceHandle) obj;
Iterator propIter = odaSrcHdl.getPropertyIterator();
while (propIter.hasNext()) {
PropertyHandle propHdl = (PropertyHandle) propIter.next();

if (propHdl.getPropertyDefn().getName().equalsIgnoreCase(
"odaURL")) {

propHdl.setStringValue(url);
} else if (propHdl.getPropertyDefn().getName()
.equalsIgnoreCase("odaUser")) {

propHdl.setStringValue(user);
} else if (propHdl.getPropertyDefn().getName()
.equalsIgnoreCase("odaPassword")) {

propHdl.setStringValue(pwd);
}
}
}
network data source [message #164089 is a reply to message #164082] Wed, 24 May 2006 06:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: user.domain.invalid

hi,
is it possible to connect Birt on a SQL server through a network
connection ?
Re: Common Data-Source for all the reports [message #164245 is a reply to message #164038] Wed, 24 May 2006 11:51 Go to previous messageGo to next message
Eclipse UserFriend
I had an idea based on venkata's post (Thanks by the way). As long as
your reports are deployed within the WEB-INF\classes directory, you ought
to be able to find the actual location of the library file deployed on
your server (via the classloader) and alter the report design to point to
that library. It does take a couple of seconds to drop and re-include the
library, but it might be a good workaround until a better solution comes
along.

Here is the code I came up with:

InputStream reportStream =
Thread.currentThread().getContextClassLoader().getResourceAs Stream(getReportFileLocation());
IReportRunnable design = engine.openReportDesign(reportStream);

ReportDesignHandle design = (ReportDesignHandle)report.getDesignHandle();

List libList = design.getAllLibraries();
LibraryHandle lib;
String libFile;
String newLibLocation;
int libFilePos;

// Change the location of the library files to match the
// deployed location
for (int i = 0; i < libList.size(); i++) {
lib = (LibraryHandle)libList.get(i);
libFile = lib.getFileName();

// Check for relative and absolute file paths
libFilePos = libFile.lastIndexOf("/");
if (libFilePos < 0) {
libFilePos = libFile.lastIndexOf("\\");
}
// If neither exist in the file name, then the file is stored
// in the same directory as the report, so do nothing
// otherwise, change the location of the library
if (libFilePos >= 0) {
libFile = libFile.substring(libFilePos + 1);
newLibLocation = Thread.currentThread()
.getContextClassLoader()
.getResource(STANDARD_REPORT_LOCATION + libFile)
.getPath();
newLibLocation = newLibLocation.replaceAll("\\%20", " ").substring(1);
newLibLocation = newLibLocation.replace('/', '\\');

design.dropLibrary(lib);
design.includeLibrary(newLibLocation, "");
}
}
Re: Common Data-Source for all the reports [message #166221 is a reply to message #164082] Thu, 01 June 2006 02:06 Go to previous message
Eclipse UserFriend
Originally posted by: gandhimathi_p2002.yahoo.co.in

Hello Frnds,
Still I m not clear how to have a common data source.
Thanks Venkata. I m trying wat u have suggested.But culdnt.
Venkata can you plz give me a clear vision.
If any one you have found a soln plz post it

Thanks
Regards
Mathi
Previous Topic:Background position in a pdf
Next Topic:The dataset used by the Chart is invalid
Goto Forum:
  


Current Time: Wed Apr 23 23:02:19 EDT 2025

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

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

Back to the top