druid sqlserver 分页语句监控打开报错

2w3rbyxf  于 2021-11-27  发布在  Java
关注(0)|答案(8)|浏览(441)

com.alibaba.druid.sql.parser.ParserException: syntax error, WITH WITH, pos 4
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:299)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:107)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:102)
at com.alibaba.druid.sql.SQLUtils.parseStatements(SQLUtils.java:255)
at com.alibaba.druid.stat.DruidStatService.getSqlStat(DruidStatService.java:311)
at com.alibaba.druid.stat.DruidStatService.service(DruidStatService.java:136)
at com.alibaba.druid.support.http.StatViewServlet.process(StatViewServlet.java:162)
at com.alibaba.druid.support.http.ResourceSerlvet.service(ResourceSerlvet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

dluptydi

dluptydi2#

请问这个问题有解了吗?这个数据源的 sql 解析老是出错.

我的问题解决了.
是我的数据库类型配置错误导致.我原来使用的是 Mysql 的数据库.现在改为了 SqlServer 有的配置没有改全.导致其语法解析应该还是使用 Mysql 的那一套来解析的.

<bean id="stat-filter" class="com.*.AcStatFilter">
    <property name="dbType" value="sqlserver"/>
    <property name="slowSqlMillis" value="5000" />
    <property name="logSlowSql" value="true" />
    <property name="mergeSql" value="true" />
    <property name="isLogAllSql" value="false"/>
</bean>

<bean id="wall-filter-config" class="com.alibaba.druid.wall.WallConfig" init-method="init">
    <property name="dir" value="META-INF/druid/wall/sqlserver" />
    <property name="selectWhereAlwayTrueCheck" value="false" />
    <property name="selectHavingAlwayTrueCheck" value="false" />
</bean>

<bean id="wall-filter" class="com.alibaba.druid.wall.WallFilter">
    <property name="dbType" value="sqlserver" />
    <property name="config" ref="wall-filter-config" />
</bean>
jm81lzqq

jm81lzqq3#

请提供出错的sql和druid版本信息

jm81lzqq

jm81lzqq4#

sql 无法查看,因为一点击就报错,打开的查看页面sql数据为空;

druid版本是最新版本,本来使用一个旧的,更新到最新版后仍然报错;

sql 语句就是hibernate jpa 使用sqlserver的分页语句,是不是语句过长的原因呢,表的字段有点多。

5gfr0r5j

5gfr0r5j5#

具体的druid版本号码。和sql方便贴出来,谢谢!!

ssgvzors

ssgvzors7#

sql请通过文本的方式提供

fbcarpbf

fbcarpbf8#

WITH query AS (SELECT
inner_query.*,
ROW_NUMBER() OVER (
ORDER BY
CURRENT_TIMESTAMP) ashibernate_row_nr
FROM
( select
saleexchan0_.InMoney as InMoney6_8_,
saleexchan0_.UserBalance as UserBal12_8_
from
Exchange saleexchan0_
where
1=1 ) inner_query ) SELECT
InMoney6_8_,
UserBal12_8_
FROM
query
WHERE

hibernate_row_nr>= ?

ANDhibernate_row_nr< ?

相关问题