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.
|