Creating a MySQL dump for JDBC
09.07.2010
Florian Hopf
I have just been fighting with the sql-maven-plugin while trying to import an OpenCms MySQL dump automatically. The module wasn’t really verbose with an error message:
[ERROR] Failed to execute: INSERT INTO `CMS_CONTENTS` VALUES
followed by printing the rest of the dump to the standard output.
Fortunately my colleague Marc pointed me to the right direction: The dump contains some statements that can’t be executed by JDBC. To create a correct dump for usage with pure JDBC or with the sql-maven-plugin the following command has to be applied:
mysqldump --hex-blob -u root -p opencms752 > install/opencms752.sql
Edit:
To prevent that some characters are encoded incorrectly, add the following to the configuration options:
<escapeProcessing>false</escapeProcessing>