Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java DB Drop constraints

 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I believe some of us are following J2EE RI, that has the Sun System Application Server, Java DB and Sun MQ. I tried to create two tables and added relationship through constraints.

As part of learning, I wanted to drop those constraints and add a different constraints. However, the constraints were refusing to go away. I believe I am making mistake in the SQL syntax, but I could not correct.

Your help me would be very useful in rightfully dropping the constraints and let me delete the tables.

I had created 2 tables and added relationship within them.

Now, when both the tables have to be deleted, they refuse to go away.
ij> DROP TABLE BANK;

The error message is :

ERROR X0Y25: Operation 'DROP CONSTRAINT' cannot be performed on object 'SQL09090
9021415680' because CONSTRAINT 'ORGANIZATION_BANK' is dependent on that object.

Both the tables flash similar error messages. I deleted the contents.

ij> ALTER TABLE ORGANIZATION DROP CONSTRAINT ORGANIZATION_BANK;
0 rows inserted/updated/deleted

I tried to do the above. But still the deletion of the table was not possible.
So tried the following. It gives an error.

ij> ALTER TABLE ORGANIZATION DROP CONSTRAINT BMNYRGNZTNSRGNZTND;
ERROR 42X86: ALTER TABLE failed. There is no constraint 'APP.BMNYRGNZTNSRGNZTND'
on table 'APP.ORGANIZATION'.

How to delete the constraints and the tables?

I referred their manual to dropping the constraints.
http://db.apache.org/derby/docs/10.2/ref/ref-single.html

But I seem to be missing something. I don't want to reinstall Java DB, because I have to make several changes as part of learning and it may delay the process if I reinstalled for every change.

Thanks in advance,
Rajesh


 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I managed to delete the tables and its associated constraints. I don't know the mechanism behind it. It just happened.

I had written a OneToMany (Bank) and ManyToOne (Organization) bidirectional relationship, and configured the oracle.toplinkessentials as create Tables=true.

During deployment, it had created one more table Bank_Organization. I don't know why it created, because I thought only a ManyToMany requires an intermediate table. Not deleting this table seems to be a problem. When I deleted this table, Bank and Organization were deletable.

I hope this would help anybody who faced a similar problem.

Regards,
Rajesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic