Subject Re: unsuccessful metadata update object is in use
Author sureshvembu
Dear Martijn Tonies,

> Because adding a FK will raise an error if it isn't an exclusive
> connection.

Thanks for the reply.. But I'd like to understand the reason for
the "error".. Why should the firebird prevent meta data updates for
even non-used tables.. ie., I can not do even the following
operation :

String createTable1 = "Create table table1 (ID INTEGER NOT NULL
PRIMARY KEY)";

String createTable2 = "Create table table2 (ID INTEGER NOT NULL
PRIMARY KEY, FOREIGN KEY (ID) REFERENCES table1(ID))";

Connection conn1 = DriverManager.getConnection(..); // first
connection to firebirddb
Connection conn2 = DriverManager.getConnection(..);// second
connection to firebirddb

Statement stmt = conn1.createStatement();
stmt.executeUpdate(createTable1); //creates the table1
stmt.executeUpdate(createTable2); //creates the table2

The error happens during the creation of table2. The question I have
is: the 'table1' that is being referred is anyway a "NEW" table and
is NOT used by any other transaction; then why should the metadata
update be denied for this table. If this is anything to do with the
way the firebird db handles the metadata operations, I'd be grateful
if I can get any document/descriptions reasoning this behavior.

Thanks in advance for your clarifications.

Regards,
Suresh.K.V.