Mybatis SQLException with Error code '911', Extracted SQL state class '42' from value '42000'

  • 问题:
    • MyBatis 查询Oracle数据库表或者视图,一直很正常,直到今天有一个需求需要查询数据库的系统表all_tab_columns,然后就报出这个错误
    • 一开始我以为MyBatis不能直接查询数据库系统表,网上还搜不出MyBatis查询系统表相关问题
    • 所以我后来用一个视图存储查询结果,然后MyBatis直接查询视图,发现还是这个错误,于是觉得问题不在这里
    • 最后,经过一系列排查和师兄的帮助下,才发现,原来是查询语句最后多了一个’;‘,无效字符,然后报出一系列不知道什么的错误,在此记录一下。
2017-11-03 14:45:59.897 [http-bio-80-exec-26] DEBUG c.t.i.T.m.T.queryUploadFieldsDetailsColumns -ooo Using Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@17c60929]
2017-11-03 14:45:59.898 [http-bio-80-exec-26] DEBUG c.t.i.T.m.T.queryUploadFieldsDetailsColumns -==>  Preparing: select a.COLUMN_NAME as "columnName" from IAS_UPLOAD_FIELDS_DETAILS_COL a ORDER BY a.COLUMN_ID; 
2017-11-03 14:45:59.898 [http-bio-80-exec-26] DEBUG c.t.i.T.m.T.queryUploadFieldsDetailsColumns -==> Parameters: 
2017-11-03 14:45:59.924 [http-bio-80-exec-26] DEBUG o.s.core.env.StandardEnvironment -Initializing new StandardEnvironment
2017-11-03 14:45:59.924 [http-bio-80-exec-26] DEBUG o.s.core.env.StandardEnvironment -Adding [systemProperties] PropertySource with lowest search precedence
2017-11-03 14:45:59.924 [http-bio-80-exec-26] DEBUG o.s.core.env.StandardEnvironment -Adding [systemEnvironment] PropertySource with lowest search precedence
2017-11-03 14:45:59.924 [http-bio-80-exec-26] DEBUG o.s.core.env.StandardEnvironment -Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2017-11-03 14:45:59.924 [http-bio-80-exec-26] INFO  o.s.b.f.xml.XmlBeanDefinitionReader -Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
2017-11-03 14:45:59.925 [http-bio-80-exec-26] DEBUG o.s.b.f.xml.DefaultDocumentLoader -Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl]
2017-11-03 14:45:59.926 [http-bio-80-exec-26] DEBUG o.s.b.factory.xml.BeansDtdResolver -Found beans DTD [http://www.springframework.org/dtd/spring-beans-2.0.dtd] in classpath: spring-beans-2.0.dtd
2017-11-03 14:45:59.928 [http-bio-80-exec-26] DEBUG o.s.b.f.x.DefaultBeanDefinitionDocumentReader -Loading bean definitions
2017-11-03 14:45:59.933 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'DB2'
2017-11-03 14:45:59.933 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'DB2'
2017-11-03 14:45:59.933 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'DB2' to allow for resolving potential circular references
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'DB2'
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'Derby'
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'Derby'
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'Derby' to allow for resolving potential circular references
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'Derby'
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'H2'
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'H2'
2017-11-03 14:45:59.938 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'H2' to allow for resolving potential circular references
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'H2'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'HSQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'HSQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'HSQL' to allow for resolving potential circular references
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'HSQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'Informix'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'Informix'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'Informix' to allow for resolving potential circular references
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'Informix'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'MS-SQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'MS-SQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'MS-SQL' to allow for resolving potential circular references
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'MS-SQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'MySQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'MySQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'MySQL' to allow for resolving potential circular references
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'MySQL'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'Oracle'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'Oracle'
2017-11-03 14:45:59.939 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'Oracle' to allow for resolving potential circular references
2017-11-03 14:45:59.941 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'Oracle'
2017-11-03 14:45:59.941 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'PostgreSQL'
2017-11-03 14:45:59.941 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'PostgreSQL'
2017-11-03 14:45:59.941 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'PostgreSQL' to allow for resolving potential circular references
2017-11-03 14:45:59.942 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'PostgreSQL'
2017-11-03 14:45:59.942 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating shared instance of singleton bean 'Sybase'
2017-11-03 14:45:59.942 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Creating instance of bean 'Sybase'
2017-11-03 14:45:59.942 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Eagerly caching bean 'Sybase' to allow for resolving potential circular references
2017-11-03 14:45:59.942 [http-bio-80-exec-26] DEBUG o.s.b.f.s.DefaultListableBeanFactory -Finished creating instance of bean 'Sybase'
2017-11-03 14:45:59.942 [http-bio-80-exec-26] INFO  o.s.j.support.SQLErrorCodesFactory -SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
2017-11-03 14:45:59.956 [http-bio-80-exec-26] DEBUG o.s.jdbc.datasource.DataSourceUtils -Returning JDBC Connection to DataSource
2017-11-03 14:45:59.956 [http-bio-80-exec-26] DEBUG o.s.j.support.SQLErrorCodesFactory -Database product name cached for DataSource [com.mchange.v2.c3p0.ComboPooledDataSource@19d63f9b]: name is 'Oracle'
2017-11-03 14:45:59.957 [http-bio-80-exec-26] DEBUG o.s.j.support.SQLErrorCodesFactory -SQL error codes for 'Oracle' found
2017-11-03 14:45:59.957 [http-bio-80-exec-26] DEBUG o.s.j.s.SQLErrorCodeSQLExceptionTranslator -Unable to translate SQLException with Error code '911', will now try the fallback translator
2017-11-03 14:45:59.957 [http-bio-80-exec-26] DEBUG o.s.j.s.SQLStateSQLExceptionTranslator -Extracted SQL state class '42' from value '42000'
2017-11-03 14:45:59.958 [http-bio-80-exec-26] DEBUG org.mybatis.spring.SqlSessionUtils -Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6c13312]
2017-11-03 14:45:59.958 [http-bio-80-exec-26] DEBUG o.s.jdbc.datasource.DataSourceUtils -Returning JDBC Connection to DataSource

你可能感兴趣的:(MyBatis)