MySQLSyntaxErrorException when column name is 'key'

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

MySQLSyntaxErrorException when column name is 'key'

keijox
Hi, I'm trying to dump some data to file using FlatXmlDataSet.write() but it fails due to a certain table has a column called 'key':

Exception in thread "main" org.dbunit.dataset.
DataSetException: 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 'key from entrytype order by id' at line 1
    at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:317)
    at org.dbunit.database.DatabaseTableIterator.getTable(DatabaseTableIterator.java:89)
    at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:83)
    at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:124)
    at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:378)

I get the same error in MySql Query Browser using this select:
select id, key from entrytype order by id;

However, if I use an alias 'e' it works:
select e.id, e.key from entrytype e order by e.id;

Is there a way to achieve something similar in DbUnit?
Regards,

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user