Issue 279 in flyway: migrate fails on .sql files with utf-8 signature

60 views
Skip to first unread message

fly...@googlecode.com

unread,
Jun 18, 2012, 3:15:52 PM6/18/12
to flywa...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 279 by haam.t...@gmail.com: migrate fails on .sql files with
utf-8 signature
http://code.google.com/p/flyway/issues/detail?id=279

Maven plugin task, flyway:migrate against a MySQL database, fails if .sql
file has UTF-8 signature.

I tried explicitly setting the <encoding> property to UTF-8, and even
appending useUnicode=true&characterEncoding=utf8 to the MySQL URL. No
luck, still came back with:

[ERROR] com.googlecode.flyway.core.exception.FlywayException: Error
executing statement at line 1: ?SELECT 1 FROM DUAL
[ERROR] Caused by
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'SELECT 1 FROM DUAL' at
line 1

Attached is test file with utf-8 signature.


Attachments:
utf8.sql 24 bytes

fly...@googlecode.com

unread,
Jun 19, 2012, 2:05:09 AM6/19/12
to flywa...@googlegroups.com
Updates:
Status: Accepted
Labels: Component-Core

Comment #1 on issue 279 by axel.fontai...@gmail.com: migrate fails
on .sql files with utf-8 signature
http://code.google.com/p/flyway/issues/detail?id=279

Thanks for your report and your test file!

Yes, this is indeed the case (due to Flyway using Java's regular IO
classes). I'll look into using an alternative (ex:
http://koti.mbnet.fi/akini/java/unicodereader/UnicodeReader.java.txt) for
UTF-8 if this issue picks up steam.

Cheers
Axel

fly...@googlecode.com

unread,
Jun 19, 2012, 9:12:33 PM6/19/12
to flywa...@googlegroups.com

Comment #2 on issue 279 by haam.t...@gmail.com: migrate fails on .sql files
Hi Axel,

Looks like the mbnet.fi UnicodeReader does all the right things -- it looks
for a Byte Order Mark (BOM), sets the encoding from it if present, and
pushes everything back to the input stream except the BOM.

Cheers,
Haam

fly...@googlecode.com

unread,
Jun 26, 2012, 2:56:11 PM6/26/12
to flywa...@googlegroups.com

Comment #3 on issue 279 by lander...@chariotsolutions.com: migrate fails
on .sql files with utf-8 signature
http://code.google.com/p/flyway/issues/detail?id=279

Is there a workaround for this issue? I have the error as well.

fly...@googlecode.com

unread,
Jun 29, 2012, 4:22:31 AM6/29/12
to flywa...@googlegroups.com
Updates:
Status: Fixed

Comment #4 on issue 279 by axel.fontai...@gmail.com: migrate fails
on .sql files with utf-8 signature
http://code.google.com/p/flyway/issues/detail?id=279

This issue was closed by revision f290c1ca34c0.

fly...@googlecode.com

unread,
Nov 18, 2014, 10:54:25 AM11/18/14
to flywa...@googlegroups.com

Comment #5 on issue 279 by mailys.a...@gmail.com: migrate fails on .sql
files with utf-8 signature
https://code.google.com/p/flyway/issues/detail?id=279

"fails if .sql file has UTF-8 signature" I get the same problem.

Just add: characterEncoding=UTF-8 and not
useUnicode=true&characterEncoding=utf8 to your url
he can't translate the '&'.

Like:
url=jdbc:mysql://localhost/bd?characterEncoding=UTF-8


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages