ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Miller <a...@modea.com>
Subject Re: sql task truncating utf8 input
Date Tue, 08 Apr 2008 17:27:31 GMT
When I populate the database manually from the command line using:

mysql -uroot -p mydb < mydb.sql

...everything works as it should.  The value is not truncated as it is
when run by Ant.  This leads me to believe it is caused by Ant or Java.

Thanks,
Alex

On Tue, 2008-04-08 at 12:16 -0500, David Brown wrote:
> Can you manually run the query outside of Ant? Say, at the MySQL command line? My bet
is: it will still fail because of the extra apostrophe single quotes in the string data.
> 
> Alex Miller wrote ..
> > Hello, I have just started using Ant as a build tool for my webservers
> > during the past few weeks and I am very happy so far.  Now I am trying
> > to populate a MySQL database from a file containing data using the utf8
> > charset.  I receive no errors, but whenever the INSERT VALUE contains a
> > unicode character (such as the left apostrophe) it is truncated from
> > that character on.
> > 
> > Example:
> > [sql] SQL:  INSERT INTO `some_table` VALUES (1,'Good data.'), (10','When
> > it’s windy... this is truncated'),(11,'Good data, and then It’s...
> > truncated after apostrophe')
> > 
> > This will insert data for each value, but it appears in the table like
> > this:
> > 1  Good data.
> > 10 When it
> > 11 Good data, and then It
> > 
> > My sql task in build.xml contains the following:
> > <sql
> >   driver="${db.driver}"
> >   url="${db.url}"
> >   userid="${db.user.root}"
> >   password="${db.pass.root}"
> >   print="yes"
> >   classpath="${db.connector}"
> >   encoding="utf8"
> > >
> >   <transaction>
> >     DROP DATABASE IF EXISTS ${db.name};
> >     CREATE DATABASE ${db.name} CHARACTER SET utf8;
> >     USE ${db.name};
> >   </transaction>
> >   <transaction src="${basedir}/${dir.db}/${db.file}"/>
> > </sql>
> > 
> > When I run "ant -v db" the SQL data appears in full (everything after
> > unicode char's is visible) so I'm not sure when the data is being
> > truncated.  Has anyone else seen this behavior?  Where else should I
> > look to determine what function is the culprit?
> > 
> > Thanks,
> > Alex
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message