db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gus Heck <gus.h...@olin.edu>
Subject Re: torqueschema bug?
Date Wed, 28 Jan 2004 20:36:28 GMT
Yup it is the 3.0.9-stable connector. I changed drivers and jdbc level 
as suggested and I intentionally duplicated the problem. This time I 
saved the output:

Modifying the Database with the following commands:

ALTER TABLE AddressBase
    ADD test LONGVARBINARY NULL ;

java.sql.SQLException: Syntax error or access violation,  message from 
server: "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 'LONGVARBINARY NULL' at line 2"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
        at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1070)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2027)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:1984)
        at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1248)
        at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1194)
        at 
org.apache.commons.sql.util.DDLExecutor.evaluateBatch(DDLExecutor.java:232)
        at 
org.cs101.fdb.impl.jdo.PersistenceHelper.<clinit>(PersistenceHelper.java:159)
        at org.cs101.fdb.test.DbTestCase.<clinit>(DbTestCase.java:36)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:237)
        at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:210)
        at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:520)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.cs101.fdb.test.DbTestCase.<clinit>(DbTestCase.java:36)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:237)
        at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:210)
        at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:520)
Caused by: java.lang.RuntimeException:  !!!! Exceptions while executing 
Data base Alterations !!!!
 Corruption of Database Likely!!!
        at 
org.cs101.fdb.impl.jdo.PersistenceHelper.<clinit>(PersistenceHelper.java:162)
        ... 6 more

The column from the Xdoclet generated torque schema looks like this:

        <column name="test"
                javaName="test"
                type="LONGVARBINARY"
        />

The field in the java class looks like this:

    /**
     * @ojb.field
     */
    Address test;

(address is a non-persistant class (interface actually) which, as noted 
before, is an error but happens to generate the rejected sql)

The code makes other alterations and table creations etc without 
difficulty so it is not likely to be an access privilages issue. To 
check that it was not a sql generation issue with commons sql I fired up 
my sql command line client and logged in as root.

Pasting the generated SQL directly into MySQL shell client I get:

mysql> ALTER TABLE AddressBase
    ->     ADD test LONGVARBINARY NULL ;
ERROR 1064: 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 'LONGVARBINARY NULL' at line 2
mysql>

Pasting in an altered version with the added space that is suggested by 
reading table 11.7 on pp.149-150 of _Core MySQL_ by Leon Atkinson gives:

mysql> ALTER TABLE AddressBase
    ->     ADD test LONG VARBINARY NULL ;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>

Looks like Leon has it right at least as far as what MySQL actually 
accepts...

I don't know if this is MySQL not following SQL specs or torqueschema 
not properly accounting for acceptable differences in the MySQL 
implementation, but the bottom line is LONGVARBINARY does not work with 
MySQL 4 and somebody here or there probably ought to change something so 
that torqueschema and MySQL4 can play nicely with each other. Even 
though I only ran into this by accident, someone else will likely need 
it eventually.

-Gus

Thomas Dudziak wrote:

>On Wed, 28 Jan 2004, Gus Heck wrote:
>
>  
>
>>Hmm, I am using MySQL 4.0.14-standard with databaseDriver = 
>>org.gjt.mm.mysql.Driver downloaded from thier site at the same time. The 
>>exception I got contained the message containing the usual your sql 
>>stinks message  (there is a problem with your syntax near "LONGVARBINARY 
>>Address" etc) (that is by memory not a paste).
>>    
>>
>
>Then you probably use Connector/J 3.0.9-stable in which case you should
>set in your mysql.profile the driver to com.mysql.jdbc.Driver, and the
>jdbc-level to 3.0.
> 
>Tom
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message