Creating "DBConnection" from javax.sql.Datasource?

Hi,

I’m trying to embed clover etl engine in my application using clover API.

BTW i’m facing a problem with “org.jetel.connection.jdbc.DBConnection” object.

I’ve the requirements to build DBConnection objects starting from a “javax.sql.Datasource”
object created and managed by my application ( via apache commons-dbcp ).

I’ve just read other post in forums saying to use “JNDI” for this but this *is not a solution for me*
and in some real situation, assuming to have a JNDI context to lookup datasource is a bit
restrictive ( In particular i’m managing datasource objects using osgi declarative services ).

Looking at the code it seems not difficult, to modify the DBConnection object to achieve this.
It should be enough to add a constructor in “org.jetel.connection.jdbc.DBConnection” taking a javax.sql.Datasource
as parameter and modify the code of DBConnection connect method to take the connection from the Datasource
if the object has been built using Datasource.

Do you’ve any thought on this??

Thx in advance for the support

Andrea Zoppello

Hello Andrea,
this requirement doesn’t fit to our DBConnection idea, but we will change the class a bit, to be more extendable, so you will be able to write your own object, that extends the DBConnection and has all features you need.
The change will be available in 3.1 version, which is planned to be released within a month.

Hi,

Thank you for making this happen in 3.1 version.

BTW i’m interested to know a bit more, why having a DBConnection
built from a Datasource ( even if this does not come from JNDI ) does not fit well for you.

Cheers
Andrea