Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

org.apache.commons.dbcp.BasicDataSource and JasperReports

koszta5Dec 23 2010 — edited Dec 24 2010
Hi folks,

I am creating some jasper reports from our database. I am using commons library and spring framework...

I have a bean declaration in applicationContext.xml

<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
<property name="driverClassName" value="${database.driverClassName}"/>
<property name="url" value="${database.url}"/>
<property name="username" value="${database.username}"/>
<property name="password" value="${database.password}"/>
<property name="validationQuery" value="SELECT 1 FROM DUAL"/>
<property name="testOnBorrow" value="true"/>
</bean>

This bean connects me to our database. Now I would love to use this class for connection in my Jasperreport creating class (not establishing a new connection but getting my existing AND configured bean). I can create a new BasicDataSource BUT that is not configured.
Is there a way for me to get my configured bean in my java code ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 21 2011
Added on Dec 23 2010
1 comment
1,090 views