You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by krv <vi...@onmobile.com> on 2007/10/25 06:05:15 UTC

Problem using MySql as data source for Persistance Adapter

Hi,
I am trying to use MySql as data source for Persistance Adapter. I am using
the following configuration:

    <persistenceAdapter>
       <!--  <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data" dataSource="#mysql-ds"/>
      To use a different datasource, use the following syntax : -->
      <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
dataSource="#mysql-ds"/>
    </persistenceAdapter>
  
  <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url"
value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
    <property name="username" value="activemq"/>
    <property name="password" value="activemq"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>
   

When I start activemq the tables (activemq_acks, activemq_lock,
activemq_msgs) are created but it is not able to get the lock on the
database. It keeps printing the log repeatedly as follows:

INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive
lock to become the Master broker
INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive
lock to become the Master broker
INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive
lock to become the Master broker

After this the process does not stop. I have to kill it.

Anybody has any idea what's wrong here?
-- 
View this message in context: http://www.nabble.com/Problem-using-MySql-as-data-source-for-Persistance-Adapter-tf4688504s2354.html#a13399921
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Problem using MySql as data source for Persistance Adapter

Posted by soloist <v....@gmail.com>.
the only difference is that journaledJDBC is now using built in journal
before writing to the db directly.A lot faster but as far as i know not so
failsafe in a clustering solution. If you changed that config something like
this:
<jdbcPersistenceAdapter dataSource="#mysql-ds" useDatabaseLock="false"/> 
this will use directly the db. Which is a lot slower but more reliable if
you need a solution like that

Mete
-- 
View this message in context: http://www.nabble.com/Problem-using-MySql-as-data-source-for-Persistance-Adapter-tf4688504s2354.html#a13406436
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Problem using MySql as data source for Persistance Adapter

Posted by soloist <v....@gmail.com>.
the only difference is that journaledJDBC is now using built in journal
before writing to the db directly.A lot faster but as far as i know not so
failsave in a clustering solution. If you changed that config something like
this:
<jdbcPersistenceAdapter dataSource="#mysql-ds" useDatabaseLock="false"/> 
this will use directly the db. Which is a lot slower but more reliable if
you need a solution like that

Mete
-- 
View this message in context: http://www.nabble.com/Problem-using-MySql-as-data-source-for-Persistance-Adapter-tf4688504s2354.html#a13406436
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Problem using MySql as data source for Persistance Adapter

Posted by krv <vi...@onmobile.com>.
Thanks for your reply. Its working now.

Hope I can manage without master-slave model for now, but I think going
forward I'll also need to use 5.0.

I have the following config now:
    <persistenceAdapter>
      <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data" dataSource="#mysql-ds"
useDatabaseLock="false"/>
    </persistenceAdapter>
I did not find the 'jdbcPersistenceAdapter' tag in my config file which you
mentioned. Think it makes no difference.


soloist wrote:
> 
> hello,
> i guess you are using 4.1.1 there seems to be a problem with this release.
> If this will be the only broker that you will use(no master slave) add the 
> useDatabaseLock="false"
> on 
> <jdbcPersistenceAdapter
> 
> if not you can upgrade to the latest 5.0-SNAPHSOT.
> 
> Cheers
> Mete
> 

-- 
View this message in context: http://www.nabble.com/Problem-using-MySql-as-data-source-for-Persistance-Adapter-tf4688504s2354.html#a13403660
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Problem using MySql as data source for Persistance Adapter

Posted by soloist <v....@gmail.com>.
hello,
i guess you are using 4.1.1 there seems to be a problem with this release.
If this will be the only broker that you will use(no master slave) add the 
useDatabaseLock="false"
on 
<jdbcPersistenceAdapter

if not you can upgrade to the latest 5.0-SNAPHSOT.

Cheers
Mete
-- 
View this message in context: http://www.nabble.com/Problem-using-MySql-as-data-source-for-Persistance-Adapter-tf4688504s2354.html#a13403331
Sent from the ActiveMQ - User mailing list archive at Nabble.com.