开发者社区> 问答> 正文

druid集成ODPS JDBC时,查询数据会有卡顿现象,且抛出奇怪异常

druid版本:

com.alibaba druid-spring-boot-starter 1.1.10

使用springbean对ODPS进行直接集成操作时,SQL执行基本正常。但是切换到Druid进行ODPS集成时,会出现服务卡顿,以及一下异常,请问应该怎么解决呢?

2020-12-04 16:23:01,458 [http-nio-8510-exec-3] ERROR c.a.d.p.DruidPooledPreparedStatement - getMaxFieldSize error java.sql.SQLFeatureNotSupportedException: null at com.aliyun.odps.jdbc.OdpsStatement.getMaxFieldSize(OdpsStatement.java:534) at com.alibaba.druid.filter.FilterChainImpl.statement_getMaxFieldSize(FilterChainImpl.java:2863) at com.alibaba.druid.filter.FilterAdapter.statement_getMaxFieldSize(FilterAdapter.java:2551) at com.alibaba.druid.filter.FilterChainImpl.statement_getMaxFieldSize(FilterChainImpl.java:2861) at com.alibaba.druid.filter.FilterAdapter.statement_getMaxFieldSize(FilterAdapter.java:2551) at com.alibaba.druid.filter.FilterChainImpl.statement_getMaxFieldSize(FilterChainImpl.java:2861) at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.getMaxFieldSize(StatementProxyImpl.java:317) at com.alibaba.druid.pool.DruidPooledPreparedStatement.(DruidPooledPreparedStatement.java:81) at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:358) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:55) at com.sun.proxy.$Proxy305.prepareStatement(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:87) at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88) at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at com.github.pagehelper.util.ExecutorUtil.executeAutoCount(ExecutorUtil.java:166) at com.github.pagehelper.PageInterceptor.count(PageInterceptor.java:157) at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:100) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy304.query(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) at com.sun.proxy.$Proxy196.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) at com.sun.proxy.$Proxy217.attendanceIMEICount(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)

原提问者GitHub用户491674105

展开
收起
山海行 2023-07-05 18:13:11 140 0
4 条回答
写回答
取消 提交回答
  • 北京阿里云ACE会长

    看起来是在使用 Druid 连接 ODPS JDBC 时,查询数据时会有卡顿现象,并且抛出奇怪的异常。这种情况可能是由于网络延迟、ODPS JDBC 配置错误、Druid 数据源配置错误或其他原因导致的。

    2023-07-30 20:00:34
    赞同 展开评论 打赏
  • 检查ODPS JDBC驱动版本:确保你使用的ODPS JDBC驱动版本与Druid兼容。不同版本的驱动程序可能会有不同的功能支持和限制。建议查看ODPS JDBC驱动的官方文档,了解与Druid集成时所需的兼容性信息。

    检查Druid配置:检查你的Druid配置文件,确保配置中使用了正确的ODPS JDBC驱动类。确保在Druid连接池配置中指定了正确的ODPS连接信息,包括URL、用户名、密码等。

    排查代码逻辑:检查代码逻辑,确保在使用Druid执行ODPS相关操作时没有使用到不受支持的方法或功能。根据异常信息,问题似乎出现在getMaxFieldSize方法调用时,这可能与Druid在处理ODPS语句时不支持该方法有关。

    升级Druid版本:如果使用的Druid版本较旧,尝试升级到最新版本,以获得更好的ODPS集成支持和更好的兼容性。查看Druid的发布说明和文档,了解新版本的变化和改进。

    2023-07-11 09:09:28
    赞同 展开评论 打赏
  • 问题已修复,请用新版本

    https://github.com/alibaba/druid/releases/tag/1.2.5

    原回答者GitHub用户wenshao

    2023-07-06 10:48:01
    赞同 展开评论 打赏
  • 这个问题可能是由于Druid与ODPS JDBC驱动的兼容性问题引起的。根据异常信息,可以看到java.sql.SQLFeatureNotSupportedException异常被抛出,指示调用了ODPS驱动不支持的方法getMaxFieldSize()

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

    1. 确认版本兼容性:确保使用的Druid版本与ODPS JDBC驱动版本兼容。如果存在兼容性问题,尝试升级或降级其中一个组件。

    2. 配置连接属性:尝试在Druid配置中设置一些ODPS JDBC驱动需要的属性,如defaultFetchSizeuseCursorFetch等。具体的配置方式可以参考Druid和ODPS JDBC驱动的文档。

    3. 排查其他因素:确认其他代码逻辑没有影响查询性能的问题。检查是否有其他拦截器、过滤器或代理对SQL执行过程进行干扰。

    2023-07-05 18:54:26
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
DataWorks数据集成实时同步最佳实践(含内测邀请)-2020飞天大数据平台实战应用第一季 立即下载
DataWorks调度任务迁移最佳实践-2020飞天大数据平台实战应用第一季 立即下载
基于DataWorks数据服务构建疫情大屏-2020飞天大数据平台实战应用第一季 立即下载