# Construct DBConnection from java.sql.DataSource?

**URL:** <https://forum.cloverdx.com/t/construct-dbconnection-from-java-sql-datasource/779>\
**Category:** CloverDX Platform\
**Created:** [November 16, 2010, 12:00am UTC](https://forum.cloverdx.com/t/construct-dbconnection-from-java-sql-datasource/779 "2010-11-16T00:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpdi](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/tpdi/32/110_2.png) [@tpdi](https://forum.cloverdx.com/u/tpdi)\
**Post date:** [November 16, 2010, 12:00am UTC](https://forum.cloverdx.com/t/construct-dbconnection-from-java-sql-datasource/779/1 "2010-11-16T00:00:00Z")

</div>

Reading the CloverETL Javadoc, I don’t see a way to construct an org.jetel.connection.jdbc.DBConnection from a javax.sql.DataSource.

I’d like to invoke the CloverETL engine from a Java class, but I’d like to use a javax.sql.DataSource as, well, my datasource. From the javaDoc, it seems that the only way to construct an org.jetel.connection.jdbc.DBConnection is by passing a java.util.Properties instance or a config filename.

What am I doing wrong?

Thanks.

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [November 19, 2010, 8:55am UTC](https://forum.cloverdx.com/t/construct-dbconnection-from-java-sql-datasource/779/2 "2010-11-19T08:55:16Z")

</div>

Hello,  
as you’ve written, database connection can be built in from properties or properties file. But there are two ways to connect to database: with jdbc driver or with data source. In the second case you need to provide jndi name; that means that properties or property file must contain at least one property - _jndiName_. Clover will find the data source when trying to connect to database.
