Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Error with foreign keys

Hi,
i have a multiple table database, some linked with a foreign key that is not implemented yet.
I tried to add the foreign key with an old topic found on this forum, using a tMysqlRow, then i added the clause "ALTER TABLE my_table ADD FOREIGN KEY (idKey) REFERENCES my_other_table(idKey) .
But it didn't work , no error found but no entries in the table.
So i deleted the component, and made the job as he was before.
But now, when i'm running it, i have this error and i can't get through it
 connecting to socket on port 3547
connected
Exception in component tMysqlOutput_10
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.Util.getInstance(Util.java:384)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1041)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2512)
disconnected
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:781)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:624)
at testdatamining.insertionrsaoptim_0_1.insertionRsaOptim.tFileInputPositional_1Process(insertionRsaOptim.java:16092)
at testdatamining.insertionrsaoptim_0_1.insertionRsaOptim.runJobInTOS(insertionRsaOptim.java:25511)
at testdatamining.insertionrsaoptim_0_1.insertionRsaOptim.main(insertionRsaOptim.java:25379)
Job insertionRsaOptim terminé à 15:28 09/10/2012.

What i don't understand, is that i have deleted the tMysqlRow where there was the clause to add the foreign key, so i don't understand how come talend is still on this. I tried to delete/add the concerned component, but it's not working...
You have a printscreen of the job if needed.
If anyone has a lead.. i am taking it.
Thanks for your help.
Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Ok i found the solution : i had to drop the concerned tables in my database.
Now it's working again.
Any idea on how i can add correctly a foreign key ?

View solution in original post

1 Reply
Anonymous
Not applicable
Author

Ok i found the solution : i had to drop the concerned tables in my database.
Now it's working again.
Any idea on how i can add correctly a foreign key ?