we started using UCanAccess to import data stored in a propietary text file format into an Access DB to provide an easy to use data browser. Everything works like a charm. The Access-DB we are using is fairly large (Approx 1k tables, DB Size approx. 30-40MB). When doing a full import we drop/create all tables and import the data from the text files. This works fine for all tables except for one. I can't see anything special about this table alone. When we issue the following CREATE TABLE statement however we get an ArrayIndexOutOfBounds exception.
java.lang.ArrayIndexOutOfBoundsException: 7
at net.ucanaccess.converters.Persist2Jet.getColumn(Persist2Jet.java:223)
at net.ucanaccess.converters.Persist2Jet.getColumns(Persist2Jet.java:311)
at net.ucanaccess.converters.Persist2Jet.createTable(Persist2Jet.java:457)
at net.ucanaccess.commands.CreateTableCommand.persist(CreateTableCommand.java:100)
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:323)
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:205)
at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:273)
at net.ucanaccess.jdbc.Execute.execute(Execute.java:44)
at net.ucanaccess.jdbc.UcanaccessStatement.execute(UcanaccessStatement.java:157)
at foo.bar.LoadTables.execute(CSV2DB.java:260)
at foo.bar.LoadTables.processType(CSV2DB.java:242)
at foo.bar.LoadTables.doit(CSV2DB.java:225)
at foo.bar.LoadTables.main(CSV2DB.java:72)
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 7
at net.ucanaccess.jdbc.UcanaccessStatement.execute(UcanaccessStatement.java:159)
at foo.bar.LoadTables.execute(CSV2DB.java:260)
at foo.bar.LoadTables.processType(CSV2DB.java:242)
at foo.bar.LoadTables.doit(CSV2DB.java:225)
at foo.bar.LoadTables.main(CSV2DB.java:72)
Suppressed: java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Timer.java:397)
at java.util.Timer.schedule(Timer.java:193)
at net.ucanaccess.jdbc.DBReference$MemoryTimer.decrementActiveConnection(DBReference.java:129)
at net.ucanaccess.jdbc.DBReference$MemoryTimer.access$800(DBReference.java:87)
at net.ucanaccess.jdbc.DBReference.decrementActiveConnection(DBReference.java:374)
at net.ucanaccess.jdbc.UcanaccessConnection.close(UcanaccessConnection.java:185)
at foo.bar.LoadTables.execute(CSV2DB.java:261)
... 3 more
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 7
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:212)
at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:273)
at net.ucanaccess.jdbc.Execute.execute(Execute.java:44)
at net.ucanaccess.jdbc.UcanaccessStatement.execute(UcanaccessStatement.java:157)
... 4 more
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 7
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:360)
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:205)
... 7 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 7
at net.ucanaccess.converters.Persist2Jet.getColumn(Persist2Jet.java:223)
at net.ucanaccess.converters.Persist2Jet.getColumns(Persist2Jet.java:311)
at net.ucanaccess.converters.Persist2Jet.createTable(Persist2Jet.java:457)
at net.ucanaccess.commands.CreateTableCommand.persist(CreateTableCommand.java:100)
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:323)
... 8 more
The exception is reproducible when running the statement against the large / full access DB. When issuing the same DDL against an empty MDB file it works as expected.
I read in another thread with a similar exception (https://sourceforge.net/p/ucanaccess/discussion/general/thread/74a9c36d/) that there might be a problem with conflicting hsqld versions on the classpath. I did check our classpath there is no other hsqldb.jar.
We are using the project setup like described here (Option 2): https://stackoverflow.com/questions/21955256/manipulating-an-access-database-from-java-without-odbc/21955257#21955257
The version we are using is 4.0.4.
Update #1: Apparently if I do the full import of the tables in another order the exception does not occur.
Thanks in advance,
Markus
</body></html>
Last edit: markus mayer 2018-07-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
thanks for your swift replay. After a bit of try and error I think I came up with a small debuggable example.
- Create an empty Access DB
- Execute the following two CREATE TABLE Statements:
CREATE TABLE TypEFooBar([Key] VARCHAR(1024), [DatabaseKey] LONG PRIMARY KEY, [Description] VARCHAR(1024), [Default] LONG, [Ordinal] LONG, [Begin] DATETIME, [End] DATETIME, [foo] BOOLEAN, [bar] DATETIME, [data1] LONG, [data2] LONG);
CREATE TABLE Typ_FooBar([Key] VARCHAR(1024), [DatabaseKey] LONG PRIMARY KEY, [Description] VARCHAR(1024), [Default] LONG, [Ordinal] LONG, [Begin] DATETIME, [End] DATETIME);
Thanks,
Markus
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<html><head></head><body>
at net.ucanaccess.converters.Persist2Jet.getColumn(Persist2Jet.java:223)
at net.ucanaccess.converters.Persist2Jet.getColumns(Persist2Jet.java:311)
at net.ucanaccess.converters.Persist2Jet.createTable(Persist2Jet.java:457)
at net.ucanaccess.commands.CreateTableCommand.persist(CreateTableCommand.java:100)
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:323)
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:205)
at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:273)
at net.ucanaccess.jdbc.Execute.execute(Execute.java:44)
at net.ucanaccess.jdbc.UcanaccessStatement.execute(UcanaccessStatement.java:157)
at foo.bar.LoadTables.execute(CSV2DB.java:260)
at foo.bar.LoadTables.processType(CSV2DB.java:242)
at foo.bar.LoadTables.doit(CSV2DB.java:225)
at foo.bar.LoadTables.main(CSV2DB.java:72)
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 7
at net.ucanaccess.jdbc.UcanaccessStatement.execute(UcanaccessStatement.java:159)
at foo.bar.LoadTables.execute(CSV2DB.java:260)
at foo.bar.LoadTables.processType(CSV2DB.java:242)
at foo.bar.LoadTables.doit(CSV2DB.java:225)
at foo.bar.LoadTables.main(CSV2DB.java:72)
Suppressed: java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Timer.java:397)
at java.util.Timer.schedule(Timer.java:193)
at net.ucanaccess.jdbc.DBReference$MemoryTimer.decrementActiveConnection(DBReference.java:129)
at net.ucanaccess.jdbc.DBReference$MemoryTimer.access$800(DBReference.java:87)
at net.ucanaccess.jdbc.DBReference.decrementActiveConnection(DBReference.java:374)
at net.ucanaccess.jdbc.UcanaccessConnection.close(UcanaccessConnection.java:185)
at foo.bar.LoadTables.execute(CSV2DB.java:261)
... 3 more
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 7
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:212)
at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:273)
at net.ucanaccess.jdbc.Execute.execute(Execute.java:44)
at net.ucanaccess.jdbc.UcanaccessStatement.execute(UcanaccessStatement.java:157)
... 4 more
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 7
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:360)
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:205)
... 7 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 7
at net.ucanaccess.converters.Persist2Jet.getColumn(Persist2Jet.java:223)
at net.ucanaccess.converters.Persist2Jet.getColumns(Persist2Jet.java:311)
at net.ucanaccess.converters.Persist2Jet.createTable(Persist2Jet.java:457)
at net.ucanaccess.commands.CreateTableCommand.persist(CreateTableCommand.java:100)
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:323)
... 8 more
Update #1: Apparently if I do the full import of the tables in another order the exception does not occur.
Last edit: markus mayer 2018-07-05
Can you provide a set of CREATE TABLE statements that, when executed in order, will reproduce the error?
Hi,
thanks for your swift replay. After a bit of try and error I think I came up with a small debuggable example.
- Create an empty Access DB
- Execute the following two CREATE TABLE Statements:
CREATE TABLE TypEFooBar([Key] VARCHAR(1024), [DatabaseKey] LONG PRIMARY KEY, [Description] VARCHAR(1024), [Default] LONG, [Ordinal] LONG, [Begin] DATETIME, [End] DATETIME, [foo] BOOLEAN, [bar] DATETIME, [data1] LONG, [data2] LONG);
CREATE TABLE Typ_FooBar([Key] VARCHAR(1024), [DatabaseKey] LONG PRIMARY KEY, [Description] VARCHAR(1024), [Default] LONG, [Ordinal] LONG, [Begin] DATETIME, [End] DATETIME);
Thanks,
Markus
Hi Markus.
Thanks very much for this. I have submitted a patch for code review and the fix should be included in the next release of UCanAccess.
In the meantime, the workaround would be to swap the order of the CREATE TABLE statements (as you have already discovered).
Hi Gord,
thanks for your reply. Do you have any approximate ETA for the fix?
Bye,
Markus