nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Burgess <>
Subject Re: Spring JdbcTemplate, SimpleJdbcCall and DataSource
Date Mon, 09 Jan 2017 14:18:53 GMT

I'm guessing the original DBCPService API only has getConnection()
because that was all that was really needed by the processors at the
time, and/or to keep more control over the DataSource object (for
example, the controller service's shutdown() method closes the
DataSource). Having said that, NiFi has extended other APIs to allow
more access to the underlying objects, with the caveat that the user
must take care of more of the "plumbing"/lifecycle. An example is the method [1] which returns an InputStream
(rather than requiring an InputStreamCallback to which the InputStream
is provided and otherwise managed by the framework).

For that reason, and because DataSource is part of javax.sql vs.
needing an additional DBCP dependency in the API, I think
getDataSource() is a legitimate addition to the DBCPService API if you
have other NiFi work that requires it.  One thing to note: the
nifi-hive-nar supplies subclasses of DBCPService, so any changes to
the API would have to be implemented in those subclasses as well
(HiveConnectionPool [2], unit tests, etc.)



On Mon, Jan 9, 2017 at 4:20 AM, Toivo Adams <> wrote:
> Spring JdbcTemplate, SimpleJdbcCall and DataSource
> Does anybody use Spring JdbcTemplate, SimpleJdbcCall?
> Both take DataSource constructor parameeter and not Connection.
> And later when SimpleJdbcCall (or JdbcTemplate) need Connection, it will ask
> it from DataSource and release afterwards.
> Currently DBCPService returns only Connection.
> I want to add method which returns also DataSource.
> Opinions?
> Thanks
> Toivo
> --
> View this message in context:
> Sent from the Apache NiFi Developer List mailing list archive at

View raw message