This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Skip to end of metadata
Go to start of metadata

We support a range of SQL databases for message persistence such as

as well as a number of generic JDBC providers.

Auto-discovery of your JDBC provider

We try to auto-detect from the JDBC driver which JDBCAdapter to use via these config files and the return string from the JDBC driver.

If you have a JDBC database which we don't support then please let us know what JDBC driver string you're getting and drop us a note or raise an issue in our support database and we'll fix it pretty quickly.

If your database is not in the above list it is normally a matter of tweaking the StatementProvider to ensure that the JDBCMessageStore uses the right flavour of SQL. So normally most databases support one of these providers...


You can explicitly specify the JDBC adaptor using its xbean identifier, inside the activemq.xml...

<jdbcPersistenceAdapter adapter="postgresql-jdbc-adapter"/>

Customizing the SQL DDL

You can confiugure the various SQL datatypes - such as column sizes and so forth - using the statements element

  <broker useJmx="false">

      <journaledJDBC useJournal="false">
          <statements stringIdDataType ="VARCHAR(128)"/>


For more info on what attributes can be set on the statements element, see the Statements class. All the settable bean properties can be used as attributes of the <statements> element.

Using MySQL

If you are using MySQL then you should set the relaxAutoCommit flag to be true. e.g.

  <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"/>

To see this in action see the default configuration file

For AMQ 3.x

In 3.x you can specify the adapter as follows

<jdbcPersistence adapterClass="">
  • No labels

1 Comment

  1. 1. The sample code should is explicit to AMQ 3.x. Modofiy the ff. it to the code below :

    You can explicitly specify the JDBC ....

    <jdbcPersistenceAdapter  adapterClass=""/>

    or in AMQ 3.x

    <jdbcPersistence adapterClass="">

    2. The config files link points to a dead link. Change it to :