1、配置数据库连接
C:\M\apache-activemq-5.14.1\confactivemq.xml添加数据库连接数据。
1、1替换数据库连接
<persistenceAdapter> <jdbcPersistenceAdapter dataDirectory="${activemq.base}/data" dataSource="#mysqlDB"/> <!--<kahaDB directory="${activemq.data}/kahadb"/>--> </persistenceAdapter>
1、2增加连接数据库信息
<bean id="mysqlDB" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost/test?relaxAutoCommit=true"/> <property name="username" value="root"/> <property name="password" value="root"/> <property name="maxActive" value="200"/> <property name="poolPreparedStatements" value="true"/> </bean>
![](http://dl2.iteye.com/upload/attachment/0125/1908/39b6145e-ade5-31da-a1ff-f11466cc93bd.png)
2、增加连接数据jar文件至MQ引用文件夹
下载commons-dbcp.jar,commons-pool.jar,mysql-onnector-java.jar三个文件
复制jar文件到C:\M\apache-activemq-5.14.1\lib文件夹
3、启动mq结果
![](http://dl2.iteye.com/upload/attachment/0125/1910/281f0785-4006-31aa-a0c1-2cff07265e62.png)