创建具有自动增量列的表:“"不是有效名称
我使用UCanAccess(4.0.2)用一个表创建一个新文件,如下所示:
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);
该代码有效,但是结果表似乎不完整/有缺陷.尝试在Access中复制它会导致错误:
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?
这与已确认的Jackcess 2.1.8及更早版本的问题有关. 修复已应用于Jackcess,它将包含在下一发行版中(暂定) 2.1.9).一旦发布了包含Jackcess修复程序的UCanAccess更新,该问题就会消失.
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.