上个月写的项目今天拿出来修改,重新跑起来报错,错误如下:
<!-- lang: java -->
org.springframework.jdbc.BadSqlGrammarException:
Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mdpc.T_FIELD' doesn't exist
The error may involve defaultParameterMap
The error occurred while setting parameters
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mdpc.T_FIELD' doesn't exist
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mdpc.T_FIELD' doesn't exist at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:346) at $Proxy10.selectList(Unknown Source) 错误一目了然,是找不到表。 原因:之前连接的数据库是本地的,系统是windows系统,现在连接的是服务器,Linux系统的数据库。本地连接貌似没有对查询语句的表名大小写有要求,远程到Linux就要区分了。 解决:把查询语句的表名大小写改成与数据库匹配的即可。