datatonic / duke

Automatically exported from code.google.com/p/duke
0 stars 0 forks source link

Configure Database connection via JNDI #47

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We have a web application were all database connections are configured via 
JNDI. This allows us, for example, to set up different database connections for 
the test and our production system without maintaining different war files. 

A datasource configuration could look like this:

<jdbc>
    <param name="jndi-path" value="java:comp/env/jdbc/CONNECTION_NAME"/>

    <column name=.../>
</jdbc>

The actual data source would be configured within the context of the web 
application's servlet container.

In any case: nice project!

Original issue reported on code.google.com by FMitzl...@googlemail.com on 4 Nov 2011 at 8:21

GoogleCodeExporter commented 8 years ago
I think this is a very good feature request, but I wonder how to support it.

Should we add a new <jndi> data source that shares most of the code with the 
jdbc data source? Should the JDBC data source be extended with a connection 
factory concept, where JNDI is one possible factory? Or should we just have it 
like you suggest, as an alternative config setting?

Open to suggestions on this one.

Patches to the JDBC data source also welcome, if you feel like trying it.

Original comment by lar...@gmail.com on 4 Nov 2011 at 10:11

GoogleCodeExporter commented 8 years ago

Original comment by lar...@gmail.com on 4 Nov 2011 at 10:13

GoogleCodeExporter commented 8 years ago
I just implemented it the easy way - that is as an alternative configuration by 
subclassing the JDBCDataSource and extending the JDBCUtils class. Though 
putting both data sources into one class could probably be a bit cleaner...

Sorry for the lame question, but how should I submit a patch?

Original comment by FMitzl...@googlemail.com on 4 Nov 2011 at 11:21

GoogleCodeExporter commented 8 years ago
Great!

There are two ways you can do it. One is to simply paste the diff into a 
comment. Another is to clone the repository 
http://code.google.com/p/duke/source/clones, commit the patch, and push it back 
to Google Code. Then I can pull it from there.

Original comment by lar...@gmail.com on 4 Nov 2011 at 11:28

GoogleCodeExporter commented 8 years ago
Ok - I managed to go the mercurial way... You can find my changes in the 
fmitzlaff-clone.

Original comment by FMitzl...@googlemail.com on 4 Nov 2011 at 12:37

GoogleCodeExporter commented 8 years ago
Great stuff! In a meeting now. Will go through in detail tonight.

Original comment by lar...@gmail.com on 4 Nov 2011 at 12:48

GoogleCodeExporter commented 8 years ago
Added your patch now, with some minor formatting tweaks. Great work! Thank you!

Original comment by lar...@gmail.com on 4 Nov 2011 at 7:12