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]

Re: InstantDB: Re: Referential Integrity not enforced sometimes.


The source for ScriptTool is available in Examples/ScriptTool.java.  You
can compare what ScriptTool is doing with what your code is doing.  I
can't think of anything off hand which would cause this problem.  Have
you tried creating the tables and inserting data all in one shot in your
own code?  I expect that you will see the error then.

It could be that in some (or all) cases, the foreign key definitions are
not being persisted,  though they are being kept in memory after the
initial table creation.

Thom

Balaji Krishnamurthy wrote:
> 
> Forgot to add that the constraint is not enforced again if I separate
> the 'create' and 'insert' statements between 2 executions of the
> ScriptTool class.
> 
> If I put them in the same sql1.txt file and run it in one shot I get
> this 'FK insert error...'.
> 
> But if I create the tables in one run and insert the row in another it
> goes inside the table without complaining.
> 
> Any idea as to what is happening ?
> 
> thanx in advance,
> balaji
> 
> Balaji Krishnamurthy wrote:
> >
> > Hi,
> >    Iam a new user to InstantDb. (Iam using version 3.26)
> >
> >    I tried out the sql1.txt (after minor modifications) using the
> > ScriptTool class.
> >
> >    I tried the foreign key constraint on a table and found that it is
> > enforced only if an insert is made using the ScriptTool class. (i.e
> > inside the sql1.txt or a similar file)
> >
> >    It was not being enforced if I use my own Java code to load the idb
> > driver and insert records using JDBC calls.
> >
> >    I get the following exception while using ScriptTool class.
> >
> > java.sql.SQLException: java.sql.SQLException: FK insert error. Value, 9,
> > does no
> > t exist in column tester.id
> >         at org.enhydra.instantdb.db.SQLProg.execute(SQLProg.java:288)
> >         at
> > org.enhydra.instantdb.jdbc.idbStatement.execute(idbStatement.java, Co
> > mpiled Code)
> >         at
> > org.enhydra.instantdb.jdbc.idbStatement.executeUpdate(idbStatement.ja
> > va:103)
> >         at org.enhydra.instantdb.SampleThread.run(ScriptTool.java,
> > Compiled Code
> > )
> >         at java.lang.Thread.run(Unknown Source)
> > id,fullName,email,login,password
> >
> >    But it does not complain in my own code.
> >
> >    I find the record being inserted into the client table without any
> > corresponding record in the parent table.
> >
> >    Is there is something that I could do to get this constraint enforced
> > in my code too ?
> >
> > thanx,
> > balaji
> -----------------------------------------------------------------------------
> To unsubscribe from this mailing list, send email to majordomo@enhydra.org
> with the text "unsubscribe instantdb" in the body of the email.
> If you have other questions regarding this mailing list, send email to
> the list admin at owner-instantdb@enhydra.org.
-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.