【发布时间】:2014-02-02 00:59:54
【问题描述】:
当我尝试从 Eclipse 中在 tomcat 服务器上运行我的 spring mvc 应用程序时,我在命令行中收到以下错误消息:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.jdbc.datasource.init.DataSourceInitializer#0':
Invocation of init method failed;
nested exception is org.springframework.dao.DataAccessResourceFailureException:
Failed to execute database script;
nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException:
Failed to execute SQL script statement at line 68 of resource class path resource[db/mysql/populateDB.sql]:
INSERT IGNORE INTO codes('99503', 'Home visit for respiratory therapy care')
请注意,引发错误的代码行是:
INSERT IGNORE INTO codes('99503', 'Home visit for respiratory therapy care');
创建代码表的代码如下:
CREATE TABLE IF NOT EXISTS codes(
code VARCHAR(100) PRIMARY KEY,
description VARCHAR(500)
)engine=InnoDB;
如何修复代码以克服此错误?我的猜测是它与将 VARCHAR 主键插入 MySQL 时所需的语法有关,但我不确定。
【问题讨论】:
标签: mysql sql spring spring-mvc