Cannot create relations from database

Servoy 3.5.2
MySQL 5.0.32

I just did a massive overhaul of our database adding foreign key constraints everywhere they belong, now when I go to have servoy create these relations via the ‘create’ button in the relations tool it tells me the following…

Cannot create relations
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: Error parsing foreign keys definition, couldn’t find start of local columns list.
java.sql.SQLException: Error parsing foreign keys definition, couldn’t find start of local columns list.

We previously did have relations created in servoy that where pulled from the database schema but I cleared all of those out of servoy prior to pressing the ‘create’ button just to make sure things where ‘clean’. I have also tried restarting the server and that doesn’t seem to make a difference, same error.

We make the databases in servoy, because that causes less trouble.
Some data types in sybase gives errors in servoy and things like that.

Hi Ryan,
I think you should file a report in the tracking system so that the Dev team can have a look at it.

ngervasi:
Hi Ryan,
I think you should file a report in the tracking system so that the Dev team can have a look at it.

I will try that also, thanks.

BTW, here is the trace when the error occours…

2007-11-28 09:49:23,538 DEBUG [TaskExecuter[0]] com.servoy.j2db.persistence.Server - cruz: got managed connection
2007-11-28 09:49:23,642 DEBUG [TaskExecuter[0]] com.servoy.j2db.persistence.Server - cruz: Closed connection, thread=TaskExecuter[0]
2007-11-28 09:49:23,659 ERROR [TaskExecuter[0]] com.servoy.j2db.util.Debug - Throwable
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: Error parsing foreign keys definition, couldn't find start of local columns list.
        at com.servoy.j2db.persistence.Server.a(Unknown Source)
        at com.servoy.j2db.persistence.Server.createAllDBDefinedRelations(Unknown Source)
        at com.servoy.j2db.develop.r$2.run(Unknown Source)
        at com.servoy.j2db.util.aq.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Error parsing foreign keys definition, couldn't find start of local columns list.
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
        at com.mysql.jdbc.DatabaseMetaData.parseTableStatusIntoLocalAndReferencedColumns(DatabaseMetaData.java:6203)
        at com.mysql.jdbc.DatabaseMetaData.getResultsImpl(DatabaseMetaData.java:3914)
        at com.mysql.jdbc.DatabaseMetaData.getExportKeyResults(DatabaseMetaData.java:2726)
        at com.mysql.jdbc.DatabaseMetaData.access$500(DatabaseMetaData.java:65)
        at com.mysql.jdbc.DatabaseMetaData$4.forEach(DatabaseMetaData.java:2666)
        at com.mysql.jdbc.DatabaseMetaData$IterateBlock.doForAll(DatabaseMetaData.java:76)
        at com.mysql.jdbc.DatabaseMetaData.getExportedKeys(DatabaseMetaData.java:2611)
        ... 5 more

FYI, I have also tried the latest JDBC driver…
mysql-connector-java-5.0.8-bin.jar

So just to keep replying to myself. :)

What had happened was one of my fk constraints got named with a '' at the end by mistake.

CONSTRAINT `fk_note_sticky_to_person\` FOREIGN KEY (`id_person`) REFERENCES `person` (`person_id`),

So when the JDBC driver dumped the schema to find all the relations it took that backslash to be escaping that backtick and thus fouled up the function com.mysql.jdbc.DatabaseMetaData.parseTableStatusIntoLocalAndReferencedColumns() which just does simple string parsing looking for a ‘(’ character to signify the start of a fk column.

So I solved this by exporting the schema and data into raw SQL, fixing the broken constraint in the file, dropping all the tables in the database, and re-importing the fixed SQL file.