File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Three problems with mysql... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Three problems with mysql..." Watch "Three problems with mysql..." New topic

Three problems with mysql...

Raghavan Chockalingam
Ranch Hand

Joined: Dec 20, 2005
Posts: 77
1. You can see the error coming up when I try to delete the column which is a primary key.

2. I am not able to add foreign key after creating table

I am posting all the problems in a single topic because all are related
Problem 3: Unable to drop a foreign key on a table

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

It looks like something with the tablespace. Check if you have any locks on the tables and that there is enough memory on the machine.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Raghavan Chockalingam
Ranch Hand

Joined: Dec 20, 2005
Posts: 77
I have run queries at the end of the output to show you that no locks exist. I want to know how to do two things...
1. Find and list the entries in the table where indexes are stored
2. How to list all the tables created by an user?
Ben Ethridge
Ranch Hand

Joined: Jul 28, 2003
Posts: 108
In MySql, I had the same problem as this thread starter. What solved it for me was including the database name, i.e, for example:

alter table myDb.studentscores_tbl drop foreign key studentid;

A clue is in the:

"Error on rename of '.\test\studentscores_tbl' to '.\test\#sql2-68c-1fe' (errno: 152)"

There is no database name ahead of the "."'s.

Hope that solves your problem as well.


Joined: Feb 08, 2006
Posts: 1
Regarding the third point, I was getting the same issue (errno 152) attempting to drop a foreign key using the MySQL Query Browser, even adding the schema at the front of the table. When I re-connected without specifying a default schema to connect to, the ALTER TABLE <schema>.<tablename> DROP FOREIGN KEY <fk> command worked fine.

Hope this is useful.

[ February 08, 2006: Message edited by: OddThomas ]
[ February 08, 2006: Message edited by: OddThomas ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Hello "OddThomas"-

Welcome to JavaRanch.

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it - please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.

Enyoy your time here.
I agree. Here's the link:
subject: Three problems with mysql...
It's not a secret anymore!