工作中遇到异常:org.springframework.jdbc.UncategorizedSQLException: Hibernate-related JDBC operation; uncategorized SQLException for SQL []; SQL state [99999]; error code [17034]; 出现不支持的 SQL92 标记: 122: 61977CB5; nested exception is java.sql.SQLException: 出现不支持的 SQL92 标记: 122: 61977CB5
截图如下:
最终定位原因是:select * from student t where t.sname=''xiaoming''
在拼接sql时多写了一个单引号。
测试发现,如果字符串没有用单引号括起来,也会报同洋的错误。select * from student t where t.sname=xiaoming;
这只是一个简单的错误,定位起来也很容易。由于异常描述比较罕见,所有特写出来大家学习下。