Subject | RE: [Firebird-Java] OBJECT in use during Foreign key creation |
---|---|
Author | Robert DiFalco |
Post date | 2003-03-26T02:11:35Z |
Actually, with a small test case, I can make this work with JayBird.
However, if I add some con.getMetaData() calls in between that query for
the existince of the table name before I create it, I eventually hang on
one of the calls to dbMetaData.getTables( null, null,
getPrimaryTableName(), null ). Hmmmm....
R.
-----Original Message-----
From: Robert DiFalco
Sent: Tuesday, March 25, 2003 6:04 PM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] OBJECT in use during Foreign key creation
I have these strings of DDL in an array....
CREATE TABLE ClassInfo (id INTEGER NOT NULL,classname BLOB SUB_TYPE 1
NOT NULL,strategy BLOB SUB_TYPE 1 NOT NULL,codebase BLOB SUB_TYPE 1 NOT
NULL,PRIMARY KEY(id) );
CREATE PROCEDURE insertClassInfo(nId INTEGER,sClassname BLOB SUB_TYPE
1,sStrategy BLOB SUB_TYPE 1,sCodebase BLOB SUB_TYPE 1) AS BEGIN INSERT
INTO ClassInfo(id,classname,strategy,codebase) VALUES
(:nId,:sClassname,:sStrategy,:sCodebase); END
CREATE TABLE Named ( id INTEGER NOT NULL,name VARCHAR(64),description
BLOB SUB_TYPE 1,version INTEGER NOT NULL,classInfoId INTEGER NOT
NULL,PRIMARY KEY(id) );
ALTER TABLE Named ADD CONSTRAINT FK_ClassInfo FOREIGN KEY ( classInfoId
) REFERENCES ClassInfo ( id );
When I try to execute the last line I hang in JayBird and in Firebird I
get an "unsuccessful metadata update; Object CLASSINFO is in use".
Anybody have any idea what I might be doing wrong?
My code essentially looks like this:
Connection con = ConnectionFactory.createConnection();
createTables( con, <array of four strings as above> );
con.close();
void createTables( Connection con, String[] ddl ) throws Exception
{
Statement statement = con.createStatement();
for ( int at = 0; at < ddl.length; ++at )
{
if ( Persistence.DEBUG )
System.out.println( ddl[ at ] );
statement.executeUpdate( ddl[ at ] );
}
}
TIA for you help.
R.
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
However, if I add some con.getMetaData() calls in between that query for
the existince of the table name before I create it, I eventually hang on
one of the calls to dbMetaData.getTables( null, null,
getPrimaryTableName(), null ). Hmmmm....
R.
-----Original Message-----
From: Robert DiFalco
Sent: Tuesday, March 25, 2003 6:04 PM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] OBJECT in use during Foreign key creation
I have these strings of DDL in an array....
CREATE TABLE ClassInfo (id INTEGER NOT NULL,classname BLOB SUB_TYPE 1
NOT NULL,strategy BLOB SUB_TYPE 1 NOT NULL,codebase BLOB SUB_TYPE 1 NOT
NULL,PRIMARY KEY(id) );
CREATE PROCEDURE insertClassInfo(nId INTEGER,sClassname BLOB SUB_TYPE
1,sStrategy BLOB SUB_TYPE 1,sCodebase BLOB SUB_TYPE 1) AS BEGIN INSERT
INTO ClassInfo(id,classname,strategy,codebase) VALUES
(:nId,:sClassname,:sStrategy,:sCodebase); END
CREATE TABLE Named ( id INTEGER NOT NULL,name VARCHAR(64),description
BLOB SUB_TYPE 1,version INTEGER NOT NULL,classInfoId INTEGER NOT
NULL,PRIMARY KEY(id) );
ALTER TABLE Named ADD CONSTRAINT FK_ClassInfo FOREIGN KEY ( classInfoId
) REFERENCES ClassInfo ( id );
When I try to execute the last line I hang in JayBird and in Firebird I
get an "unsuccessful metadata update; Object CLASSINFO is in use".
Anybody have any idea what I might be doing wrong?
My code essentially looks like this:
Connection con = ConnectionFactory.createConnection();
createTables( con, <array of four strings as above> );
con.close();
void createTables( Connection con, String[] ddl ) throws Exception
{
Statement statement = con.createStatement();
for ( int at = 0; at < ddl.length; ++at )
{
if ( Persistence.DEBUG )
System.out.println( ddl[ at ] );
statement.executeUpdate( ddl[ at ] );
}
}
TIA for you help.
R.
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.