数据库的Timeout 其实有很多种情况。

一个是执行的超时时间 executionTimeOut,一个是连接的超时时间connectionTimeOut,

还有呢? 等待的超时时间 ReadTimeout。不过很多数据库情况下connectionTimeOut 就是ReadTimeout

props.put("user", userName);
props.put("password", passSecret);
if ("oracle".equals(dbType)) {
//props.put("connectionProperties", "oracle.net.CONNECT_TIMEOUT=10000;oracle.jdbc.ReadTimeout=10000");
props.put("oracle.net.CONNECT_TIMEOUT", "10000");
props.put("oracle.jdbc.ReadTimeout", "10000");
}

String sleepsql = "declare "+
"begin "+
"sys.dbms_lock.sleep(20); "+
"dbms_output.put_line('asfasf');"+
"end;";
String sqlStr =
"select distinct tablespace_name from sys.dba_tables where owner = '"
+ dbInfo.getName().toUpperCase()
+ "' and trim(tablespace_name) is not null";
List<String> dbList = new ArrayList<String>();
PreparedStatement statement = null;
ResultSet rs = null;
try {
CallableStatement callableStatement = conn.prepareCall(sleepsql);
callableStatement.execute();
//conn.setNetworkTimeout(Executors.newCachedThreadPool(), 30000);
} catch (SQLException e) {
e.printStackTrace();
} finally {

}

开始是通过下面的,不过一直就是报错,行不通, 貌似驱动版本不够新。

conn.setNetworkTimeout(Executors.newCachedThreadPool(), 30000);

有关数据库的锁:

http://www.cnblogs.com/cqubityj/archive/2012/06/16/2551947.html

http://www.cnblogs.com/leemoby/p/3583428.html

LOCK TABLE iempeam.t_aa IN EXCLUSIVE MODE

SELECT * FROM  iempeam.t_aa  TABLOCKX

数据库的Timeout的更多相关文章

  1. SqlException:ConnectionTimeout Expired. The timeout period elapsed during the post-login phase

    linux系统部署.netcore程序后,访问某台sqlserver 2008 R2数据库 Connection Timeout Expired. The timeout period elapsed ...

  2. 34、使用Python操作MySql数据库和MsSql数据库

    一.数据库的安装和连接 1. PyMySQL的安装 pip install pymysql 2 .python连接数据库 import pymysql db = pymysql.connect(&qu ...

  3. PAIP.MYSQL SLEEP 连接太多解决

    PAIP.MYSQL SLEEP 连接太多解决 作者Attilax  艾龙,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:http://blog.csdn.n ...

  4. kettle 数据库连接中断重置

    项目适用kettle作为etl工具,源数据库为mysql库,目标库为oracle.在持续的循环调度中,经常发现oracle的数据库连接中断,需要重置. 具体报错信息如下: INFO  26-12 23 ...

  5. redis实现spring-redis-data的入门实例

    redis的客户端实现.主要分为spring-redis-data .jredis. 记录下spring-redis-data的学习心得:spring-redis-data 中我目前主要用了它的存.取 ...

  6. Redis键迁移

    Redis键迁移   在使用Redis的过程中,很多时候我们会遇到需要进行键迁移的问题,需要将指定Redis中的指定数据迁移到其他Redis当中,键迁移有三种方法,我们来进行一一介绍. 一.move ...

  7. Redis学习笔记--常用命令

    以下为本人学习Redis的备忘录,记录了大部分常用命令 1.客户端连接redis服务端: ===启动Redis服务端 redis-server /yourpath/redis.conf ===启动Re ...

  8. NoSQL - KVstore -Redis

    Redis键迁移 在使用Redis的过程中,很多时候我们会遇到需要进行键迁移的问题,需要将指定Redis中的指定数据迁移到其他Redis当中,键迁移有三种方法,我们来进行一一介绍. 一.move mo ...

  9. SQLite3 of python

    SQLite3 of python 一.SQLite3 数据库 SQLite3 可使用 sqlite3 模块与 Python 进行集成,一般 python 2.5 以上版本默认自带了sqlite3模块 ...

随机推荐

  1. vue 2 滚动条加载更多数据实现

    解析: 判断滚动条到底部,需要用到DOM的三个属性值,即scrollTop.clientHeight.scrollHeight. scrollTop为滚动条在Y轴上的滚动距离. clientHeigh ...

  2. JSON字符串解析

    有时保存在数据库的数据是一串json字符串,需要进行读取的时候就需要解析操作. 简单介绍两种: 1.net.sf.json.* 2.com.alibaba.fastjson.* 需要的包自行下载. 第 ...

  3. ros机器人开发概述

    1.       ROS项目开发流程? 参照古月大神写的ROS探索总结系列:http://blog.exbot.net/archives/619 具体项目设计可看看<程序员>杂志的最新一篇 ...

  4. map容器的使用

    1.map是STL容器中的一种,属于关联性容器.以key value的形式存储.key必须唯一.如果重复则插入失败.插入后按照key默认排序.必须要先声明命名空间:using namespace st ...

  5. STM32之PWM波形输出配置总结

    一.   TIMER分类: STM32中一共有11个定时器,其中TIM6.TIM7是基本定时器:TIM2.TIM3.TIM4.TIM5是通用定时器:TIM1和TIM8是高级定时器,以及2个看门狗定时器 ...

  6. Everything搜索结果显示0 Object

    比较过windows本身的文档搜索功能,Everything的本地文档搜索能力简直令人咋舌,更逆天的是软件本身体积很小. 问题:打开everything时,文件列表消失,软件下方信息为0 object ...

  7. VS2013正确设置DLL环境变量目录的方法

    VS有个比较迷惑人的选项,就是在工程>>属性中有个Executable Directories设置项, 几乎所有地球人都认为这个选项是设置exe可执行文件依赖的DLL目录用的,这无疑会方便 ...

  8. javascript中array常用属性方法

    属性: length 表示一个无符号 32-bit 整数,返回一个数组中的元素个数. 截短数组..截短至长度2  则:   .length = 2 方法: Array.from() 方法可以将一个类数 ...

  9. [UCSD白板题] Greatest Common Divisor

    Problem Introduction The greatest common divisor \(GCD(a, b)\) of two non-negative integers \(a\) an ...

  10. MPI之求和

    // MPI1.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include "mpi.h" #include &l ...