找不到Java Prepared语句错误表

时间:2012-12-27 11:33:59

标签: java mysql jdbc prepared-statement talend

我在使用Talend Open Studio for Data Integration构建数据迁移作业时遇到了问题。 Talend open studio生成java类。我从一个mysql表迁移到另一个。

声明:

    String insert_tMysqlOutput_1 = "INSERT INTO `"
                    + "workitem"
                    + "` (`name`,`type`,`budgetHours`,`deadline`,`dateStart`,`dateEnd`,`dateCreated`,`projectId`,`parentWorkItem`,`description`,`dateUpdated`,`companyId`,`state`,`reporterId`,`assigneeId`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 

            java.sql.PreparedStatement pstmt_tMysqlOutput_1 = conn_tMysqlOutput_1
                    .prepareStatement(insert_tMysqlOutput_1);

错误:

Exception in component tMysqlOutput_1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dashboard.work_item' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.Util.getInstance(Util.java:384)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2312)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.tMysqlInput_1Process(Copy_of_workitem.java:3677)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.tMysqlConnection_2Process(Copy_of_workitem.java:1109)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.runJobInTOS(Copy_of_workitem.java:7370)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.main(Copy_of_workitem.java:7069)

表格结构(编辑#1)

CREATE TABLE  `dashboard`.`workitem` (
`workItemId` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`projectId` bigint(20) NOT NULL DEFAULT '0',
`companyId` bigint(20) DEFAULT NULL,
`budgetHours` decimal(10,0) DEFAULT NULL,
`deadline` datetime DEFAULT NULL,
`dateStart` datetime DEFAULT NULL,
`dateEnd` datetime DEFAULT NULL,
`parentWorkItem` bigint(20) DEFAULT NULL,
`description` text,
`state` varchar(45) DEFAULT NULL,
`reporterId` bigint(20) DEFAULT NULL,
`assigneeId` bigint(20) DEFAULT NULL,
`dateCreated` datetime DEFAULT NULL,
`dateUpdated` datetime DEFAULT NULL,
`newColumn` varchar(10) DEFAULT NULL,
PRIMARY KEY (`workItemId`),
KEY `fk_project_id_idx` (`projectId`),
KEY `fk_parent_work_item_idx` (`parentWorkItem`),
KEY `fk_workitem_company1_idx` (`companyId`),
KEY `fk_workitem_name` (`name`),
KEY `fk_workitem_assignee` (`assigneeId`),
KEY `fk_workitem_reporter` (`reporterId`),
CONSTRAINT `fk_workitem_company1` FOREIGN KEY (`companyId`) REFERENCES `company`    (`companyId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2461 DEFAULT CHARSET=latin1

奇怪的是.. work_item在代码中找不到..所以我认为必须通过一些缓存语句但不知道在哪里..

编辑#1: 当我在表中不存在的查询中添加一个字段时,我得到一个未找到的错误字段..所以不知何故检查字段是否存在。

有没有人有任何想法?

由于

1 个答案:

答案 0 :(得分:0)

有些内容正在访问work_item,但该表的名称为workitem

表格上可能存在编码错误 或许您还没有发布最新版本。