I'm using a spring managed DataSource throughout my web application. The data source is a C3P0 connection pool using the jDTS JDBC driver to connect to a MS SQl Server database. All of this happens under Tomcat 5.0.28. Everything is good in the world...
So, now we've starting using Crystal Reports to generate reports, and there doesn't seem to be a way to hand it a DataSource programmatically (i.e. setDataSource(...)). The only way to effectively give it a DataSource is by making the DataSource available via JNDI.Code:<bean id="pooledDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass"><value>${jdbc.driverClassName}</value></property> <property name="jdbcUrl"><value>${jdbc.url}</value></property> <property name="user"><value>${jdbc.username}</value></property> <property name="password"><value>${jdbc.password}</value></property> </bean>
Is there a way to have spring "publish" (not sure what the terminology is) a DataSource it is managing to JNDI or do I have to create the DataSource and place it in JNDI myself, and then use JndiObjectFactoryBean?
I really like keeping everything spring managed for consistency's sake. And I think that if I go the second route, I'll have to drop my JDBC and C3P0 jars into common/lib... we generally try to keep all jars for a web app with the web app.
Any ideas?
Christian


Reply With Quote