Creating a table with autoincrement column: '&

2019-08-03 22:13发布

I use UCanAccess (4.0.2) to create a new file with a single table like this:

// Create a database + connect
DatabaseBuilder.create(FileFormat.V2010, new File(path));
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");     
conn = DriverManager.getConnection("jdbc:ucanaccess://" + path + ";singleconnection=true" ,"", ""); 

// Create table     
String sql = "CREATE TABLE Test (id AUTOINCREMENT PRIMARY KEY, value CHAR(1) NOT NULL)";
conn.createStatement().executeUpdate(sql);

The code works but the resulting table seems to be incomplete/flawed. Trying to copy it in Access results in an error:

'' is not a valid name...

Doesn't seem to be a big problem as saving the table from the design view solves it.

Any idea why that happens and how to avoid it?

1条回答
够拽才男人
2楼-- · 2019-08-03 22:45

This is related to a confirmed issue with Jackcess versions 2.1.8 and older. A fix has been applied to Jackcess that will be included in the next release (tentatively 2.1.9). Once a UCanAccess update is released that includes the Jackcess fix then the problem should go away.

查看更多
登录 后发表回答