创建具有自动增量列的表:“"不是有效名称 [英] Creating a table with autoincrement column: '' is not a valid name

查看:95
本文介绍了创建具有自动增量列的表:“"不是有效名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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.

这篇关于创建具有自动增量列的表:“"不是有效名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆