[activemq-user] can I specify the JDBC adapter in the data source bean?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[activemq-user] can I specify the JDBC adapter in the data source bean?

Jeff Sparkes
In http://activemq.codehaus.org/JDBC+Support,  it says that the JDBC
adapter class can be
set on the <jdbcPersistence> element.   I understand why this is, but
it seems that it would
make more sense to also be able to set it on the bean.  Then the
dataSourceRef could be
changed without having to worry about keeping the adapterClass in sync
because its in the
bean.  Logically, the adapter class should be linked to the data
source since it's value
depends on the data source driver.

This might be possible now with the Spring configuration but I quickly
got confused.
Reply | Threaded
Open this post in threaded view
|

Re: [activemq-user] can I specify the JDBC adapter in the data source bean?

chirino
Hi Jeff,

On Nov 23, 2005, at 1:34 PM, Jeff Sparkes wrote:

> In http://activemq.codehaus.org/JDBC+Support,  it says that the JDBC
> adapter class can be
> set on the <jdbcPersistence> element.   I understand why this is, but
> it seems that it would
> make more sense to also be able to set it on the bean.  Then the

Which bean are you referring to?

> dataSourceRef could be
> changed without having to worry about keeping the adapterClass in sync
> because its in the
> bean.  Logically, the adapter class should be linked to the data
> source since it's value
> depends on the data source driver.
>

If the adapterClass is not specified, we currently get a connection  
from the datasource and inspect the driver to choose the most  
appropriate adapter for the given driver.  So in most cases you don't  
need to specify the adapterClass at all.  You only need to specify it  
when you want to use a custom adapter class or if you are using a  
database that we do not currently have support for.

Regard,
Hiram

> This might be possible now with the Spring configuration but I quickly
> got confused.
>

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-user] can I specify the JDBC adapter in the data source bean?

Jeff Sparkes
On 11/23/05, Hiram Chirino <[hidden email]> wrote:
> On Nov 23, 2005, at 1:34 PM, Jeff Sparkes wrote:
>
> > In http://activemq.codehaus.org/JDBC+Support,  it says that the JDBC
> > adapter class can be
> > set on the <jdbcPersistence> element.   I understand why this is, but
> > it seems that it would
> > make more sense to also be able to set it on the bean.  Then the
>
> Which bean are you referring to?

The bean named  as the dataSourceRef.


>
> > dataSourceRef could be
> > changed without having to worry about keeping the adapterClass in sync
> > because its in the
> > bean.  Logically, the adapter class should be linked to the data
> > source since it's value
> > depends on the data source driver.
> >
>
> If the adapterClass is not specified, we currently get a connection
> from the datasource and inspect the driver to choose the most
> appropriate adapter for the given driver.  So in most cases you don't
> need to specify the adapterClass at all.  You only need to specify it
> when you want to use a custom adapter class or if you are using a
> database that we do not currently have support for.
>
> Regard,
> Hiram

This is just a suggestion...

I'm using the JSQLConnect driver of SqlServer from jnetdirect.  It
needs to use the
org.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor, and I thought
it felt unnatural
to have to say
 <jdbcPersistence  dataSourceRef = "jnet-ds" adapterClass="org.activemq.
store.jdbc.adapter.ImageBasedJDBCAdaptor"/>
when the adapter is related to data source class, not the persistence.

If I wanted to go back to Derby, for example, I'd have to change the
value of dataSourceRef, AND remove the adapterClass attribute.   Since
I'm lazy and forgetful,
I'd probably forget the adapterClass and waste time figuring out
what's going wrong.

This isn't an issue for databases defined in
/META-INF/services/org/activemq/store/jdbc/,
but could be a problem for someone trying out a new data source.

I can't remember if I sent in this yet, but the conf file for JSQLConnect is:
*** /dev/null   Mon Nov 28 14:23:50 2005
--- modules/core/src/conf/META-INF/services/org/activemq/store/jdbc/jnetdirect_jsqlconnect_4_0_-_jdbc_2_0
      Fri Nov 18 16:09:35 2005
***************
*** 0 ****
--- 1 ----
+ org.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor


This should be safe in a mail messae because there aren't any tabs!