2 messages in com.mysql.lists.bugsDatabaseMetaData.getImportedKeys() th...| From | Sent On | Attachments |
|---|---|---|
| Ken Hausam | 30 Aug 2002 09:41 | |
| Ken Hausam | 03 Sep 2002 06:34 |
| Subject: | DatabaseMetaData.getImportedKeys() throws exception in JDBC driver![]() |
|---|---|
| From: | Ken Hausam (khau...@wurldmedia.com) |
| Date: | 08/30/2002 09:41:59 AM |
| List: | com.mysql.lists.bugs |
Sorry, I didn't see a mailing list for MySQL-Connector-Java yet, although this problem isn't necessarily just with the JDBC driver.
Database OS: Linux MySQL-Max: 3.23.51 JDBC driver: mysql-connector-java-2.0.14 running on XP. JVM: 1.3
When I execute the following SQL:
show table status from mswurld1 like 'AFF';
I get back the following in the comment column:
InnoDB free: 379904 kB; (AFF_STAT_ID) REFER mswurld1/AFF_STAT(AFF_STAT_ID); (CMSN_CPY_ID) REFER mswurld1/CMSN_CPY(CMSN_CPY_ID); (PAY_PROC_CPY_ID) REFER mswurld1/PAY_PROC_CPY(PAY_PROC_CPY_ID); (CPY_ID) REFER mswurld1/CPY(CPY_ID); (AFF_STAT_RSN_ID) REFER mswurld1/AFF_STAT_RSN(AFF_STAT_RSN_ID); (BILL_PERIOD_ID) REFER mswurld1/BILL_PERIOD(BILL_PERIOD_ID); (CMSN_CPY_ID) REFER mswurld1/CMSN_CPY(CMSN_CPY_ID); (PAY_PROC_CPY_ID) REFER mswurld1/PAY_PROC_CPY(PAY_PROC_CPY_ID); (
Not sure why I'm getting that last open parenthesis. As the JDBC code is currently written, it causes the following exception:
java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(StringTokenizer.java:235) at com.mysql.jdbc.DatabaseMetaData.getImportedKeys(DatabaseMetaData.java:32 47) at com.wurldmedia.generator.GeneratorDBHelper.getForeignKeys(GeneratorDBHel per.java:231)
The exception is thrown when the code tries to parse tokens out of the keys variable with value of "(".
The SQL used to generate the foreign keys is:
ALTER TABLE AFF ADD CONSTRAINT FOREIGN KEY (CMSN_CPY_ID) REFERENCES CMSN_CPY(CMSN_CPY_ID); ALTER TABLE AFF ADD CONSTRAINT FOREIGN KEY (PAY_PROC_CPY_ID) REFERENCES PAY_PROC_CPY(PAY_PROC_CPY_ID); ALTER TABLE AFF ADD CONSTRAINT FOREIGN KEY (CPY_ID) REFERENCES CPY(CPY_ID); ALTER TABLE AFF ADD CONSTRAINT FOREIGN KEY (AFF_STAT_RSN_ID) REFERENCES AFF_STAT_RSN(AFF_STAT_RSN_ID); ALTER TABLE AFF ADD CONSTRAINT FOREIGN KEY (BILL_PERIOD_ID) REFERENCES BILL_PERIOD(BILL_PERIOD_ID); ALTER TABLE AFF ADD CONSTRAINT FOREIGN KEY (APPROVAL_USER_ID) REFERENCES WUSER(USER_ID); ALTER TABLE AFF ADD CONSTRAINT FOREIGN KEY (AFF_STAT_ID) REFERENCES AFF_STAT(AFF_STAT_ID);
The APPROVAL_USER_ID constraint is missing from the comments data. Is there a limit on the size of the comments column? That would explain why I'm seeing the trailing parenthesis and getting an exception in the JDBC driver.
How-To-Repeat: 1. Create an InnoDB table with a large number of foreign key constraints. 2. Execute a "SHOW TABLE STATUS' for that table and examine the data in the coments column.
Ken Hausam Wurld Media, Inc Phone: 518-691-1100 Fax: 518-691-1170




