I am using ActiveMQ-4.0-RC1 with a MySQL database v5 for persistence. When
it opens the connection, it dies because the autocommit was not turned off
before doing commits. Is there a way I can turn autocomits off, or is this
something that ActiveMq should have as default behavior for MySql databases?
Here is the code
========================================
m_jmsBroker = new BrokerService();
m_jmsBroker.setUseJmx(true);
Class.forName("com.mysql.jdbc.Driver").newInstance();
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setDatabaseName("jmsdb");
dataSource.setUser("xxxxx");
dataSource.setPassword("xxxxxxxxxx");
dataSource.setPort(6033);
JDBCPersistenceAdapter persistor = new JDBCPersistenceAdapter();
persistor.setDataSource(dataSource);
m_jmsBroker.setPersistent(true);
m_jmsBroker.setPersistenceAdapter(persistor);
m_jmsBroker.addConnector("tcp://localhost:61616");
m_jmsBroker.start();
==========================================
Here is the log
==========================================
INFO JmsBrokerManager.start() Using dataSource jdbc:mysql://:6033/jmsdb
-- 10:39:10.125
INFO ActiveMQ 4.0-RC1 JMS Message Broker (SegOneJmsBroker) is starting --
10:39:10.359
INFO For help or more information please see: http://www.logicblaze.com
-- 10:39:10.359
INFO Database driver recognized: [mysql-ab_jdbc_driver] -- 10:39:10.593
DEBUG Error while closing connection: Can't call commit when
autocommit=true -- 10:39:10.593
java.sql.SQLException: Can't call commit when autocommit=true
at com.mysql.jdbc.Connection.commit(Connection.java:2145)
at
org.apache.activemq.store.jdbc.TransactionContext.close(TransactionContext.java:119)
at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.createAdapter(JDBCPersistenceAdapter.java:252)
at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getAdapter(JDBCPersistenceAdapter.java:212)
at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.start(JDBCPersistenceAdapter.java:138)
at
org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:902)
at
org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:863)
at
org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:443)
at
org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:136)
at
org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:126)
...
--
View this message in context:
http://www.nabble.com/MySQL-Persistence-fails-on-autocommit.-t1366465.html#a3664079
Sent from the ActiveMQ - User forum at Nabble.com.