#46 Transfer to MySQL syntax error

open-accepted
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

  • Grzegorz Swietlik

    MySQLTransferHelper source fil

     
  • Grzegorz Swietlik

    corrected MySQLTransferHelper class

     
  • Grzegorz Swietlik

    Logged In: YES
    user_id=1214958

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

     
  • Grzegorz Swietlik

    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.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks