Tables not created with JdbcEventStorageEngine

I am migrating from MongoDB to Mysql to persist events.
So I simply change the used storage engine :

@Resource(lookup = “jdbc/mysqlpool”)
DataSource sqlSource;

JdbcEventStorageEngine eventStorage = new JdbcEventStorageEngine(
new DBObjectXStreamSerializer()

axonConfiguration = DefaultConfigurer.defaultConfiguration()
.configureEmbeddedEventStore(c -> eventStorage)


And that’s all (the rest was working well with mongo).

But now I have a error caused by event that can not be persisted :

Command 'xx.xx.XxxxXxxxCommand' resulted in org.axonframework.eventsourcing.eventstore.EventStoreException(An event for aggregate [99999999-b00c-4187-9726-dd3c6db15f9a] at sequence [0] could not be persisted)

This is because the mysql database contains no tables : the schema is not created.

I browsed forums, and it appears that it should be automatically done.
So what is the reason ?

Hi Fred,

To store events in MySQL, Axon offers two options: directly through JDBC (what you’re doing right now), or JPA. In neither case will the schema be created automatically by Axon.

When using the JdbcEventStorageEngine, you can have your application invoke the createSchema method to force schema creation. When using JPA, Spring or Hibernate can force schema creation (with default settings, Spring Boot would do this on an embedded database like H2 but not on a MySQL).

Since you’re going through this event store migration effort anyway, one other option you could consider is to use AxonDB - the built for purpose event store by AxonIQ. You wouldn’t have to worry about schema creation then at all, since it’s designed specifically to do this.

Kind regards,