Subject RE: [firebird-support] Re: unsuccessful metadata update object is in use
Author Alan McDonald
> String createSQL1 = "CREATE TABLE T1 (ID INTEGER NOT
> NULL PRIMARY KEY)";
> String createSQL = "CREATE TABLE T2 (ID INTEGER NOT
> NULL, FOREIGN KEY(ID) REFERENCES T1(ID) ON DELETE
> CASCADE)";
>
> Connection conn = DriverManager.getConnection(...);
> conn.setAutoCommit(false);
>
> Connection conn1 = DriverManager.getConnection(..);
> conn1.setAutoCommit(false);
>
> conn.createStatement().executeUpdate(createSQL1);
> conn.commit();
> conn.createStatement().executeUpdate(createSQL);
> conn.commit();
>
> It throws exception on the second commit(). So, I
> suppose, the problem still exists even after the
> explicit "commit" is being done.

You've created 2 connection but used only one - this may be a typo but in
any case - try disconnecting the first connection before establishing the
second and executing the statement.
Alan