[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.birt] Problems providing BIRT a JDBC connection using ODA driverBridge
|
- From: mniki25@xxxxxxxxx (Mike )
- Date: Tue, 4 Nov 2008 18:16:30 +0000 (UTC)
- Newsgroups: eclipse.birt
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
I have a JEE application that has a JDBC connection pool. I want to
provide a connection from this pool to BIRT, which is integrated into this
app using the BIRT Report Engine API.
This post on BIRT World outlines exactly what I need, however I've not
been able to get it working.
http://birtworld.blogspot.com/2007/01/birt-connection-pooling-continued.html
Here is what I've done and I'll try to provide as much detail as possible
in case someone out there can see where I've gone wrong. When my app
starts it loads BIRT and sets the parent classloader:
engine.getConfig().getAppContext().put(
EngineConstants.APPCONTEXT_CLASSLOADER_KEY, getClass().getClassLoader() );
I then created a plug-in with the following plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
id="x.y.z.reporting.birtjdbc"
point="org.eclipse.datatools.connectivity.oda.consumer.driverBridge">
<bridge
driverType="net.sourceforge.jtds.jdbc.Driver"
bridgeId="x.y.z.reporting.birtjdbc">
</bridge>
</extension>
<extension
point="org.eclipse.datatools.connectivity.oda.dataSource">
<dataSource
odaVersion="3.0"
driverClass="x.y.z.reporting.BirtJdbcDriver"
defaultDisplayName="My JDBC Driver Bridge"
setThreadContextClassLoader="false"
id="x.y.z.reporting.birtjdbc"/>
</extension>
</plugin>
I did not use the Eclipse PDE to create the plugin, rather I created it by
hand using the example in the blog post. I then created a directory
called x.y.z.reporting.birtjdbc under my ReportEngine/plugins directory
and copied the plugin.xml file to it.
Next I created the class x.y.z.reporting.BirtJdbcDriver, which extends
OdaJdbcDriver. This class is identical to the example except that it
looks for the Connection using the key "x.y.z.reporting.BirtJdbcDriver".
This class is packaged up with my JEE app, but should be accessible to
BIRT because I've set its parent classloader.
Before I run any report task, I add my JDBC connection to the appContext
from the task:
appContext.put( "x.y.z.reporting.BirtJdbcDriver", myJdbcConnection );
My reports are designed with a datasource set to use the jTDS driver
net.sourceforge.jtds.jdbc.Driver. In the BIRT designer I can run reports
that access a database with the defined JDBC URL and I can see results
from the database.
However when I try to run these reports in my app server I was seeing
ClassNotFoundError's on the jTDS driver. I thought setting the parent
classloader in BIRT would take care of this since that lib is in my apps
classpath. Next I dropped my jtds.jar file in the drivers directory of my
oda.jdbc plugin and fired up my app again. This time BIRT loaded my JDBC
driver but it used the connection information defined in my report to talk
to the database, not my driverBridge plugin.
I've turned up the logging in BIRT to FINEST but it does not emit anything
to the log about failing to load my plugin, and I've debugged my app and
it doesn't attempt to create a new instance of my BirtJdbcDriver class.
So at this point I have two problems, which could be related. First is
that BIRT can't load my JDBC driver if I do not put the library in the
drivers directory of the oda.jdbc plugin. Second is BIRT does not use my
configured driverBridge plugin. Does anyone have any thoughts on how I
can resolve either of these issues. Thanks