MySQL - Foreign key failure - but the problem is with Eclipse, I think...
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
So when I tried to insert a record into the first table, I got an error like:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails ("vrsn_rrd"."rrd_info", CONSTRAINT "dev_id" FOREIGN KEY ("dev_type") REFERENCES "rrd_dev_type" ("id"))
So I fixed the typo, dropped the database, recreated the database and now from the command line, I can insert records. HOWEVER, I am working with a java program built with Eclipse to read my input and load this table, and when the program runs, I get the same foreign key error. I have deleted the program war file, deleted the project from Eclipse and recreated it, deleted the database again and rebuilt it, and I can't get the program to load my data.
I am completely inexperienced with Eclipse - I'm assuming it has cached something somewhere, but I can't find it. The fact that I can load a record from the mysql command line tells me the database is now ok.
Can someone give me a hint as to how to get rid of this problem? I am building the code using Eclipse and the Vaadin development environment.
It was a very long Monday... My apologies. There was a typo in my config file, and I was actually attempting to access the database on a test machine which didn't get the typo fixed instead of the box where I did update the database...
So the problem was simply the database itself. Sorry about that...
Thank you for the follow up posting. I read your initial post yesterday and really didn't have a clue as to what to suggest. In hind sight, the problem and solution both make perfect sense. I ran into a similar situation a while back. I am using FreeTDS to provide an ODBC driver for a MS-SQL database. When you establish a connection in your application, you reference the tag in the configuration file that is stored in /etc/odbc.ini. In the odbc.ini you make reference to the SQL host and the database of interest. We have multiple database servers that are supposed to mirror each other, more or less, with names that end in 01 and 02 and if you don't point to the right one then as the saying goes "garbage in garbage out".