Sep 29, 2015

How to create MySQL/MariaDB tables which have column-names conflicting with reserved words?

Today I've running a MariaDB instance as a docker image. This image is linked to a
running Wildfly-Instance, which has a DataSource configured to connect to the linked

But on the deployment of an JEE artefact, JPA tries to create the database, but the
create-Statement fails, because one column is named KEY,which is a reserved word.

To create the table manually, you can copy the create-Statement from the Wildfly-Log and
escape the keyword-column with a back-tick "`" character.

for example:
create table tt ( Col1 varchar(255), `KEY` varchar(255) );

When you restart the deployment the table must not be created.
$WILDFLY_HOME/bin/ -c --controller host:9990
Authenticating against security realm: ManagementRealm
Username: admin
[standalone@bpc:9990 /] /deployment=mydeployment.war:redeploy()