@冷眸 2019-07-10 15:55 采纳率: 0%
浏览 360

Oracle spring 手动控制事务 会话inactive?

Oracle数据库 spring手动控制事务 有时候执行 数据库会话会一直时inactive状态

不知道是代码问题还是数据库连接池的问题 各位大佬

java代码

public void ApprovalProtocol(ApprovalVo approvalVo)  {
        //事务
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
        TransactionStatus status = dataSourceTransactionManager.getTransaction(def);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
        try {
           //这里具体的业务代码   更新几个表
                    //提交事务
            dataSourceTransactionManager.commit(status);
            System.out.println("这里提交结束了---》"+simpleDateFormat.format(new Date()));
        } catch (Exception e) {
            e.printStackTrace();
            dataSourceTransactionManager.rollback(status);
            System.out.println("这里异常会滚结束了---》"+simpleDateFormat.format(new Date()));
            throw e;
        }
    }

数据库连接池配置

spring.datasource.druid.connection-init-sqls=SELECT 1 FROM DUAL
--连接池的配置信息
spring.datasource.druid.initial-size=10
spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
spring.datasource.druid.test-while-idle=true
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.test-on-return=true
spring.datasource.druid.min-idle=5
spring.datasource.druid.max-active=50
spring.datasource.druid.max-wait=60000
spring.datasource.druid.time-between-log-stats-millis=60000
spring.datasource.tomcat.min-evictable-idle-time-millis=300000
spring.datasource.druid.filter.stat.slow-sql-millis=2000
spring.datasource.druid.filter.stat.log-slow-sql=true
spring.datasource.druid.pool-prepared-statements=true
spring.datasource.druid.max-pool-prepared-statement-per-connection-size=50
spring.datasource.druid.connection-properties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=2000
spring.datasource.druid.min-evictable-idle-time-millis=600000
spring.datasource.druid.time-between-eviction-runs-millis=300000
#spring.datasource.druid.filters=stat,wall
spring.datasource.druid.filter.commons-log.statement-log-enabled=true
spring.datasource.druid.filter.stat.db-type=oracle
spring.datasource.druid.filter.wall.enabled=false
spring.datasource.druid.filter.wall.config.delete-allow=true
spring.datasource.druid.filter.wall.config.drop-table-allow=false
spring.datasource.druid.filter.log4j2.enabled=false
spring.datasource.druid.web-stat-filter.enabled=true
spring.datasource.druid.web-stat-filter.url-pattern=/*
spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
spring.datasource.druid.web-stat-filter.profile-enable=true
  • 写回答

1条回答 默认 最新

  • 回到未来望过去 2019-07-11 08:54
    关注

    这个无所谓啊,并不是断掉了,不可能一直active的,不影响事务的完整性

    评论

报告相同问题?

悬赏问题

  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 如何提取csv文件中需要的列,将其整合为一篇完整文档,并进行jieba分词(语言-python)
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置