开发者社区> 问答> 正文

一直报这个错误,但是又不影响结果,是怎么回事呢?com.alibaba.druid.sql.pars

19:52:04.863 [qtp16094384-49] ERROR c.a.druid.filter.stat.StatFilter - merge sql error, dbType log4jdbc, sql : select this_.id as id1_28_2_, this_.createDate as createDa2_28_2_, this_.modifyDate as modifyDa3_28_2_, this_.timestamp as timestam4_28_2_, this_.company_id as company50_28_2_, this_.creater_id as creater51_28_2_, this_.state as state5_28_2_, this_.a1 as a6_28_2_, this_.a2 as a7_28_2_, this_.a3 as a8_28_2_, this_.a4 as a9_28_2_, this_.a5 as a10_28_2_, this_.b01 as b11_28_2_, this_.b02 as b12_28_2_, this_.b1 as b13_28_2_, this_.b2 as b14_28_2_, this_.b3 as b15_28_2_, this_.b4 as b16_28_2_, this_.c1 as c17_28_2_, this_.c2 as c18_28_2_, this_.c3 as c19_28_2_, this_.c4 as c20_28_2_, this_.c5 as c21_28_2_, this_.c6 as c22_28_2_, this_.c7 as c23_28_2_, this_.department as departm24_28_2_, this_.name as name25_28_2_, this_.no as no26_28_2_, this_.pinYin as pinYin27_28_2_, this_.pinYinHead as pinYinH28_28_2_, this_.snapshot_id as snapsho52_28_2_, this_.sortNo as sortNo29_28_2_, this_.sumScore as sumScor30_28_2_, this_.used as used31_28_2_, this_.users_id as users_i53_28_2_, this_.weight_Avgcycle as weight_32_28_2_, this_.weight_Avgnegotiation as weight_33_28_2_, this_.weight_BusiConversionrate as weight_34_28_2_, this_.weight_Client as weight_35_28_2_, this_.weight_Collectionrate as weight_36_28_2_, this_.weight_Completionreate as weight_37_28_2_, this_.weight_ContConversionrate as weight_38_28_2_, this_.weight_ContractMoney as weight_39_28_2_, this_.weight_Door as weight_40_28_2_, this_.weight_Grossmargin as weight_41_28_2_, this_.weight_IM as weight_42_28_2_, this_.weight_Invoice as weight_43_28_2_, this_.weight_Linkman as weight_44_28_2_, this_.weight_NewReceivables as weight_45_28_2_, this_.weight_Phone as weight_46_28_2_, this_.weight_Receipt as weight_47_28_2_, this_.weight_SumReceivables as weight_48_28_2_, this_.weight_eMail as weight_49_28_2_, company2_.id as id1_15_0_, company2_.createDate as createDa2_15_0_, company2_.modifyDate as modifyDa3_15_0_, company2_.timestamp as timestam4_15_0_, company2_.company_id as company30_15_0_, company2_.creater_id as creater31_15_0_, company2_.state as state5_15_0_, company2_.apino as apino6_15_0_, company2_.name as name7_15_0_, company2_.no as no8_15_0_, company2_.pinYin as pinYin9_15_0_, company2_.pinYinHead as pinYinH10_15_0_, company2_.address as address11_15_0_, company2_.adminId as adminId12_15_0_, company2_.apiEnable as apiEnab13_15_0_, company2_.apiSecret as apiSecr14_15_0_, company2_.apiToken as apiToke15_15_0_, company2_.apiUrl as apiUrl16_15_0_, company2_.apiWsEnable as apiWsEn17_15_0_, company2_.area as area18_15_0_, company2_.city as city19_15_0_, company2_.county as county20_15_0_, company2_.departmentShare as departm21_15_0_, company2_.description as descrip22_15_0_, company2_.headImage as headIma23_15_0_, company2_.help as help24_15_0_, company2_.ifApprove as ifAppro25_15_0_, company2_.isBestselling as isBests26_15_0_, company2_.province as provinc27_15_0_, company2_.subname as subname28_15_0_, company2_.subscription as subscri29_15_0_, users1_.id as id1_60_1_, users1_.createDate as createDa2_60_1_, users1_.modifyDate as modifyDa3_60_1_, users1_.timestamp as timestam4_60_1_, users1_.company_id as company27_60_1_, users1_.creater_id as creater28_60_1_, users1_.state as state5_60_1_, users1_.apino as apino6_60_1_, users1_.name as name7_60_1_, users1_.no as no8_60_1_, users1_.pinYin as pinYin9_60_1_, users1_.pinYinHead as pinYinH10_60_1_, users1_.address as address11_60_1_, users1_.adminId as adminId12_60_1_, users1_.birthday as birthda13_60_1_, users1_.city as city14_60_1_, users1_.county as county15_60_1_, users1_.email as email16_60_1_, users1_.focusMapLat as focusMa17_60_1_, users1_.focusMapLng as focusMa18_60_1_, users1_.headImage_id as headIma29_60_1_, users1_.idCard as idCard19_60_1_, users1_.ifEvaluate as ifEvalu20_60_1_, users1_.mobile as mobile21_60_1_, users1_.phone as phone22_60_1_, users1_.province as provinc23_60_1_, users1_.sex as sex24_60_1_, users1_.theme as theme25_60_1_, users1_.userPoint as userPoi26_60_1_ from ss_evaluateresult this_ inner join ss_company company2_ on this_.company_id=company2_.id inner join ss_users users1_ on this_.users_id=users1_.id where (this_.users_id=? or users1_.id=?) and (this_.company_id=? or company2_.id=?) and (this_.state=?) and this_.snapshot_id=? order by this_.createDate asc, this_.createDate desc limit ? com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'desc limit ?',expect IDENTIFIER, actual IDENTIFIER limit at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:229) ~[druid-1.0.12.jar:1.0.12] at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:325) ~[druid-1.0.12.jar:1.0.12] at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:121) ~[druid-1.0.12.jar:1.0.12] at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:116) ~[druid-1.0.12.jar:1.0.12]

原提问者GitHub用户xuminwlt

展开
收起
山海行 2023-07-05 22:09:57 3013 0
4 条回答
写回答
取消 提交回答
  • 北京阿里云ACE会长

    com.alibaba.druid.sql.parser.ParserException: syntax error"是由阿里巴巴Druid SQL解析器在解析SQL语句时发现语法错误导致的异常。这种异常通常表示SQL语句不符合SQL语法规范,或者包含一些Druid解析器不支持的SQL语法。因此,如果出现此异常,需要检查SQL语句是否正确。

    在某些情况下,即使出现了"com.alibaba.druid.sql.parser.ParserException: syntax error"异常,SQL查询仍然可以正常执行并返回结果。这通常是因为Druid SQL解析器可以忽略SQL语法错误并尝试对其进行解析,而且在一些情况下可以正确解析。但是,这种情况下不能保证结果的正确性,因此建议尽可能避免出现语法错误。

    如果您的SQL查询出现了"com.alibaba.druid.sql.parser.ParserException: syntax error"异常,可以考虑以下几个方面:

    检查SQL语句:检查SQL语句是否符合SQL语法规范,确保不包含Druid解析器不支持的SQL语法。可以使用SQL语法检查工具来检查SQL语句。

    更新Druid版本:如果您使用的是较旧的Druid版本,可以尝试更新到最新版本,以便获得更好的SQL解析器支持和更好的错误处理。

    更换SQL解析器:如果Druid SQL解析器无法解析您的SQL查询,可以尝试使用其他SQL解析器,如ANTLR、JavaCC等。

    2023-07-29 22:53:54
    赞同 展开评论 打赏
  • 值得去的地方都没有捷径

    这个错误是由于com.alibaba.druid.sql.parser.SQLParseException引起的。它通常是由于SQL语句的语法错误或不完整引起的。在您提供的日志中,显示了一条SQL查询语句,但是由于日志中的截断,我无法看到完整的SQL语句。

    要解决这个问题,您可以尝试以下几个步骤:

    检查SQL语句的语法:确保SQL语句是正确的,并且没有任何语法错误。您可以使用SQL编辑器或在线SQL验证工具来验证语法。

    检查数据库连接配置:确保数据库连接配置正确,并且数据库服务正常运行。您可以尝试使用其他工具连接到数据库并执行相同的SQL语句,以确认数据库连接是否正常。

    更新数据库驱动程序:如果您使用的是旧版本的数据库驱动程序,尝试更新到最新版本的驱动程序,以确保与数据库的兼容性。

    检查数据库表结构:如果SQL语句涉及到表操作,确保表结构与SQL语句一致,并且表中包含所需的列。

    检查日志配置:如果您使用的是日志框架,确保日志配置正确,并且日志级别设置为适当的级别,以便更详细地记录错误信息。

    如果您尝试了上述步骤仍然无法解决问题,建议提供完整的错误日志和相关的SQL语句,以便更好地帮助您解决问题。

    2023-07-07 12:04:18
    赞同 展开评论 打赏
  • 这个错误是配了log4jdbc的url 数据库类型是 dbType log4jdbc,在使用的时候就报错了,直接使用mysql就不报错了。

    原回答者GitHub用户xuminwlt

    2023-07-06 12:44:25
    赞同 展开评论 打赏
  • 根据错误日志,报错的原因是SQL语句的语法错误。具体来说,解析器在"desc limit ?"这部分出现了错误。

    根据错误信息,预期的标识符(IDENTIFIER)是limit,但实际上发现的标识符也是limit。这可能意味着解析器在解析SQL语句时遇到了问题。

    要解决这个问题,您可以尝试以下几个步骤:

    1. 检查SQL语句是否正确:检查您的SQL语句中的关键字、表名、列名以及其他语法元素是否正确拼写和使用。确保没有缺失、多余或错误的标点符号。
    2. 检查使用的数据库版本和兼容性:不同版本的数据库可能对SQL语法有所差异。请确保您正在使用的数据库版本与您编写的SQL语句兼容,并且支持使用"desc limit"这样的语法。
    3. 尝试使用其他方式实现相同的功能:如果无法解决语法错误,考虑使用其他方法或技术来实现您想要的查询逻辑。例如,您可以尝试使用ORDER BY子句来进行排序,而不使用DESC和LIMIT。
    2023-07-06 08:43:56
    赞同 展开评论 打赏
问答分类:
SQL
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载