#46 Transfer to MySQL syntax error

open-accepted
Project Admin
None
5
2005-08-30
2005-08-26
No

When running org.hsqldb.util.Transfer utility, and
choosing HSQL as a source database, and MySQL as a
target, the CREATE TABLE statements sent to MySQL
contain pure VARCHAR for columns translated from HSQL
VARCHAR type.

MySQL 4.1 does not accept VARCHAR without the size
specification (at least it happens to my mySQL
installation), so the statements should contain
VARCHAR(255)
(in MySQL 5.x it could be VARCHAR(65535) probably)

To fix the problem quickly, you could change the
org.hsqldb.uti.HelperFactory#getHelper method to check
for the mysql helper:
// ...
... if (productLowerName.equals("mysql")) {
f = new MySQLTransferHelper();
}
// ...
and include the attached MySQLTransferHelper class to
the HSQL sources.
It is not any complete solution, but it allows some
simple transfers to work.

Regards
Grzegorz

Discussion

  • MySQLTransferHelper source fil

     
  • corrected MySQLTransferHelper class

     
  • Logged In: YES
    user_id=1214958

    updating attached file to add the following corrections:
    LONGVARBINARY --> BLOB
    LONGVARCHAR --> TEXT

     
  • HelperFactory with MySQL added

     
    Attachments
  • Fred Toussi
    Fred Toussi
    2005-08-30

    • labels: 325100 -->
    • assigned_to: nobody --> hsqldb
    • status: open --> open-accepted
     
  • Fred Toussi
    Fred Toussi
    2005-08-30

    Logged In: YES
    user_id=150940

    Thanks for the effort.

    Will switch this item to the HSQLDB utilities tracker so that
    the next developer to update Transfer can see and
    incorporate your update.