You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by bokie <jm...@gmail.com> on 2013/10/19 22:41:16 UTC

DataSourceFactory

Hi,

I've been reading the specs and looking at some implemented examples of the
DataSourceFactory
(https://ops4j1.jira.com/wiki/display/PAXJDBC/Native+Driver+Adapters).

And, after looking at the "JDBC idea" in OSGi, I must admit that it wasn't
what I expected to find - I was expecting to find the "PROVIDER" paradigm
(in the single instance sense) instead of the "CREATOR" paradigm:
   createConnectionPoolDataSource(java.util.Properties props)
   createDataSource(java.util.Properties props)
   createDriver(java.util.Properties props)
   createXADataSource(java.util.Properties props)

Could someone clear up the thought behind DataSourceFactory; who are the
intended clients of the factory service - it doesn't make sense for a client
to receive a freshly created datasource every time it needs to interact with
the database.

Thanks,
Jorge




--
View this message in context: http://apache-felix.18485.x6.nabble.com/DataSourceFactory-tp5005667.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DataSourceFactory

Posted by "Guillaume Sauthier (OW2/GMail)" <gu...@gmail.com>.
DataSourceFactory is intended to creative native database connection.
Just see that as a factory for db connection (DataSource creates
Connection, Driver creates Connection, PooledDataSource creates
PooledConnection and XADataSource creates XACOnnection).

Pooling, transaction management has to be performed in another part.

What is really confusing is that there are 2 semantics behind the
DataSource interface:
* It's a native connection factory provided by the DB vendor
* It's also the interface used by the end consumer that hides connection
pooling, transaction management, ...

So, DataSourceFactory has to be used to provide real connections for a
end-user's DataSource. It's not intended for direct end-user's usage.

Hope that helps to clarify
--G


2013/10/21 Felix Meschberger <fm...@adobe.com>

>
> You might also want to ask on users(at)aries(dot)apache(dot)org. The Aries
> project has an implementation of the OSGi JDBC specification and AFAICT at
> least some of the project members have been involved in the spec creation
> and certainly know more.
>
> Regards
> Felix
>
> Am 20.10.2013 um 07:30 schrieb David Jencks:
>
> > You might ask on an ops4j list, I don't think felix implements anything
> like this.
> >
> > FWIW if you look up a datasource in jndi you are supposed to receive a
> new instance on each lookup.  Datasources are ways of getting connections,
> not the actual connections.  Depending on the implementation when you get a
> connection from a datasource you might get a new connection or you might
> get a connection checked out from a pool.
> >
> > david jencks
> >
> > On Oct 19, 2013, at 1:41 PM, bokie <jm...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> I've been reading the specs and looking at some implemented examples of
> the
> >> DataSourceFactory
> >> (https://ops4j1.jira.com/wiki/display/PAXJDBC/Native+Driver+Adapters).
> >>
> >> And, after looking at the "JDBC idea" in OSGi, I must admit that it
> wasn't
> >> what I expected to find - I was expecting to find the "PROVIDER"
> paradigm
> >> (in the single instance sense) instead of the "CREATOR" paradigm:
> >>  createConnectionPoolDataSource(java.util.Properties props)
> >>  createDataSource(java.util.Properties props)
> >>  createDriver(java.util.Properties props)
> >>  createXADataSource(java.util.Properties props)
> >>
> >> Could someone clear up the thought behind DataSourceFactory; who are the
> >> intended clients of the factory service - it doesn't make sense for a
> client
> >> to receive a freshly created datasource every time it needs to interact
> with
> >> the database.
> >>
> >> Thanks,
> >> Jorge
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> http://apache-felix.18485.x6.nabble.com/DataSourceFactory-tp5005667.html
> >> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
>

Re: DataSourceFactory

Posted by Felix Meschberger <fm...@adobe.com>.
You might also want to ask on users(at)aries(dot)apache(dot)org. The Aries project has an implementation of the OSGi JDBC specification and AFAICT at least some of the project members have been involved in the spec creation and certainly know more.

Regards
Felix

Am 20.10.2013 um 07:30 schrieb David Jencks:

> You might ask on an ops4j list, I don't think felix implements anything like this.
> 
> FWIW if you look up a datasource in jndi you are supposed to receive a new instance on each lookup.  Datasources are ways of getting connections, not the actual connections.  Depending on the implementation when you get a connection from a datasource you might get a new connection or you might get a connection checked out from a pool.
> 
> david jencks
> 
> On Oct 19, 2013, at 1:41 PM, bokie <jm...@gmail.com> wrote:
> 
>> Hi,
>> 
>> I've been reading the specs and looking at some implemented examples of the
>> DataSourceFactory
>> (https://ops4j1.jira.com/wiki/display/PAXJDBC/Native+Driver+Adapters).
>> 
>> And, after looking at the "JDBC idea" in OSGi, I must admit that it wasn't
>> what I expected to find - I was expecting to find the "PROVIDER" paradigm
>> (in the single instance sense) instead of the "CREATOR" paradigm:
>>  createConnectionPoolDataSource(java.util.Properties props)
>>  createDataSource(java.util.Properties props)
>>  createDriver(java.util.Properties props)
>>  createXADataSource(java.util.Properties props)
>> 
>> Could someone clear up the thought behind DataSourceFactory; who are the
>> intended clients of the factory service - it doesn't make sense for a client
>> to receive a freshly created datasource every time it needs to interact with
>> the database.
>> 
>> Thanks,
>> Jorge
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://apache-felix.18485.x6.nabble.com/DataSourceFactory-tp5005667.html
>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


Re: DataSourceFactory

Posted by David Jencks <da...@yahoo.com>.
You might ask on an ops4j list, I don't think felix implements anything like this.

FWIW if you look up a datasource in jndi you are supposed to receive a new instance on each lookup.  Datasources are ways of getting connections, not the actual connections.  Depending on the implementation when you get a connection from a datasource you might get a new connection or you might get a connection checked out from a pool.

david jencks

On Oct 19, 2013, at 1:41 PM, bokie <jm...@gmail.com> wrote:

> Hi,
> 
> I've been reading the specs and looking at some implemented examples of the
> DataSourceFactory
> (https://ops4j1.jira.com/wiki/display/PAXJDBC/Native+Driver+Adapters).
> 
> And, after looking at the "JDBC idea" in OSGi, I must admit that it wasn't
> what I expected to find - I was expecting to find the "PROVIDER" paradigm
> (in the single instance sense) instead of the "CREATOR" paradigm:
>   createConnectionPoolDataSource(java.util.Properties props)
>   createDataSource(java.util.Properties props)
>   createDriver(java.util.Properties props)
>   createXADataSource(java.util.Properties props)
> 
> Could someone clear up the thought behind DataSourceFactory; who are the
> intended clients of the factory service - it doesn't make sense for a client
> to receive a freshly created datasource every time it needs to interact with
> the database.
> 
> Thanks,
> Jorge
> 
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/DataSourceFactory-tp5005667.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DataSourceFactory

Posted by Peter Kriens <pe...@aqute.biz>.
Jorge,
You raise a very valid point and I hope that in a future specification this will be addressed. In this case I've created a 'managed' JDBC bundle that uses Configuration Admin and Data Source Factory services to create an XA Data Source service. Since JPA has a similar issue, I also created a 'managed' JPA in the same vein. By creating a Configuration Admin configuration factory record, you create a configured instance.

However, in this case I still need the Data Source Factory service to create configured XA Data Source objects. I found that H2 implements this out of the box, I did it myself for MySQL and hope to get this work in their code base since it is quite trivial to do. 

This is still experimental but you can find this at: http://github.com/osgi/osgi.bundles and feedback is appreciated.

Kind regards,

	Peter Kriens



On 19 okt. 2013, at 22:41, bokie <jm...@gmail.com> wrote:

> Hi,
> 
> I've been reading the specs and looking at some implemented examples of the
> DataSourceFactory
> (https://ops4j1.jira.com/wiki/display/PAXJDBC/Native+Driver+Adapters).
> 
> And, after looking at the "JDBC idea" in OSGi, I must admit that it wasn't
> what I expected to find - I was expecting to find the "PROVIDER" paradigm
> (in the single instance sense) instead of the "CREATOR" paradigm:
>   createConnectionPoolDataSource(java.util.Properties props)
>   createDataSource(java.util.Properties props)
>   createDriver(java.util.Properties props)
>   createXADataSource(java.util.Properties props)
> 
> Could someone clear up the thought behind DataSourceFactory; who are the
> intended clients of the factory service - it doesn't make sense for a client
> to receive a freshly created datasource every time it needs to interact with
> the database.
> 
> Thanks,
> Jorge
> 
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/DataSourceFactory-tp5005667.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org