InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

InstantDB: Foreign Key syntax problem


Title:

I get an SQL syntax error when I use a foreign key table contraint. Is this a known problem or am I doing something wrong?

create table BAR (
        ID      int
);

create table FOO (
        ID      int,
        NAME    CHAR(32)
)
foreign key (ID) references BAR(ID) on delete cascade;

This causes the following exception:

java.sql.SQLException: create table FOO (  ID    int,  NAME      char(32))foreign key (ID) references BAR(ID) on delete cascade
 Don't understand SQL after: "on"
 Expected: "null" found: "on"
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Compiled Code)
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Exception.java:42)
        at java.sql.SQLException.<init>(SQLException.java:82)
        at org.enhydra.instantdb.db.SQLProg.execute(SQLProg.java:215)
        at org.enhydra.instantdb.jdbc.idbStatement.execute(Compiled Code)
        at org.enhydra.instantdb.jdbc.idbStatement.executeUpdate(idbStatement.java:103)
        at org.enhydra.instantdb.SampleThread.run(Compiled Code)
        at java.lang.Thread.run(Thread.java:479)

Either removing the "on delete cascade" or attaching the constraint to the column does work.

Thanks
James