MySQL Forums
Forum List  »  InnoDB

Sql execution error #1005 .response from the database
Posted by: giri giri
Date: April 06, 2012 02:03PM

Hello,

I am getting "SQL execution error #1005.Response from the database" error no 121 error when i execute the below sql scripts.

The foreign key named "fk_category_id" exists in both subcategory table and property table .The error is getting resolved when i name the foreign keys in these 2 tables differently .

So my question is should the foreign key names across tables be unique in mysql ??

is there any other reason that this error can occur??

CREATE TABLE IF NOT EXISTS `sampledb`.`category` (
`category_id` INT NOT NULL ,
PRIMARY KEY (`category_id`) )

CREATE TABLE IF NOT EXISTS `sampledb`.`subcategory` (
`subcategory_id` INT NOT NULL ,
`category_id` INT NULL ,
PRIMARY KEY (`subcategory_id`) ,
CONSTRAINT `fk_category_id`
FOREIGN KEY (`category_id` )
REFERENCES `realtydb`.`category` (`category_id` ))


CREATE TABLE IF NOT EXISTS `sampledb`.`property` (
`property_id` INT NOT NULL ,
`category_id` INT NULL ,
PRIMARY KEY (`property_id`) ,
CONSTRAINT `fk_category_id`
FOREIGN KEY (`category_id` )
REFERENCES `realtydb`.`category` (`category_id` ))

Options: ReplyQuote


Subject
Views
Written By
Posted
Sql execution error #1005 .response from the database
4212
April 06, 2012 02:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.